[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240526134858.636d2c8f@jic23-huawei>
Date: Sun, 26 May 2024 13:48:58 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Nuno Sá <noname.nuno@...il.com>
Cc: Ramona Gradinariu <ramona.bolboaca13@...il.com>,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, conor+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, robh@...nel.org, nuno.sa@...log.com
Subject: Re: [PATCH v4 10/10] drivers: iio: imu: Add support for adis1657x
family
> > @@ -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á
>
>
Powered by blists - more mailing lists