From: Greg KH <gregkh@linuxfoundation•org>
To: Mark Einon <mark.einon@gmail•com>
Cc: devel@driverdev•osuosl.org, netdev@vger•kernel.org,
linux-kernel@vger•kernel.org
Subject: Re: [PATCH 3/8] staging: et131x: Use for loop to initialise contiguous registers to zero
Date: Sun, 31 Aug 2014 09:11:08 -0700 [thread overview]
Message-ID: <20140831161108.GA30925@kroah.com> (raw)
In-Reply-To: <20140831142502.GA2019@msilap.einon.net>
On Sun, Aug 31, 2014 at 03:25:03PM +0100, Mark Einon wrote:
> On Sat, Aug 30, 2014 at 01:32:16PM -0700, Greg KH wrote:
> > On Wed, Aug 20, 2014 at 11:17:53PM +0100, Mark Einon wrote:
> > > Replace a long list of contiguous writel() calls with a for loop iterating
> > > over the same values.
> > >
> > > Signed-off-by: Mark Einon <mark.einon@gmail•com>
> > > ---
> > > drivers/staging/et131x/et131x.c | 27 +++------------------------
> > > 1 file changed, 3 insertions(+), 24 deletions(-)
> > >
> > > diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
> > > index fffe763..44cc684 100644
> > > --- a/drivers/staging/et131x/et131x.c
> > > +++ b/drivers/staging/et131x/et131x.c
> > > @@ -1138,6 +1138,7 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter)
> > > u32 sa_lo;
> > > u32 sa_hi = 0;
> > > u32 pf_ctrl = 0;
> > > + u32 *wolw;
> > >
> > > /* Disable the MAC while it is being configured (also disable WOL) */
> > > writel(0x8, &rxmac->ctrl);
> > > @@ -1151,30 +1152,8 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter)
> > > * its default Values of 0x00000000 because there are not WOL masks
> > > * as of this time.
> > > */
> > > - writel(0, &rxmac->mask0_word0);
> > > - writel(0, &rxmac->mask0_word1);
> > > - writel(0, &rxmac->mask0_word2);
> > > - writel(0, &rxmac->mask0_word3);
> > > -
> > > - writel(0, &rxmac->mask1_word0);
> > > - writel(0, &rxmac->mask1_word1);
> > > - writel(0, &rxmac->mask1_word2);
> > > - writel(0, &rxmac->mask1_word3);
> > > -
> > > - writel(0, &rxmac->mask2_word0);
> > > - writel(0, &rxmac->mask2_word1);
> > > - writel(0, &rxmac->mask2_word2);
> > > - writel(0, &rxmac->mask2_word3);
> > > -
> > > - writel(0, &rxmac->mask3_word0);
> > > - writel(0, &rxmac->mask3_word1);
> > > - writel(0, &rxmac->mask3_word2);
> > > - writel(0, &rxmac->mask3_word3);
> > > -
> > > - writel(0, &rxmac->mask4_word0);
> > > - writel(0, &rxmac->mask4_word1);
> > > - writel(0, &rxmac->mask4_word2);
> > > - writel(0, &rxmac->mask4_word3);
> > > + for (wolw = &rxmac->mask0_word0; wolw <= &rxmac->mask4_word3; wolw++)
> > > + writel(0, wolw);
> >
> > You are now only writing to all locations 1 time, instead of 4 times,
> > like before, are you sure that is ok? Hardware is flaky, sometimes it
> > wants to be written to multiple times...
>
> Hi Greg,
>
> Thanks for the review.
>
> As far as my understanding goes, the new code is equivalent to the old
> code - it's a little confusing that the name refers to a word, but the
> masks are all 32 bit values, and the loop iterates over the contiguous
> list of masks found in txmac_regs (et131x.h:891 - the masks are also
> unused in the driver after being set).
>
> Or am I missing something here?
No, I was wrong, sorry, your explanation makes sense, sorry for the
noise.
greg k-h
next prev parent reply other threads:[~2014-08-31 16:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 22:17 [PATCH 0/8] Implement NAPI in et131x Mark Einon
2014-08-20 22:17 ` [PATCH 1/8] staging: et131x: Use eth_mac_addr() instead of duplicating the functionality Mark Einon
2014-08-20 22:17 ` [PATCH 2/8] staging: et131x: Don't handle rx/tx packets when changing mtu Mark Einon
2014-08-20 22:17 ` [PATCH 3/8] staging: et131x: Use for loop to initialise contiguous registers to zero Mark Einon
2014-08-30 20:32 ` Greg KH
2014-08-31 14:25 ` Mark Einon
2014-08-31 16:11 ` Greg KH [this message]
2014-08-20 22:17 ` [PATCH 4/8] staging: et131x: Use for loop to initialise contiguous macstat " Mark Einon
2014-08-21 8:40 ` David Laight
2014-08-21 10:05 ` Mark Einon
2014-08-20 22:17 ` [PATCH 5/8] staging: et131x: Remove unnecessary i2c_wack variable Mark Einon
2014-08-20 22:22 ` Fabio Estevam
2014-08-21 9:18 ` Mark Einon
2014-08-21 12:06 ` Fabio Estevam
2014-08-21 14:59 ` Mark Einon
2014-08-20 22:17 ` [PATCH 6/8] staging: et131x: Rename NUM_PACKETS_HANDLED to MAX_PACKETS_HANDLED Mark Einon
2014-08-20 22:17 ` [PATCH 7/8] staging: et131x: Fix ET_INTR_TXDMA_ISR register name typo Mark Einon
2014-08-20 22:17 ` [PATCH 8/8] staging: et131x: Implement NAPI support Mark Einon
2014-08-21 3:25 ` Stephen Hemminger
2014-08-21 9:23 ` Mark Einon
2014-08-21 3:25 ` Stephen Hemminger
2014-08-21 9:25 ` Mark Einon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140831161108.GA30925@kroah.com \
--to=gregkh@linuxfoundation$(echo .)org \
--cc=devel@driverdev$(echo .)osuosl.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=mark.einon@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox