Re: [PATCH net-next 1/2] net: phy: motorcomm: Add support for PHY LEDs on YT8521
From: Russell King (Oracle)
Date: Mon Aug 11 2025 - 11:07:31 EST
On Thu, Aug 07, 2025 at 11:50:06AM +0200, Heiko Stübner wrote:
> > +static int yt8521_led_hw_control_get(struct phy_device *phydev, u8 index,
> > + unsigned long *rules)
> > +{
> > + int val;
> > +
> > + if (index >= YT8521_MAX_LEDS)
> > + return -EINVAL;
> > +
> > + val = ytphy_read_ext(phydev, YT8521_LED0_CFG_REG + index);
> > + if (val < 0)
> > + return val;
> > +
> > + if (val & YT8521_LED_TXACT_BLK_EN)
> > + set_bit(TRIGGER_NETDEV_TX, rules);
> > +
> > + if (val & YT8521_LED_RXACT_BLK_EN)
> > + set_bit(TRIGGER_NETDEV_RX, rules);
> > +
> > + if (val & YT8521_LED_FDX_ON_EN)
> > + set_bit(TRIGGER_NETDEV_FULL_DUPLEX, rules);
> > +
> > + if (val & YT8521_LED_HDX_ON_EN)
> > + set_bit(TRIGGER_NETDEV_HALF_DUPLEX, rules);
> > +
> > + if (val & YT8521_LED_GT_ON_EN)
> > + set_bit(TRIGGER_NETDEV_LINK_1000, rules);
> > +
> > + if (val & YT8521_LED_HT_ON_EN)
> > + set_bit(TRIGGER_NETDEV_LINK_100, rules);
> > +
> > + if (val & YT8521_LED_BT_ON_EN)
> > + set_bit(TRIGGER_NETDEV_LINK_10, rules);
Sorry, I don't have the original to hand.
Please use __set_bit() where the more expensive atomic operation that
set_bit() gives is not necessary.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!