From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
David Miller <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg
Date: Fri, 8 Feb 2019 19:34:21 +0100 [thread overview]
Message-ID: <bcb3b591-c759-2f5e-762b-ea0485e95758@gmail.com> (raw)
In-Reply-To: <20190208182750.GH1853@lunn.ch>
On 08.02.2019 19:27, Andrew Lunn wrote:
>>>> - *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.
>
I think there are more places where this masking is used, most likely
to make clearer that we care about the lower 16 bits of the int only.
And I also wondered when seeing such code whether it's technically
needed.
>>>> /* 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.
>
OK. Definition of this constant is more meant as a favor to developers
who may want to check this flag in the future.
> Andrew
>
Heiner
prev parent reply other threads:[~2019-02-08 18:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-08 7:12 [PATCH net-next] net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg Heiner Kallweit
2019-02-08 14:02 ` Andrew Lunn
2019-02-08 18:16 ` Heiner Kallweit
2019-02-08 18:27 ` Andrew Lunn
2019-02-08 18:34 ` Heiner Kallweit [this message]
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=bcb3b591-c759-2f5e-762b-ea0485e95758@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).