From: Nishanth Aravamudan <nacc@us.ibm.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [third][PATCH 3/4][2.6 drivers/net/skfp/smt.c:]replace SIZE
Date: Mon, 16 Jul 2007 17:24:31 +0000 [thread overview]
Message-ID: <20070716172431.GJ17929@us.ibm.com> (raw)
In-Reply-To: <20070716141818.30653.70760.sendpatchset@shcherbakov.homelinux.net>
On 16.07.2007 [19:06:36 +0200], walter harms wrote:
>
>
> acripps wrote:
> > Removed the N_SMT_PLEN macro in favor of the more generic ARRAY_SIZE(arr)
> > defined in kernel.h
> > Compile tested, no issues found.
> > Signed-off-by: Aaron Cripps <cripps@cs.mun.ca>
> >
> > diff --git a/drivers/net/skfp/smt.c b/drivers/net/skfp/smt.c
> > index 75afc1f..a1c49ed 100644
> > --- a/drivers/net/skfp/smt.c
> > +++ b/drivers/net/skfp/smt.c
> > @@ -1654,8 +1654,6 @@ static const struct smt_pdef {
> > { SMT_P4053, 0, SWAP_SMT_P4053 } ,
> > } ;
> >
> > -#define N_SMT_PLEN (sizeof(smt_pdef)/sizeof(smt_pdef[0]))
> > -
> > int smt_check_para(struct s_smc *smc, struct smt_header *sm,
> > const u_short list[])
> > {
> > @@ -1881,7 +1879,7 @@ void smt_swap_para(struct smt_header *sm, int len, int direction)
> > if (plen < 0)
> > break ;
> > plen += PARA_LEN ;
> > - for (i = N_SMT_PLEN, pd = smt_pdef; i ; i--,pd++) {
> > + for (i = ARRAY_SIZE(smt_pdef), pd = smt_pdef; i ; i--,pd++) {
> > if (pd->ptype = type)
> > break ;
> > }
>
> your patch seems ok but the stile here ...
>
> pd=smt_pdef;
> for(i=ARRAY_SIZE(smt_pdef);i;i--) {
> if (pd->ptype = type)
> break ;
> else pd++;
> }
>
> normally i would say it should be more like
> for(i=0;i<ARRAY_SIZE(smt_pdef);i++) (rule of least surprise) but i
> have no clue why he did it not this way.
Well, I think immediately following this loop is
if (i && pd->pswap) {
smt_string_swap(p+PARA_LEN,pd->pswap,len) ;
}
Which would have been different if the loop went the other way.
Certainly possible either way, though.
Thanks,
Nish
--
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center
_______________________________________________
REMINDER: this mailing list moved to vger.kernel.org and current one will be discontinued soon.
To resubscribe, send email to majordomo@vger.kernel.org with
"subscribe kernel-janitors" in message body and follow instructions.
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2007-07-16 17:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-16 14:06 [KJ] [third][PATCH 3/4][2.6 drivers/net/skfp/smt.c:]replace SIZE acripps
2007-07-16 17:06 ` walter harms
2007-07-16 17:24 ` Nishanth Aravamudan [this message]
2007-07-16 17:25 ` Matthew Wilcox
2007-07-16 17:33 ` Cripps
2007-07-16 17:48 ` Matthew Wilcox
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=20070716172431.GJ17929@us.ibm.com \
--to=nacc@us.ibm.com \
--cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.