Re: [PATCH 2/2] iio: light: bh1780: assign a static name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29/05/16 19:53, Jonathan Cameron wrote:
> On 25/05/16 08:40, Linus Walleij 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
>> and that causes the device not to have the "name" property in
>> sysfs and that in turn confuses the "lsiio" command to stop listing
>> devices.
>>
>> So instead of using the device .id, use the hard string "bh1780",
>> which works just fine.
>>
>> Fixes: 1f0477f18306 ("iio: light: new driver for the ROHM BH1780")
>> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Applied to the fixes-togreg-post-rc1 and marked for stable.
> Thanks,
> 
> Jonathan

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?


Anyhow, would just like to get the right answer in my head for future
reviews.  The fixed value here is fine if the driver only supports
one part.

Thanks,

Jonathan

>> ---
>>  drivers/iio/light/bh1780.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c
>> index 5fd432df2c8f..b54dcba05a82 100644
>> --- a/drivers/iio/light/bh1780.c
>> +++ b/drivers/iio/light/bh1780.c
>> @@ -187,7 +187,7 @@ static int bh1780_probe(struct i2c_client *client,
>>  
>>  	indio_dev->dev.parent = &client->dev;
>>  	indio_dev->info = &bh1780_info;
>> -	indio_dev->name = id->name;
>> +	indio_dev->name = "bh1780";
>>  	indio_dev->channels = bh1780_channels;
>>  	indio_dev->num_channels = ARRAY_SIZE(bh1780_channels);
>>  	indio_dev->modes = INDIO_DIRECT_MODE;
>>
> 
> --
> 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
> 

--
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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux