Messages in this thread | | | Date | Thu, 13 Apr 2023 16:48:21 +0200 | From | Andrew Lunn <> | Subject | Re: [net-next PATCH v6 06/16] net: phy: phy_device: Call into the PHY driver to set LED brightness |
| |
On Thu, Apr 13, 2023 at 06:57:51AM -0700, Florian Fainelli wrote: > > > On 3/27/2023 7:10 AM, Christian Marangi wrote: > > From: Andrew Lunn <andrew@lunn.ch> > > > > Linux LEDs can be software controlled via the brightness file in /sys. > > LED drivers need to implement a brightness_set function which the core > > will call. Implement an intermediary in phy_device, which will call > > into the phy driver if it implements the necessary function. > > > > Signed-off-by: Andrew Lunn <andrew@lunn.ch> > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > > > + int (*led_brightness_set)(struct phy_device *dev, > > + u32 index, enum led_brightness value); > > I think I would have made this an u8, 4 billion LEDs, man, that's a lot!
That can be done. We need to change:
err = of_property_read_u32(led, "reg", &phyled->index); if (err) return err;
to a u8, to avoid overflow problems in other places. It looks like of_property_read_u8() does the correct thing if somebody tried to use 4 billion - 1.
Andrew
| |