Hi! > Many an ethernet PHY supports various HW control modes for LEDs > connected directly to the PHY chip. > > This patch adds code for registering such LEDs when described in device > tree and also adds a new private LED trigger called phydev-hw-mode. > When this trigger is enabled for a LED, the various HW control modes > which are supported by the PHY for given LED cat be get/set via hw_mode > sysfs file. > > A PHY driver wishing to utilize this API needs to implement all the > methods in the phy_device_led_ops structure. > > Signed-off-by: Marek Beh??n <marek.behun@xxxxxx> > select MDIO_I2C > > +config PHY_LEDS > + bool > + default y if LEDS_TRIGGERS > + > comment "MII PHY device drivers" > > config AMD_PHY > +/* drivers/net/phy/phy_hw_led_mode.c > + * Stale comment. > + init_data.fwnode = &np->fwnode; > + init_data.devname_mandatory = true; > + snprintf(devicename, sizeof(devicename), "phy%d", phydev->phyindex); > + init_data.devicename = devicename; > + > + ret = phydev->led_ops->led_init(phydev, led, &pdata); > + if (ret < 0) > + goto err_free; > + > + ret = devm_led_classdev_register_ext(&phydev->mdio.dev, &led->cdev, &init_data); > + if (ret < 0) > + goto err_free; > + > + led->flags |= PHY_DEVICE_LED_REGISTERED; > + > + return 0; > +err_free: > + devm_kfree(&phydev->mdio.dev, led); > + return ret; devm should take care of freeing, right? Plus, format comments to 80 colums. checkpatch no longer warns, but rule still exists. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html