From: Jonathan Cameron <jic23@kernel.org>
To: Peter Rosin <peda@axentia.se>
Cc: Chris Coffey <cmc@babblebit.net>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Slawomir Stepien <sst@poczta.fm>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH] iio: potentiometer: Add driver for Microchip MCP41xxx/42xxx
Date: Sun, 11 Nov 2018 17:07:08 +0000 [thread overview]
Message-ID: <20181111170708.5dbda253@archlinux> (raw)
In-Reply-To: <1d5f47e8-b69c-e40f-9b4f-7423ee485747@axentia.se>
On Sun, 11 Nov 2018 16:49:28 +0000
Peter Rosin <peda@axentia.se> wrote:
> On 2018-11-11 15:55, Jonathan Cameron wrote:
> > On Tue, 6 Nov 2018 16:37:11 +0000
> > Peter Rosin <peda@axentia.se> wrote:
> >
> >> Hi!
> >>
> >> Some comments inline...
> > A few additions from me.
>
> *snip*
>
> >>> + data = iio_priv(indio_dev);
> >>> + spi_set_drvdata(spi, indio_dev);
> >>> + data->spi = spi;
> >>> + data->cfg = &mcp41010_cfg[devid];
> >>
> >> I'm missing a "of_device_get_match_data(dev)" call somewhere in here, see e.g. the
> >> max5481.c file in this directory. Yes, that's missing from the mcp4131 driver as
> >> well, but that's not a valid reason for not doing it here AFAICT...
> > If you want to use the data elements from the devicetree bindings you'll need
> > to do that. However, there is an odd path that actually means it will fall back
> > to getting the right thing as you have it here.
> > spi_get_device_id calls spi_match_id which compares the sdev->modalias
> > with the id table names. modalias has been carefully constructed
> > to be the text after the comma only and as such this works as is.
> >
> > Perhaps it's neater though to just use the devicetree access functions.
>
> Isn't that part about not looking at the vendor-part of the DT-compatible slightly
> fragile? Or will modalias/chip-number clashes be detected by something?
Yes :)
Well actually in this case not so bad.
It will use a match on the of_device_id to find which driver to probe if there is
one. The modalias part is only being abused to then figure out which device we
have within the driver.
I definitely prefer the explicit route. Just wanted to point out it 'worked'
:)
>
> Cheers,
> Peter
prev parent reply other threads:[~2018-11-11 17:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-06 11:31 [PATCH] iio: potentiometer: Add driver for Microchip MCP41xxx/42xxx Chris Coffey
2018-11-06 15:48 ` Himanshu Jha
2018-11-07 9:05 ` Chris Coffey
2018-11-07 9:48 ` Himanshu Jha
2018-11-11 14:36 ` Jonathan Cameron
2018-11-06 16:37 ` Peter Rosin
2018-11-06 20:08 ` Peter Rosin
2018-11-07 9:25 ` Chris Coffey
2018-11-07 9:18 ` Chris Coffey
2018-11-11 14:55 ` Jonathan Cameron
2018-11-11 16:49 ` Peter Rosin
2018-11-11 17:07 ` Jonathan Cameron [this message]
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=20181111170708.5dbda253@archlinux \
--to=jic23@kernel.org \
--cc=cmc@babblebit.net \
--cc=devicetree@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peda@axentia.se \
--cc=pmeerw@pmeerw.net \
--cc=robh+dt@kernel.org \
--cc=sst@poczta.fm \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).