Re: [PATCH 3/8] staging:iio:dac:ad5446: Do not check for individual chip ids in probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/23/2012 06:51 PM, Lars-Peter Clausen wrote:
> Use the chip_info's int_vref_mv field to decide whether a certain chip has a
> internal reference or not. There is no need to check for individual chip ids.
> 
That does indeed do the job.
> Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
Acked-by: Jonathan Cameron <jic23@xxxxxxxxxx>
> ---
>  drivers/staging/iio/dac/ad5446.c |   20 +++++---------------
>  1 file changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c
> index 0cfe445..9d9a452 100644
> --- a/drivers/staging/iio/dac/ad5446.c
> +++ b/drivers/staging/iio/dac/ad5446.c
> @@ -355,22 +355,12 @@ static int __devinit ad5446_probe(struct spi_device *spi)
>  	spi_message_init(&st->msg);
>  	spi_message_add_tail(&st->xfer, &st->msg);
>  
> -	switch (spi_get_device_id(spi)->driver_data) {
> -	case ID_AD5620_2500:
> -	case ID_AD5620_1250:
> -	case ID_AD5640_2500:
> -	case ID_AD5640_1250:
> -	case ID_AD5660_2500:
> -	case ID_AD5660_1250:
> +	if (st->chip_info->int_vref_mv)
>  		st->vref_mv = st->chip_info->int_vref_mv;
> -		break;
> -	default:
> -		if (voltage_uv)
> -			st->vref_mv = voltage_uv / 1000;
> -		else
> -			dev_warn(&spi->dev,
> -				 "reference voltage unspecified\n");
> -	}
> +	else if (voltage_uv)
> +		st->vref_mv = voltage_uv / 1000;
> +	else
> +		dev_warn(&spi->dev, "reference voltage unspecified\n");
>  
>  	ret = iio_device_register(indio_dev);
>  	if (ret)

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux