From: Jonathan Cameron <jic23@kernel.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: Ramona Gradinariu <ramona.bolboaca13@gmail.com>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, conor+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, robh@kernel.org,
nuno.sa@analog.com
Subject: Re: [PATCH v4 10/10] drivers: iio: imu: Add support for adis1657x family
Date: Sun, 26 May 2024 13:48:58 +0100 [thread overview]
Message-ID: <20240526134858.636d2c8f@jic23-huawei> (raw)
In-Reply-To: <bdc88590fe3e54326c1edbe6f2b4ac2d8f453df4.camel@gmail.com>
> > @@ -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á
>
>
next prev parent reply other threads:[~2024-05-26 12:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 9:03 [PATCH v4 10/10] drivers: iio: imu: Add support for adis1657x family Ramona Gradinariu
2024-05-24 10:56 ` Nuno Sá
2024-05-26 12:48 ` Jonathan Cameron [this message]
2024-05-26 13:01 ` 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=20240526134858.636d2c8f@jic23-huawei \
--to=jic23@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noname.nuno@gmail.com \
--cc=nuno.sa@analog.com \
--cc=ramona.bolboaca13@gmail.com \
--cc=robh@kernel.org \
/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