netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] net: phy: marvell: mv88e6390 temperature sensor reading
Date: Wed, 10 Jan 2018 14:52:24 +0100	[thread overview]
Message-ID: <20180110135224.GA32117@lunn.ch> (raw)
In-Reply-To: <4033cdd4-36ae-060d-57f3-f8def0598024@gmail.com>

On Tue, Jan 09, 2018 at 04:14:44PM -0800, Florian Fainelli wrote:
> On 01/09/2018 01:42 PM, Andrew Lunn wrote:
> > The internal PHYs in the mv88e6390 switch have a temperature sensor.
> > It uses a different register layout to other PHY currently supported.
> > It also has an errata, in that some reads of the sensor result in bad
> > values. So a number of reads need to be made, and the average taken.
> > 
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> 
> Just a few nits below:
> 
> [snip]
> 
> > +static int m88e6390_hwmon_read(struct device *dev,
> > +			       enum hwmon_sensor_types type,
> > +			       u32 attr, int channel, long *temp)
> > +{
> > +	struct phy_device *phydev = dev_get_drvdata(dev);
> 
> Why not to_phy_device()?

Hi Florian

The marvell driver already supports two other temperature
sensors. While implementing this third, i just copy/pasted the
m88e1121 code, and then applied changes as needed for the 6390.
dev_get_drvdata() is what the other two use.

> [snip]
> 
> > +
> > +static int m88e6390_hwmon_probe(struct phy_device *phydev)
> > +{
> > +	return marvell_hwmon_probe(phydev, &m88e6390_hwmon_chip_info);
> > +}
> >  #else
> >  static int m88e1121_hwmon_probe(struct phy_device *phydev)
> >  {
> > @@ -1794,6 +1927,11 @@ static int m88e1510_hwmon_probe(struct phy_device *phydev)
> >  {
> >  	return 0;
> >  }
> > +
> > +static int m88e6390_hwmon_probe(struct phy_device *phydev)
> > +{
> > +	return 0;
> > +}
> 
> Instead of having to define m88e6390_hwmon_probe() twice, I would just
> make marvell_hwmon_probe() a stub when CONFIG_HWMON=n?

Yes, i could do that. But again, i'm just following the pattern from
the other two sensors.

So in order to make these change requests, i will add another two
patches to the series, which first changes the existing two temperature
sensors. Then add the 6390.

	 Andrew

  reply	other threads:[~2018-01-10 13:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 21:42 [PATCH net-next] net: phy: marvell: mv88e6390 temperature sensor reading Andrew Lunn
2018-01-10  0:14 ` Florian Fainelli
2018-01-10 13:52   ` Andrew Lunn [this message]
2018-01-10 14:05     ` Andrew Lunn
2018-01-10 17:49       ` Florian Fainelli
2018-01-10 20:35 ` David Miller

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=20180110135224.GA32117@lunn.ch \
    --to=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).