netdev
[Top] [All Lists]

Re: [PATCH 3/3] r8169: clean up

To: Francois Romieu <romieu@xxxxxxxxxxxxx>
Subject: Re: [PATCH 3/3] r8169: clean up
From: Jon Mason <jdmason@xxxxxxxxxx>
Date: Tue, 2 Nov 2004 13:47:39 -0600
Cc: netdev@xxxxxxxxxxx, jgarzik@xxxxxxxxx
In-reply-to: <20041102192746.GB24860@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Organization: IBM
References: <200411021203.25100.jdmason@xxxxxxxxxx> <20041102192746.GB24860@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: KMail/1.6.2
On Tuesday 02 November 2004 01:27 pm, Francois Romieu wrote:
> Jon Mason <jdmason@xxxxxxxxxx> :
> > Removal of some magic numbers, unnecessary double not, and addition of
> > "link down" notification.
> >
> > Signed-off-by: Jon Mason <jdmason@xxxxxxxxxx>
> >
> > --- r8169.c     2004-11-02 10:37:31.035203120 -0600
> > +++ r8169.c.latest      2004-11-02 10:44:01.367863536 -0600
>
> [...]
>
> > @@ -773,7 +775,7 @@ static void rtl8169_gset_tbi(struct net_
> >
> >         status = RTL_R32(TBICSR);
> >         cmd->advertising = (status & TBINwEnable) ?  ADVERTISED_Autoneg :
> > 0; -       cmd->autoneg = !!(status & TBINwEnable);
> > +       cmd->autoneg = status & TBINwEnable;
> >
> >         cmd->speed = SPEED_1000;
> >         cmd->duplex = DUPLEX_FULL; /* Always set */
>
> drivers/net/*.c use 0/1 or AUTONEG_{EN/DIS}ABLE.

Silly question, does "!!" not execute a bitwise not twice?  If not, then 
please forgive my ignorance.

If so, then it is unnecessary.  But if you want something prettier, how about:

 cmd->autoneg = (status & TBINwEnable) ? AUTONEG_ENABLE : AUTONEG_DISABLE;

-- 
Jon Mason
jdmason@xxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>