Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756015AbcK3AOv (ORCPT ); Tue, 29 Nov 2016 19:14:51 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:36996 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754385AbcK3AOp (ORCPT ); Tue, 29 Nov 2016 19:14:45 -0500 Date: Tue, 29 Nov 2016 19:05:26 -0500 (EST) Message-Id: <20161129.190526.1414678491662084583.davem@davemloft.net> To: harini.katakam@xilinx.com Cc: nicolas.ferre@atmel.com, harinikatakamlinux@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, harinik@xilinx.com, michals@xilinx.com Subject: Re: [PATCH] net: macb: Write only necessary bits in NCR in macb reset From: David Miller In-Reply-To: <1480325029-39224-1-git-send-email-harinik@xilinx.com> References: <1480325029-39224-1-git-send-email-harinik@xilinx.com> X-Mailer: Mew version 6.7 on Emacs 25.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 29 Nov 2016 15:06:03 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1395 Lines: 37 From: Harini Katakam Date: Mon, 28 Nov 2016 14:53:49 +0530 > In macb_reset_hw, use read-modify-write to disable RX and TX. > This way exiting settings and reserved bits wont be disturbed. > Use the same method for clearing statistics as well. > > Signed-off-by: Harini Katakam This doesn't make much sense to me. Consider the two callers of this function. macb_init_hw() is going to do a non-masking write to the NCR register: /* Enable TX and RX */ macb_writel(bp, NCR, MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(MPE)); So obviously no other writable fields matter at all for programming the chip properly, otherwise macb_init_hw() would "or" in the bits after a read of NCR. But that's not what this code does, it writes "RE | TE | MPE" directly. And the other caller is macb_close() which is shutting down the chip so can zero out all the other bits and it can't possibly matter, also due to the assertion above about macb_init_hw() showing that only the RE, TE, and MPE bits matter for proper functioning of the chip. You haven't shown a issue caused by the way the code works now, so this patch isn't fixing a bug. In fact, the "bit preserving" would even be misleading to someone reading the code. They will ask themselves what bits need to be preserved, and as shown above none of them need to be. I'm not applying this, sorry.