mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Remi Buisson <Remi.Buisson@tdk.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v5 2/9] iio: imu: inv_icm45600: add new inv_icm45600 driver
Date: Thu, 4 Sep 2025 16:17:12 +0300	[thread overview]
Message-ID: <aLmRWHZ-fNYjeYll@smile.fi.intel.com> (raw)
In-Reply-To: <FR2PPF4571F02BCC073F7740CBA818676388C00A@FR2PPF4571F02BC.DEUP281.PROD.OUTLOOK.COM>

On Thu, Sep 04, 2025 at 12:58:10PM +0000, Remi Buisson wrote:
> >From: Andy Shevchenko <andriy.shevchenko@intel.com> 
> >Sent: Thursday, August 21, 2025 11:03 AM
> >On Wed, Aug 20, 2025 at 02:24:20PM +0000, Remi Buisson via B4 Relay wrote:

...

> >> +struct inv_icm45600_state {
> >> +	struct mutex lock;
> >
> >No header for this.
> 
> Correct

Please, add.

...

> >> +	struct regmap *map;
> >
> >No forward declaration.
> 
> Correct again

Ditto.

...

> >> +	struct regulator *vddio_supply;
> >
> >Ditto.
> 
> Correct

Ditto.

...

> >> +static const struct regmap_config inv_icm45600_regmap_config = {
> >> +	.reg_bits = 16,
> >> +	.val_bits = 8,
> >
> >No cache?
> >
> If OK for you, we prefer to push this patch without cache.
> And introduce it in another patchset.

Fine to me if there is a comment given (in the email, not in the code) to
justify this split. Enabling cache is one line, but, of cource, it might
require a cache handling in the corner or special cases.

> >> +};

...

> >> +/**
> >> + *  inv_icm45600_setup() - check and setup chip
> >> + *  @st:	driver internal state
> >> + *  @chip_info:	detected chip description
> >> + *  @reset:	define whether a reset is required or not
> >> + *  @bus_setup:	callback for setting up bus specific registers
> >> + *
> >> + *  Returns 0 on success, a negative error code otherwise.
> >
> >Please, run kernel-doc validator. It's not happy (Return section is missing)
> 
> kernel-doc does not complain on this, on my side. 
> I ran kernel-doc.py -v -none drivers/iio/imu/inv_icm45600/*
> Is there any option I'm missing.
> Anyway, I will add the missing colon and check the result.

-Wall is missed in the command line.

> >> + */

...

> >> +		if (val == U8_MAX || val == 0)
> >
> >Hmm... Perhaps in_range() ?
> 
> Not sure of the benefit of this change.
> I prefer to keep it this way if OK for you.

It depends on the semantics of the value in the 'val'. And hence semantics of 0
and U8_MAX.

> >> +			return dev_err_probe(dev, -ENODEV,
> >> +					     "Invalid whoami %#02x expected %#02x (%s)\n",
> >> +					     val, chip_info->whoami, chip_info->name);

...

> >> +		ret = regmap_write(st->map, INV_ICM45600_REG_MISC2,
> >> +				   INV_ICM45600_MISC2_SOFT_RESET);
> >> +		if (ret)
> >> +			return ret;
> >> +		/* IMU reset time: 1ms. */
> >> +		fsleep(1000);
> >
> >Use 1 * USEC_PER_MSEC and drop useless comment after that.
> >You will need time.h for it.
> 
> Thanks for the tip, clear improvement.
> >
> >> +
> >> +		if (bus_setup) {
> >> +			ret = bus_setup(st);
> >> +			if (ret)
> >> +				return ret;
> >> +		}
> >> +
> >> +		ret = regmap_read(st->map, INV_ICM45600_REG_INT_STATUS, &val);
> >> +		if (ret)
> >> +			return ret;
> >> +		if (!(val & INV_ICM45600_INT_STATUS_RESET_DONE)) {
> >> +			dev_err(dev, "reset error, reset done bit not set\n");
> >> +			return -ENODEV;
> >> +		}
> >
> >...
> >
> >> +static int inv_icm45600_enable_regulator_vddio(struct inv_icm45600_state *st)
> >> +{
> >> +	int ret;
> >> +
> >> +	ret = regulator_enable(st->vddio_supply);
> >> +	if (ret)
> >> +		return ret;
> >> +
> >> +	/* Wait a little for supply ramp. */
> >> +	fsleep(3000);
> >
> >As per above.
> Yes.

For both cases actually you can leave a comment, but rewrite it in a way that
it refers to the datasheet. This will be useful.

> >> +	return 0;
> >> +}

...

> >> +	/* IMU start-up time. */
> >> +	fsleep(100000);
> >
> >100 * USEC_PER_MSEC
> Yes.

As per above.

...

> >> +	scoped_guard(mutex, &st->lock)
> >> +		/* Restore sensors state. */
> >> +		ret = inv_icm45600_set_pwr_mgmt0(st, st->suspended.gyro,
> >> +						st->suspended.accel, NULL);
> >
> >With guard()() this whole construction will look better.
> 
> It's coming in later patch.
> I thought it would better follow coding guidelines this way.
> But let me know if it is not the case.

Ah, yes, but weren't {} missing?

> >> +	return ret;

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-09-04 13:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 14:24 [PATCH v5 0/9] iio: imu: " Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 1/9] dt-bindings: iio: imu: Add inv_icm45600 Remi Buisson via B4 Relay
2025-08-20 19:33   ` Conor Dooley
2025-08-20 14:24 ` [PATCH v5 2/9] iio: imu: inv_icm45600: add new inv_icm45600 driver Remi Buisson via B4 Relay
2025-08-21  9:02   ` Andy Shevchenko
2025-09-04 12:58     ` Remi Buisson
2025-09-04 13:17       ` Andy Shevchenko [this message]
2025-09-05 12:43         ` Remi Buisson
2025-09-05 13:47           ` Andy Shevchenko
2025-08-25 10:34   ` Jonathan Cameron
2025-09-04 13:04     ` Remi Buisson
2025-09-07 13:31       ` Jonathan Cameron
2025-08-20 14:24 ` [PATCH v5 3/9] iio: imu: inv_icm45600: add buffer support in iio devices Remi Buisson via B4 Relay
2025-08-21  9:20   ` Andy Shevchenko
2025-09-04 13:01     ` Remi Buisson
2025-09-04 13:49       ` Andy Shevchenko
2025-09-05 12:44         ` Remi Buisson
2025-09-05 13:49           ` Andy Shevchenko
2025-09-07 13:34           ` Jonathan Cameron
2025-09-22  8:52           ` Remi Buisson
2025-08-25 10:42   ` Jonathan Cameron
2025-09-04 13:05     ` Remi Buisson
2025-08-20 14:24 ` [PATCH v5 4/9] iio: imu: inv_icm45600: add IMU IIO gyroscope device Remi Buisson via B4 Relay
2025-08-25 10:55   ` Jonathan Cameron
2025-09-04 13:06     ` Remi Buisson
2025-08-20 14:24 ` [PATCH v5 5/9] iio: imu: inv_icm45600: add IMU IIO accelerometer device Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 6/9] iio: imu: inv_icm45600: add I2C driver for inv_icm45600 driver Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 7/9] iio: imu: inv_icm45600: add SPI " Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 8/9] iio: imu: inv_icm45600: add I3C " Remi Buisson via B4 Relay
2025-08-20 14:24 ` [PATCH v5 9/9] MAINTAINERS: add entry for inv_icm45600 6-axis imu sensor Remi Buisson via B4 Relay

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=aLmRWHZ-fNYjeYll@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=Remi.Buisson@tdk.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=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@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®