[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190624075225.GA27959@f1>
Date: Mon, 24 Jun 2019 16:52:26 +0900
From: Benjamin Poirier <bpoirier@...e.com>
To: David Miller <davem@...emloft.net>
Cc: manishc@...vell.com, GR-Linux-NIC-Dev@...vell.com,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next 10/16] qlge: Factor out duplicated expression
On 2019/06/23 10:59, David Miller wrote:
> From: Benjamin Poirier <bpoirier@...e.com>
> Date: Mon, 17 Jun 2019 16:48:52 +0900
>
> > Signed-off-by: Benjamin Poirier <bpoirier@...e.com>
> > ---
> > drivers/net/ethernet/qlogic/qlge/qlge.h | 6 ++++++
> > drivers/net/ethernet/qlogic/qlge/qlge_main.c | 18 ++++++------------
> > 2 files changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h
> > index 5a4b2520cd2a..0bb7ccdca6a7 100644
> > --- a/drivers/net/ethernet/qlogic/qlge/qlge.h
> > +++ b/drivers/net/ethernet/qlogic/qlge/qlge.h
> > @@ -77,6 +77,12 @@
> > #define LSD(x) ((u32)((u64)(x)))
> > #define MSD(x) ((u32)((((u64)(x)) >> 32)))
> >
> > +#define QLGE_FIT16(value) \
> > +({ \
> > + typeof(value) _value = value; \
> > + (_value) == 65536 ? 0 : (u16)(_value); \
> > +})
> > +
>
> "(u16) 65536" is zero and the range of these values is 0 -- 65536.
>
> This whole expression is way overdone.
Indeed, I missed that a simple cast is enough :/
What I inferred from the presence of that expression though is that in
the places where it is used, the device interprets a value of 0 as
65536. Manish, can you confirm that? As David points out, the expression
is useless. A comment might not be however.
Powered by blists - more mailing lists