Devicetree
 help / color / mirror / Atom feed
From: Chris Coffey <cmc@babblebit.net>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Slawomir Stepien <sst@poczta.fm>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Peter Rosin <peda@axentia.se>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: potentiometer: Add driver for Microchip MCP41xxx/42xxx
Date: Sat, 17 Nov 2018 20:31:30 +0000	[thread overview]
Message-ID: <20181117203130.efhp4amahjx3qxwo@deb-660> (raw)
In-Reply-To: <20181116181043.7a8d48dc@archlinux>

On Fri, Nov 16, 2018 at 06:10:43PM +0000, Jonathan Cameron wrote:
> On Wed, 14 Nov 2018 11:30:15 +0100
> Slawomir Stepien <sst@poczta.fm> wrote:
> 
> > On lis 14, 2018 09:52, Chris Coffey wrote:
> > > This patch adds driver support for the Microchip MCP41xxx/42xxx family
> > > of digital potentiometers:
> > > 
> > > DEVICE      Wipers  Positions   Resistance (kOhm)
> > > MCP41010    1       256         10
> > > MCP41050    1       256         50
> > > MCP41100    1       256         100
> > > MCP42010    2       256         10
> > > MCP42050    2       256         50
> > > MCP42100    2       256         100
> > > 
> > > Datasheet: http://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf  
> > 
> > Hi
> > 
> > Some hints inline.
> A few minor comments from me.
> 
> Thanks,
> 
> Jonathan
> 

Thank you for the review; I have one question below.

Thanks,
Chris

[snip]

> > > +static int mcp41010_probe(struct spi_device *spi)
> > > +{
> > > +	int err;
> > > +	struct device *dev = &spi->dev;
> > > +	unsigned long devid = spi_get_device_id(spi)->driver_data;  
> > 
> > I guess the calculation of devid value can now be done only when
> > of_device_get_match_data() did not return config.
> > 
> > > +	struct mcp41010_data *data;
> > > +	struct iio_dev *indio_dev;
> > > +
> > > +	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> > > +	if (!indio_dev)
> > > +		return -ENOMEM;
> > > +
> > > +	data = iio_priv(indio_dev);
> > > +	spi_set_drvdata(spi, indio_dev);
> > > +	data->spi = spi;
> > > +	data->cfg = of_device_get_match_data(&spi->dev);
> > > +	if (!data->cfg)
> > > +		data->cfg = &mcp41010_cfg[devid];
> > > +
> > > +	mutex_init(&data->lock);
> > > +
> > > +	indio_dev->dev.parent = dev;
> > > +	indio_dev->info = &mcp41010_info;
> > > +	indio_dev->channels = mcp41010_channels;
> > > +	indio_dev->num_channels = data->cfg->wipers;
> > > +	indio_dev->name = spi_get_device_id(spi)->name;
> 
> It is a bit odd to use the of match for the data, but
> then get the name always from the spi_device_id table.
> We probably need a separate source for the names such
> as in the config structure.
> 

I see what you mean. Is this something you'd like me to do for v3 (add
the names to the config struct), or were you thinking more in the
abstract, "this is something we should consider doing in the future"?

[snip]

  reply	other threads:[~2018-11-17 20:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14  9:52 [PATCH v2 0/2] Add support for Microchip MCP41xxx/42xxx potentiometers Chris Coffey
2018-11-14  9:52 ` [PATCH v2 1/2] dt-bindings: iio: potentiometer: Add Microchip MCP41xxx/42xxx Chris Coffey
2018-11-14 10:01   ` Slawomir Stepien
2018-11-16 18:02     ` Jonathan Cameron
2018-11-17 20:25     ` Chris Coffey
2018-11-14  9:52 ` [PATCH v2 2/2] iio: potentiometer: Add driver for " Chris Coffey
2018-11-14 10:30   ` Slawomir Stepien
2018-11-16 18:10     ` Jonathan Cameron
2018-11-17 20:31       ` Chris Coffey [this message]
2018-11-19 13:48         ` Jonathan Cameron

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=20181117203130.efhp4amahjx3qxwo@deb-660 \
    --to=cmc@babblebit.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@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