Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1386896

Re: [PATCH] iio: tmp006: Set correct iio name

From Jonathan Cameron <jic23@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] iio: tmp006: Set correct iio name
Date 2016-04-25 23:20 +0200
Message-ID <rrW5b-44b-7@gated-at.bofh.it> (permalink)
References <rqAgp-3AA-1@gated-at.bofh.it> <rrUwq-2Mp-35@gated-at.bofh.it> <rrVVx-3ZH-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 25/04/16 21:59, Crestez Dan Leonard wrote:
> On 04/25/2016 10:33 PM, Jonathan Cameron wrote:
>> On 22/04/16 04:43, Yong Li wrote:
>>> When load the driver using the below command:
>>> echo tmp006 0x40 > /sys/bus/i2c/devices/i2c-0/new_device
>>>
>>> In sysfs, the i2c name is tmp006, however the iio name is 0-0040,
>>> they are inconsistent. With this patch,
>>> the iio name will be the same as the i2c device name
>>>
>>> Signed-off-by: Yong Li <sdliyong@gmail.com>
>> Peter, this looks right to me, but could you take a quick look as I guess
>> there might be a reason you did this in an unusual way originally?
>>
> Is there a "correct" or "usual" way to set indio_dev->name? Some quick grepping shows no clear standard:
> 
> $ git grep -h 'indio_dev->name =' drivers/iio/ | wc -l
> 148
> $ git grep -h 'indio_dev->name =' drivers/iio/ | grep id | wc -l
> 52
> $ git grep -h 'indio_dev->name =' drivers/iio/ | grep dev_name | wc -l
> 20
> $ git grep -h 'indio_dev->name =' drivers/iio/ | grep -i drv | wc -l
> 19
> $ git grep -h 'indio_dev->name =' drivers/iio/ | grep -i driver | wc -l
> 15
> 
> It seems that many devices use dev_name(&i2c_client->dev) or
> otherwise some sort of "ABC123_DRIVER_NAME" constant.
> 
> It's also not clear what this "name" field is for. Is it more than
> just a cosmetic sysfs attribute? It seems to me that names don't have
> to be unique so it would be wrong to use them for identification.
> 
It's a convenience field really as there is no clear standard for where else
to find out what a part actually is (i.e. if it is an i2c part you can look
in the name attribute i2c supplies - but otherwise you are on your own).

For i2c drivers it should typically be the id->name.  Which is what this
patch changes it to for this part.

The constant case should only be used for drivers that only support one
part (which is quite a few of them!)

Jonathan

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] iio: tmp006: Set correct iio name Yong Li <sdliyong@gmail.com> - 2016-04-22 05:50 +0200
  Re: [PATCH] iio: tmp006: Set correct iio name Jonathan Cameron <jic23@kernel.org> - 2016-04-25 21:40 +0200
    Re: [PATCH] iio: tmp006: Set correct iio name Crestez Dan Leonard <cdleonard@gmail.com> - 2016-04-25 23:10 +0200
      Re: [PATCH] iio: tmp006: Set correct iio name Jonathan Cameron <jic23@kernel.org> - 2016-04-25 23:20 +0200
        Re: [PATCH] iio: tmp006: Set correct iio name Lars-Peter Clausen <lars@metafoo.de> - 2016-04-26 13:00 +0200
          Re: [PATCH] iio: tmp006: Set correct iio name Yong Li <sdliyong@gmail.com> - 2016-04-26 13:50 +0200
            Re: [PATCH] iio: tmp006: Set correct iio name Lars-Peter Clausen <lars@metafoo.de> - 2016-04-26 14:10 +0200
              Re: [PATCH] iio: tmp006: Set correct iio name Yong Li <sdliyong@gmail.com> - 2016-04-26 15:20 +0200
                Re: [PATCH] iio: tmp006: Set correct iio name Daniel Baluta <daniel.baluta@gmail.com> - 2016-04-26 17:30 +0200
                Re: [PATCH] iio: tmp006: Set correct iio name Yong Li <sdliyong@gmail.com> - 2016-04-27 05:50 +0200
                Re: [PATCH] iio: tmp006: Set correct iio name Crestez Dan Leonard <leonard.crestez@intel.com> - 2016-04-27 19:00 +0200
                Re: [PATCH] iio: tmp006: Set correct iio name Lars-Peter Clausen <lars@metafoo.de> - 2016-04-28 10:30 +0200

csiph-web