linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Slawomir Stepien <sst@poczta.fm>
Cc: lars@metafoo.de, knaack.h@gmx.de, pmeerw@pmeerw.net,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: potentiometer mcp4131: use spi_get_device_id() only when needed
Date: Fri, 16 Nov 2018 11:53:35 +0000	[thread overview]
Message-ID: <20181116115335.2d9fa9c5@archlinux> (raw)
In-Reply-To: <20181116094722.1070-3-sst@poczta.fm>

On Fri, 16 Nov 2018 10:47:22 +0100
Slawomir Stepien <sst@poczta.fm> wrote:

> There is no need to find the device id up front, since the
> of_device_get_match_data() might return the correct data.
> 
Ah. That explains it.   This should just have been merged with the previous
patch :)

Anyhow, I'll apply them both but merge them whilst doing so.

So applied as one patch to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

As things currently stand it's not worth going through and doing this for
every driver as I don't think the other path is being removed any
time soon.  It's a worthwhile change if people happen to be doing other
work on a particular driver though!

Thanks,

Jonathan

> Signed-off-by: Slawomir Stepien <sst@poczta.fm>
> ---
>  drivers/iio/potentiometer/mcp4131.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/potentiometer/mcp4131.c b/drivers/iio/potentiometer/mcp4131.c
> index 55f526a59215..efe035ce010d 100644
> --- a/drivers/iio/potentiometer/mcp4131.c
> +++ b/drivers/iio/potentiometer/mcp4131.c
> @@ -244,7 +244,7 @@ static int mcp4131_probe(struct spi_device *spi)
>  {
>  	int err;
>  	struct device *dev = &spi->dev;
> -	unsigned long devid = spi_get_device_id(spi)->driver_data;
> +	unsigned long devid;
>  	struct mcp4131_data *data;
>  	struct iio_dev *indio_dev;
>  
> @@ -256,8 +256,10 @@ static int mcp4131_probe(struct spi_device *spi)
>  	spi_set_drvdata(spi, indio_dev);
>  	data->spi = spi;
>  	data->cfg = of_device_get_match_data(&spi->dev);
> -	if (!data->cfg)
> +	if (!data->cfg) {
> +		devid = spi_get_device_id(spi)->driver_data;
>  		data->cfg = &mcp4131_cfg[devid];
> +	}
>  
>  	mutex_init(&data->lock);
>  

  reply	other threads:[~2018-11-16 22:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16  9:47 [PATCH 0/2] Use OF API to get the driver data Slawomir Stepien
2018-11-16  9:47 ` [PATCH 1/2] iio: potentiometer: mcp4131: use of_device_get_match_data() Slawomir Stepien
2018-11-16 11:49   ` Jonathan Cameron
2018-11-16  9:47 ` [PATCH 2/2] iio: potentiometer mcp4131: use spi_get_device_id() only when needed Slawomir Stepien
2018-11-16 11:53   ` Jonathan Cameron [this message]
2018-11-16 12:19     ` Slawomir Stepien
2018-11-16 11:46 ` [PATCH 0/2] Use OF API to get the driver data Jonathan Cameron
2018-11-16 12:16   ` Slawomir Stepien

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=20181116115335.2d9fa9c5@archlinux \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --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).