Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: michael.hennerich@analog.com
Cc: linux-iio@vger.kernel.org, drivers@analog.com,
	device-drivers-devel@blackfin.uclinux.org
Subject: Re: [PATCH 3/3] staging: iio: dac: Use spi_device_id
Date: Fri, 19 Nov 2010 14:11:51 +0000	[thread overview]
Message-ID: <4CE685A7.5080909@cam.ac.uk> (raw)
In-Reply-To: <1290170090-31015-3-git-send-email-michael.hennerich@analog.com>

On 11/19/10 12:34, michael.hennerich@analog.com wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
> 
> 
Nice clean up.
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
>  drivers/staging/iio/dac/ad5624r_spi.c |   25 +++++++++----------------
>  1 files changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/iio/dac/ad5624r_spi.c b/drivers/staging/iio/dac/ad5624r_spi.c
> index 17588b4..b7c1661 100644
> --- a/drivers/staging/iio/dac/ad5624r_spi.c
> +++ b/drivers/staging/iio/dac/ad5624r_spi.c
> @@ -209,13 +209,8 @@ static const struct attribute_group ad5624r_attribute_group = {
>  
>  static int __devinit ad5624r_probe(struct spi_device *spi)
>  {
> -
>  	struct ad5624r_state *st;
>  	int ret = 0;
> -	char *chip_name = spi->dev.platform_data;
> -
> -	if (!chip_name)
> -		return -ENODEV;
>  
>  	st = kzalloc(sizeof(*st), GFP_KERNEL);
>  	if (st == NULL) {
> @@ -224,17 +219,7 @@ static int __devinit ad5624r_probe(struct spi_device *spi)
>  	}
>  	spi_set_drvdata(spi, st);
>  
> -	if (strcmp(chip_name, "ad5624r") == 0)
> -		st->data_len = 12;
> -	else if (strcmp(chip_name, "ad5644r") == 0)
> -		st->data_len = 14;
> -	else if (strcmp(chip_name, "ad5664r") == 0)
> -		st->data_len = 16;
> -	else {
> -		dev_err(&spi->dev, "not supported chip type\n");
> -		ret = -EINVAL;
> -		goto error_ret;
> -	}
> +	st->data_len = spi_get_device_id(spi)->driver_data;
>  
>  	st->us = spi;
>  	st->indio_dev = iio_allocate_device();
> @@ -278,6 +263,13 @@ static int __devexit ad5624r_remove(struct spi_device *spi)
>  	return 0;
>  }
>  
> +static const struct spi_device_id ad5624r_id[] = {
> +	{"ad5624r", 12},
> +	{"ad5644r", 14},
> +	{"ad5664r", 16},
> +	{}
> +};
> +
>  static struct spi_driver ad5624r_driver = {
>  	.driver = {
>  		.name = "ad5624r",
> @@ -285,6 +277,7 @@ static struct spi_driver ad5624r_driver = {
>  	},
>  	.probe = ad5624r_probe,
>  	.remove = __devexit_p(ad5624r_remove),
> +	.id_table = ad5624r_id,
>  };
>  
>  static __init int ad5624r_spi_init(void)


  reply	other threads:[~2010-11-19 14:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19 12:34 [PATCH 1/3] staging: iio: dac: Update drivers to use new attribute naming michael.hennerich
2010-11-19 12:34 ` [PATCH 2/3] staging: iio: dac: Use spi_write() and handle return value michael.hennerich
2010-11-19 14:11   ` Jonathan Cameron
2010-11-19 12:34 ` [PATCH 3/3] staging: iio: dac: Use spi_device_id michael.hennerich
2010-11-19 14:11   ` Jonathan Cameron [this message]
2010-11-19 14:06 ` [PATCH 1/3] staging: iio: dac: Update drivers to use new attribute naming 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=4CE685A7.5080909@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=drivers@analog.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=michael.hennerich@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox