I want to add a sysfs attribute to my netdevice driver (phy-driver). So I tried to use the DRIVER_ATTR_RW macro with _show and _stor function. To create the sysfs entry I call the driver_create_file function in my _init function. The driver_create_file function wants a pointer to a device_driver struct but I only have a phy_device struct. So is the creation of a sysfs attribute in a netdevice driver different from a standard device driver?
Edit 1: I found a solution. To get the device_driver pointer you can use phydev->mdio.dev.driver