[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190208182750.GH1853@lunn.ch>
Date: Fri, 8 Feb 2019 19:27:50 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Heiner Kallweit <hkallweit1@...il.com>
Cc: Florian Fainelli <f.fainelli@...il.com>,
David Miller <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net: phy: disregard "Clause 22 registers
present" bit in get_phy_c45_devs_in_pkg
> >> - *devices_in_package |= (phy_reg & 0xffff);
> >> + /* Bit 0 doesn't represent a device, it indicates c22 regs presence */
> >> + *devices_in_package |= (phy_reg & 0xfffe);
> >
> > Hi Heiner
> >
> > Just for readability, can we use BIT(0) in there somehow?
> >
> You think 0xfffe together with the comment is still not clear enough?
Hi Heiner
It is more i was wondering why the 0xffff was there in the first
place. PHY registers are 16 bits. Is this because of a compiler
warning? If the use of 0xffff is not obvious, why would 0xfffe be any
better.
> >> /* Device present registers. */
> >> #define MDIO_DEVS_PRESENT(devad) (1 << (devad))
> >> +#define MDIO_DEVS_C22PRESENT MDIO_DEVS_PRESENT(0)
> >
> > Err. The commit message says you did not add this...
> >
> Maybe I'm not clear enough in the commit message. Typically we have two
> constants for a device:
>
> MDIO_MMD_XXX (for the device)
> MDIO_DEVS_XXX (for the bit of the device in the device list bitmap)
>
> For the C22PRESENT flag I don't define the first one (because it's
> not a device) but the second one (because it uses a bit in the device
> list bitmap).
This would be better as a separate patch. It is not used here, and the
explanation can then be made clearer.
Andrew
Powered by blists - more mailing lists