Re: [PATCH v4 10/10] drivers: iio: imu: Add support for adis1657x family

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

 



> > @@ -1500,7 +1973,10 @@ static int adis16475_probe(struct spi_device *spi)
> >  	indio_dev->name = st->info->name;
> >  	indio_dev->channels = st->info->channels;
> >  	indio_dev->num_channels = st->info->num_channels;
> > -	indio_dev->info = &adis16475_info;
> > +	if (st->adis.data->has_fifo)
> > +		indio_dev->info = &adis16575_info;
> > +	else
> > +		indio_dev->info = &adis16475_info;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > 
> >  	ret = __adis_initial_startup(&st->adis);
> > @@ -1515,10 +1991,25 @@ static int adis16475_probe(struct spi_device *spi)
> >  	if (ret)
> >  		return ret;
> > 
> > -	ret = devm_adis_setup_buffer_and_trigger(&st->adis, indio_dev,
> > -						 adis16475_trigger_handler);
> > -	if (ret)
> > -		return ret;
> > +	if (st->adis.data->has_fifo) {
> > +		ret = devm_adis_setup_buffer_and_trigger_with_attrs(&st->adis,
> > indio_dev,
> > +								   
> > adis16475_trigger_handler_with_fifo,
> > +								   
> > &adis16475_buffer_ops,
> > +								   
> > adis16475_fifo_attributes);
> > +		if (ret)
> > +			return ret;
> > +
> > +		/* Update overflow behavior to always overwrite the oldest sample.
> > */
> > +		ret = adis_update_bits(&st->adis, ADIS16475_REG_FIFO_CTRL,
> > +				       ADIS16575_OVERFLOW_MASK,
> > (u16)ADIS16575_OVERWRITE_OLDEST);  
> 
> Slight preference for local variable to avoid the cast.

Hmm. This is a symptom of adis_update_bits() being 'too clever'.
I'd be tempted to just split that into 16 bit and 32 bit versions but
that is a much larger patch so a local variable is ok if ugly.


> 
> - Nuno Sá
> 
> 






[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