mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Sabau, Radu bogdan" <radu.sabau@analog.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	"Sa, Nuno" <Nuno.Sa@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	linux <linux@analog.com>
Subject: Re: [PATCH v4 5/8] iio: imu: Add driver for the ADI ADIS16607
Date: Mon, 26 Oct 2026 12:50:51 +0200	[thread overview]
Message-ID: <at8wi0tO7qR29i8E@ashevche-desk.local> (raw)
In-Reply-To: <LV9PR03MB841429F153BCF3BA9F18CC02F7612@LV9PR03MB8414.namprd03.prod.outlook.com>

On Mon, Oct 26, 2026 at 10:22:22AM +0000, Sabau, Radu bogdan wrote:
> > From: Andy Shevchenko <andriy.shevchenko@intel.com>
> > Sent: Friday, October 23, 2026 1:27 PM

...

> > > +static int adis16607_firmware_revision_show(struct seq_file *s, void *arg)
> > > +{
> > > +	struct adis16607 *st = s->private;
> > > +	u16 rev;
> > 
> > Can this be
> > 
> > 	struct revision {
> > 		u8 minor;
> > 		u8 major;
> > 	} rev;
> > 
> > ?
> 
> Although I like the idea, I have a question here.
> If u16 rev would be replaced by the struct and the read was done
> directly on the struct pointer, could it mess things up on big-endian
> targets? A native 16-bit store would place the value's low byte at
> the lower address on little-endian, but the high byte at the lower
> address on big-endian - so minor (at the lower offset) would only
> get the right byte on little-endian, and would actually get major's
> byte on big-endian, right?
> 
> What about we declare this struct and also have a u16 tmp declared,
> do the read on tmp, and then rev.minor/rev.major get assigned via
> FIELD_GET() - keeping the readability improvement without that risk?
> 
> struct {
>         u8 minor;
>         u8 major;
> } rev;
> u16 tmp;
> int ret;
> 
> ret = adis_read_reg_16(&st->adis, ADIS16607_REG_REV_ID, &tmp);
> if (ret)
>         return ret;
> 
> rev.major = FIELD_GET(GENMASK(15, 8), tmp);
> rev.minor = FIELD_GET(GENMASK(7, 0), tmp);
> 
> seq_printf(s, "%u.%u\n", rev.major, rev.minor);

Yes, this will work for me.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-10-26 10:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23  9:30 [PATCH v4 0/8] iio: imu: Add support " Radu Sabau via B4 Relay
2026-10-23  9:30 ` [PATCH v4 1/8] iio: imu: adis: Add optional self_test callback Radu Sabau via B4 Relay
2026-10-23  9:30 ` [PATCH v4 2/8] iio: imu: adis: Fix custom reset dispatch in adislib Radu Sabau via B4 Relay
2026-10-23  9:30 ` [PATCH v4 3/8] iio: imu: adis: Add optional post_reset_setup callback Radu Sabau via B4 Relay
2026-10-25 23:52   ` Jonathan Cameron
2026-10-26  9:52     ` Sabau, Radu bogdan
2026-10-23  9:30 ` [PATCH v4 4/8] dt-bindings: iio: imu: Add bindings for ADI ADIS16607 Radu Sabau via B4 Relay
2026-10-25 23:54   ` Jonathan Cameron
2026-10-23  9:30 ` [PATCH v4 5/8] iio: imu: Add driver for the " Radu Sabau via B4 Relay
2026-10-23 10:26   ` Andy Shevchenko
2026-10-26 10:22     ` Sabau, Radu bogdan
2026-10-26 10:50       ` Andy Shevchenko [this message]
2026-10-23  9:30 ` [PATCH v4 6/8] iio: imu: adis16607: Add FIFO-based buffered/triggered capture Radu Sabau via B4 Relay
2026-10-26  0:09   ` Jonathan Cameron
2026-10-27  9:36     ` Sabau, Radu bogdan
2026-10-23  9:30 ` [PATCH v4 7/8] iio: imu: adis16607: Add external clock sync support Radu Sabau via B4 Relay
2026-10-26  0:11   ` Jonathan Cameron
2026-10-26 10:54     ` Sabau, Radu bogdan
2026-10-23  9:30 ` [PATCH v4 8/8] iio: imu: adis16607: Add calibration bias support for gyro/accel Radu Sabau via B4 Relay
2026-10-26  0:15   ` 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=at8wi0tO7qR29i8E@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=Nuno.Sa@analog.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=radu.sabau@analog.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

all inboxes | Powered by JetHome®