* [PATCH RFC] net/phy: fix Marvell PHYs probe failure when HWMON and THERMAL_OF are enabled
@ 2019-09-18 21:38 Peter Mamonov
2019-09-19 2:50 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Peter Mamonov @ 2019-09-18 21:38 UTC (permalink / raw)
To: andrew, f.fainelli, hkallweit1; +Cc: netdev, Peter Mamonov
Hello,
Some time ago I've discovered that probe functions of certain Marvell PHYs
fail if both HWMON and THERMAL_OF config options are enabled. The root
cause of this problem is a lack of an OF node for a PHY's built-in
temperature sensor. However I consider adding this OF node to be a bit
excessive solution. Am I wrong? Below you will find a one line patch which
fixes the problem. I've sent it to the releveant maintainers three weeks
ago without any feedback yet. Could you, please, take a look at the problem
and give your considerations on how to fix it properly?
Regards,
Peter
thermal: make thermal_zone_of_sensor_register return -ENODEV
if a sensor OF node is missing
When devm_thermal_zone_of_sensor_register() is called from
hwmon_thermal_add_sensor() it is possible that the relevant sensor is
missing an OF node. In this case thermal_zone_of_sensor_register() returns
-EINVAL which causes hwmon_thermal_add_sensor() to fail as well. This patch
changes relevant return code of thermal_zone_of_sensor_register() to
-ENODEV, which is tolerated by hwmon_thermal_add_sensor().
Here is a particular case of such behaviour: the Marvell ethernet PHYs
driver registers hwmon device for the built-in temperature sensor (see
drivers/net/phy/marvell.c). Since the sensor doesn't have associated OF
node devm_hwmon_device_register() returns error which ultimately causes
failure of the PHY driver's probe function.
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
---
drivers/thermal/of-thermal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index dc5093be553e..34b0cc173f4a 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -493,7 +493,7 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data,
if (!dev || !dev->of_node) {
of_node_put(np);
- return ERR_PTR(-EINVAL);
+ return ERR_PTR(-ENODEV);
}
sensor_np = of_node_get(dev->of_node);
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] net/phy: fix Marvell PHYs probe failure when HWMON and THERMAL_OF are enabled
2019-09-18 21:38 [PATCH RFC] net/phy: fix Marvell PHYs probe failure when HWMON and THERMAL_OF are enabled Peter Mamonov
@ 2019-09-19 2:50 ` Andrew Lunn
2019-09-19 8:10 ` Peter Mamonov
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2019-09-19 2:50 UTC (permalink / raw)
To: Peter Mamonov; +Cc: f.fainelli, hkallweit1, netdev
On Thu, Sep 19, 2019 at 12:38:37AM +0300, Peter Mamonov wrote:
> Hello,
>
> Some time ago I've discovered that probe functions of certain Marvell PHYs
> fail if both HWMON and THERMAL_OF config options are enabled.
Hi Peter
It probably affects more then Marvell PHYs.
> The root
> cause of this problem is a lack of an OF node for a PHY's built-in
> temperature sensor. However I consider adding this OF node to be a bit
> excessive solution. Am I wrong? Below you will find a one line patch which
> fixes the problem.
Your patch look sensible to me.
> I've sent it to the releveant maintainers three weeks
> ago without any feedback yet.
Could you point me at the relevant mailing list archive?
Thanks
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] net/phy: fix Marvell PHYs probe failure when HWMON and THERMAL_OF are enabled
2019-09-19 2:50 ` Andrew Lunn
@ 2019-09-19 8:10 ` Peter Mamonov
2019-09-19 13:52 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Peter Mamonov @ 2019-09-19 8:10 UTC (permalink / raw)
To: Andrew Lunn; +Cc: f.fainelli, hkallweit1, netdev
Hi, Andrew,
On Thu, Sep 19, 2019 at 04:50:16AM +0200, Andrew Lunn wrote:
> On Thu, Sep 19, 2019 at 12:38:37AM +0300, Peter Mamonov wrote:
> > Hello,
> >
> > Some time ago I've discovered that probe functions of certain Marvell PHYs
> > fail if both HWMON and THERMAL_OF config options are enabled.
>
> Hi Peter
>
> It probably affects more then Marvell PHYs.
>
> > The root
> > cause of this problem is a lack of an OF node for a PHY's built-in
> > temperature sensor. However I consider adding this OF node to be a bit
> > excessive solution. Am I wrong? Below you will find a one line patch which
> > fixes the problem.
>
> Your patch look sensible to me.
>
> > I've sent it to the releveant maintainers three weeks
> > ago without any feedback yet.
>
> Could you point me at the relevant mailing list archive?
Here it is: https://marc.info/?l=linux-pm&m=156691695616377&w=2
Regards,
Peter
>
> Thanks
> Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] net/phy: fix Marvell PHYs probe failure when HWMON and THERMAL_OF are enabled
2019-09-19 8:10 ` Peter Mamonov
@ 2019-09-19 13:52 ` Andrew Lunn
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2019-09-19 13:52 UTC (permalink / raw)
To: Peter Mamonov; +Cc: f.fainelli, hkallweit1, netdev
On Thu, Sep 19, 2019 at 11:10:56AM +0300, Peter Mamonov wrote:
> Hi, Andrew,
>
> On Thu, Sep 19, 2019 at 04:50:16AM +0200, Andrew Lunn wrote:
> > On Thu, Sep 19, 2019 at 12:38:37AM +0300, Peter Mamonov wrote:
> > > Hello,
> > >
> > > Some time ago I've discovered that probe functions of certain Marvell PHYs
> > > fail if both HWMON and THERMAL_OF config options are enabled.
> >
> > Hi Peter
> >
> > It probably affects more then Marvell PHYs.
> >
> > > The root
> > > cause of this problem is a lack of an OF node for a PHY's built-in
> > > temperature sensor. However I consider adding this OF node to be a bit
> > > excessive solution. Am I wrong? Below you will find a one line patch which
> > > fixes the problem.
> >
> > Your patch look sensible to me.
> >
> > > I've sent it to the releveant maintainers three weeks
> > > ago without any feedback yet.
> >
> > Could you point me at the relevant mailing list archive?
>
> Here it is: https://marc.info/?l=linux-pm&m=156691695616377&w=2
Hi Peter
O.K. Thanks.
We should not take this patch via netdev, since it is outside of
netdev, even if it does break netdev. So lets polish the patch a bit,
and then repost it to linux-pm and its maintainers.
Please could you add a Fixes: tag. Can you figure out which commit
broke it, or has it always been broken?
Add a stable: tag, indicating it needs to be back ported. For netdev,
you would not do this, but for linux-pm, i guess it is needed.
Change the subject a little. thermal: Fix broken registration if sensor OF node missing.
Add
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
When you post it, please Cc: me, netdev, davem, but make the To: the
three thermal maintainers.
Thanks
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-19 13:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 21:38 [PATCH RFC] net/phy: fix Marvell PHYs probe failure when HWMON and THERMAL_OF are enabled Peter Mamonov
2019-09-19 2:50 ` Andrew Lunn
2019-09-19 8:10 ` Peter Mamonov
2019-09-19 13:52 ` Andrew Lunn
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).