On 19/06/16 19:04, Linus Walleij wrote: > On Sun, Jun 19, 2016 at 1:25 PM, Jonathan Cameron <jic23@xxxxxxxxxx> wrote: > >>>> Using the struct i2c_device->id field for naming the light sensor >>>> is a bad idea: when booting from the pure device tree this is NULL > >> Hmm. Just revisiting this whilst reviewing another driver. What the heck >> is the 'right' way of getting hold of the registered name in this case? >> I guess getting it from an of lookup if one has been used? >> So of_device_match and then the name field? > > Good question. > > Some code like drivers/iio/magnetometer/ak8975.c uses this: > dev_name(&client->dev) > > Which will give a silly bus name like this (from /proc/interrupts): > > 234: 0 0 pm8xxx 224 Edge 0-000c > > "0-000c" (device 0x0c on i2c bus 0) > > It will be unique but not very human readable. The name field was always really intended to just be the part number. There are lots of other ways of finding out 'where' it is. Jonathan > > Yours, > Linus Walleij > -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html