[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR18MB26974EE53AF9BC66D9E3F0FEABE30@DM6PR18MB2697.namprd18.prod.outlook.com>
Date: Tue, 25 Jun 2019 18:32:31 +0000
From: Manish Chopra <manishc@...vell.com>
To: Benjamin Poirier <bpoirier@...e.com>,
David Miller <davem@...emloft.net>
CC: GR-Linux-NIC-Dev <GR-Linux-NIC-Dev@...vell.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next 10/16] qlge: Factor out duplicated expression
> -----Original Message-----
> From: netdev-owner@...r.kernel.org <netdev-owner@...r.kernel.org> On
> Behalf Of Benjamin Poirier
> Sent: Monday, June 24, 2019 1:22 PM
> To: David Miller <davem@...emloft.net>
> Cc: Manish Chopra <manishc@...vell.com>; GR-Linux-NIC-Dev <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.
Yes, I think it could be simplified to simple cast just.
Powered by blists - more mailing lists