>> Thanks for the suggestion, I'll investigate. >> On my current system I however see it is named correctly after interface >> rename, >> like 'enp1s0-pci-0100'. > > Interesting. > > So you register the hwmon device after registering the netdev. So it > could be on your system that systemd has already renamed the interface > by the time you register the hwmon device. But i don't think there is > any guarantee about this. > > You could also try > > ip link set enp1s0-pci-0100 name eth42 > > to illustrate the point.
Did some investigation, and the interesting point is that hwmon device stores a pointer to the passed name string. This means passing the `ndev->name` makes hwmon always refer actual netdev name. And consequently interface renaming gets correctly propagated to hwmon device. I did a quick check for possible side effects but see it works as expected this way. Some other devices also use this strategy with hwmon. Regards, Igor