On Friday 30 October 2015 15:43:18 Linus Walleij wrote: > On Sat, Oct 24, 2015 at 8:42 PM, Markus Pargmann <mpa@xxxxxxxxxxxxxx> wrote: > > > What happens if we have two I2C gpio expanders with the same I2C > > addresses connected to different I2C busses? If I see this correctly > > they would both show up with the same name. Is there an easy and > > race-free way to see which GPIO chip is connected to which I2C bus? > > My spontaneous question is: how does ethernet interfaces or whatever > handle this nowadays to get unique device names? > > Currently we are probe-order dependent. It would be good to fix > the plug-order business from day 1 but how? ethernet devices are in their own namespace but can get renamed according to distro-specific policy. A common method is to keep a record of all mac addresses that were seen in a file in /etc (e.g. /etc/udev/rules.d/70-persistent-net.rules) and rename them to whatever they were previously known as when they show up with a different name. For character devices, udev has a complex set of (user-overridable) rules to derive one or more stable name(s) from the sysfs attributes. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html