All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Rob Herring <robh@kernel.org>
Cc: linux-iio@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sascha Weisenberger <sascha.weisenberger@siemens.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: Re: [PATCH v2] iio: adc: Add support for TI ADC1x8s102
Date: Wed, 3 May 2017 10:24:10 +0200	[thread overview]
Message-ID: <395643b8-c5cc-6a50-f424-98b4c5ec339b@siemens.com> (raw)
In-Reply-To: <CAHp75VeyQ=uU=X3DxcNtVKDqkQV=9wK42nDaxs4ztDBU5iKTRw@mail.gmail.com>

On 2017-05-03 10:06, Andy Shevchenko wrote:
> On Wed, May 3, 2017 at 8:35 AM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> On 2017-05-02 22:53, Andy Shevchenko wrote:
>>> On Tue, May 2, 2017 at 11:02 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>>> +static int adc108s102_probe(struct spi_device *spi)
>>>> +{
>>>> +       struct adc108s102_state *st;
>>>> +       struct iio_dev *indio_dev;
>>>> +       u32 val;
>>>> +       int ret;
>>>> +
>>>> +       indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
>>>> +       if (!indio_dev)
>>>> +               return -ENOMEM;
>>>> +
>>>> +       st = iio_priv(indio_dev);
>>>> +
>>>
>>>> +       ret = device_property_read_u32(&spi->dev, "ext-vin-microvolt", &val);
>>>
>>> Why not to read u16 here?
>>>
>>
>> Can I read a property with arbitrary width? Then this would simplify
>> things.
> 
> device_property_read_u16();

By now I found out that ACPI does not care about the property type
width, only DT does. So reading it as u16 under ACPI would be fine. But
with DT, we will need a correctly sized property as well - default is u32.

> 
>> Or do I have to follow how it was defined in the ACPI or device
>> tree world?
> 
> For property by the way you have to either follow existing one (by
> name and meaning), or you
> you need get an Ack from DT people (Rob, for example) to introduce such.
> 
> Existing one is called "vref-external". So, definitely you need to
> figure out this with DT people.

Good point... @Rob, @Jonathon, to avoid a different naming between the
now to be introduced ACPI usage and a potential DT binding later on,
really better define a DT one now? Which name to use for such an
external vref, the one above used by spear-adc already?

>>>> +static struct spi_driver adc108s102_driver = {
>>>> +       .driver = {
>>>> +               .name   = "adc108s102",
>>>
>>>> +               .owner  = THIS_MODULE,
>>>
>>> This is redundant I'm pretty sure.
>>
>> Even in 2017, drivers keep being added that carry such assignments. Can
>> you explain when it is needed and when not? Otherwise, I will leave it in.
> 
> The above I'm 100% sure is not needed. It's needed only in cases when
> framework / device core doesn't do this for ya.
> 
> In the above case IIRC device core does it once for all.
> 

Then this is not consistently filtered out in new driver reviews. I can
remove it, of course.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2017-05-03  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 20:02 [PATCH v2] iio: adc: Add support for TI ADC1x8s102 Jan Kiszka
2017-05-02 20:53 ` Andy Shevchenko
2017-05-03  5:35   ` Jan Kiszka
2017-05-03  8:06     ` Andy Shevchenko
2017-05-03  8:24       ` Jan Kiszka [this message]
2017-05-03  8:43         ` Andy Shevchenko
2017-05-03  8:49           ` Lars-Peter Clausen
2017-05-03 17:11           ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=395643b8-c5cc-6a50-f424-98b4c5ec339b@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh@kernel.org \
    --cc=sascha.weisenberger@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.