netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Heiner Kallweit <hkallweit1@gmail.com>
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:27:50 +0100	[thread overview]
Message-ID: <20190208182750.GH1853@lunn.ch> (raw)
In-Reply-To: <467d5d6b-86d9-2f81-836c-52e17f28bc6c@gmail.com>

> >> -	*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

  reply	other threads:[~2019-02-08 18:27 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 [this message]
2019-02-08 18:34       ` Heiner Kallweit

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=20190208182750.GH1853@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@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).