From: Joe Perches <joe@perches.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH] sungem: remove superfluous variable
Date: Wed, 20 Feb 2008 11:09:27 -0800 [thread overview]
Message-ID: <1203534567.7181.200.camel@localhost> (raw)
In-Reply-To: <1203507467.17534.34.camel@johannes.berg>
On Wed, 2008-02-20 at 12:37 +0100, Johannes Berg wrote:
> There's no need to have two variables called 'i' when one
> suffices.
Additional minor cleanups: tabs and style
Signed-off-by: Joe Perches <joe@perches.com>
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 9721279..8d52d20 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -1817,24 +1817,22 @@ static void gem_init_dma(struct gem *gp)
/* Must be invoked under gp->lock and gp->tx_lock. */
static u32 gem_setup_multicast(struct gem *gp)
{
- u32 rxcfg = 0;
+ u32 rxcfg;
int i;
if ((gp->dev->flags & IFF_ALLMULTI) ||
(gp->dev->mc_count > 256)) {
- for (i=0; i<16; i++)
+ for (i = 0; i < 16; i++)
writel(0xffff, gp->regs + MAC_HASH0 + (i << 2));
- rxcfg |= MAC_RXCFG_HFE;
+ rxcfg = MAC_RXCFG_HFE;
} else if (gp->dev->flags & IFF_PROMISC) {
- rxcfg |= MAC_RXCFG_PROM;
+ rxcfg = MAC_RXCFG_PROM;
} else {
u16 hash_table[16];
u32 crc;
struct dev_mc_list *dmi = gp->dev->mc_list;
- int i;
- for (i = 0; i < 16; i++)
- hash_table[i] = 0;
+ memset(hash_table, 0, sizeof(hash_table));
for (i = 0; i < gp->dev->mc_count; i++) {
char *addrs = dmi->dmi_addr;
@@ -1844,13 +1842,13 @@ static u32 gem_setup_multicast(struct gem *gp)
if (!(*addrs & 1))
continue;
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, addrs);
crc >>= 24;
hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
}
- for (i=0; i<16; i++)
+ for (i = 0; i < ARRAY_SIZE(hash_table); i++)
writel(hash_table[i], gp->regs + MAC_HASH0 + (i << 2));
- rxcfg |= MAC_RXCFG_HFE;
+ rxcfg = MAC_RXCFG_HFE;
}
return rxcfg;
next prev parent reply other threads:[~2008-02-20 19:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-20 11:37 [PATCH] sungem: remove superfluous variable Johannes Berg
2008-02-20 19:09 ` Joe Perches [this message]
2008-02-20 21:47 ` Joe Perches
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=1203534567.7181.200.camel@localhost \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=johannes@sipsolutions.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).