> > @@ -736,6 +777,16 @@ struct phy_driver {
> >     int (*set_loopback)(struct phy_device *dev, bool enable);
> >     int (*get_sqi)(struct phy_device *dev);
> >     int (*get_sqi_max)(struct phy_device *dev);
> > +
> > +   /* PHY LED support */
> > +   int (*led_init)(struct phy_device *dev, struct
> > phy_device_led *led);
> > +   int (*led_brightness_set)(struct phy_device *dev, struct
> > phy_device_led *led,
> > +                             enum led_brightness brightness);
> > +   const char *(*led_iter_hw_mode)(struct phy_device *dev,
> > struct phy_device_led *led,
> > +                                   void ** iter);
> > +   int (*led_set_hw_mode)(struct phy_device *dev, struct
> > phy_device_led *led,
> > +                          const char *mode);
> > +   const char *(*led_get_hw_mode)(struct phy_device *dev,
> > struct phy_device_led *led); };
> >  #define to_phy_driver(d)
> > container_of(to_mdio_common_driver(d),              \ struct
> > phy_driver, mdiodrv)
> 
> The problem here is that the same code will have to be added to DSA
> switch ops structure, which is not OK.

Not necessarily. DSA drivers do have access to the phydev structure.

I think putting these members into a structure is a good idea. That
structure can be part of phy_driver and initialised just like other
members. But on probing the phy, it can be copied over to the
phy_device structure. And we can provide an API which DSA drivers can
use to register there own structure of ops to be placed into
phy_device, which would call into the DSA driver.

      Andrew

Reply via email to