Re: [PATCH v3 2/2] iio: imu: inv_icm42600: switch to use generic name irq get

From: Jean-Baptiste Maneyrol
Date: Thu Apr 10 2025 - 05:38:45 EST


Hello Andy,

I tried to respond inline, but my apologies it is not working well with the email client I'm obliged to use.

To sum-up, property.h is already included and I will simplify the fwnode usage to use the API calls directly.

I will just keep the over 80 limit following Jonathan recommendations.

Thanks,
JB

________________________________________
From: Andy Shevchenko <andy@xxxxxxxxxx>
Sent: Wednesday, April 9, 2025 19:07
To: Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@xxxxxxx>
Cc: Jonathan Cameron <jic23@xxxxxxxxxx>; Lars-Peter Clausen <lars@xxxxxxxxxx>; Rob Herring <robh@xxxxxxxxxx>; Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>; Conor Dooley <conor+dt@xxxxxxxxxx>; David Lechner <dlechner@xxxxxxxxxxxx>; Nuno Sá <nuno.sa@xxxxxxxxxx>; linux-iio@xxxxxxxxxxxxxxx <linux-iio@xxxxxxxxxxxxxxx>; devicetree@xxxxxxxxxxxxxxx <devicetree@xxxxxxxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx <linux-kernel@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH v3 2/2] iio: imu: inv_icm42600: switch to use generic name irq get
 
This Message Is From an External Sender
This message came from outside your organization.
 
On Wed, Apr 09, 2025 at 05:14:32PM +0200, Jean-Baptiste Maneyrol via B4 Relay wrote:
> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@xxxxxxx>
>
> Use generic fwnode_irq_get_byname() for getting interrupt pin using
> interrupt name. Only INT1 is supported by the driver currently.
>
> If not found fallback to first defined interrupt to keep compatibility.

...

> -int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
> +int inv_icm42600_core_probe(struct regmap *regmap, int chip,
> inv_icm42600_bus_setup bus_setup);

If you use 100 limit, it fits now on one line.

...

> -int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
> +int inv_icm42600_core_probe(struct regmap *regmap, int chip,
> inv_icm42600_bus_setup bus_setup)

Ditto.

...

> + struct fwnode_handle *fwnode;

Do you need to include property.h?

property.h is already included.

...

> + /* get INT1 only supported interrupt or fallback to first interrupt */
> + fwnode = dev_fwnode(dev);

> + if (!fwnode)
> + return -ENODEV;

Unneeded check, the below will do it for you,

OK, I will simplify and user directly the fwnode functions.

> + irq = fwnode_irq_get_byname(fwnode, "INT1");
> + if (irq < 0 && irq != -EPROBE_DEFER) {
> + dev_info(dev, "no INT1 interrupt defined, fallback to first interrupt\n");
> + irq = fwnode_irq_get(fwnode, 0);
> + }
> + if (irq < 0)
> + return dev_err_probe(dev, irq, "error missing INT1 interrupt\n");

...

> - return inv_icm42600_core_probe(regmap, chip, client->irq,
> + return inv_icm42600_core_probe(regmap, chip,
> inv_icm42600_i2c_bus_setup);

This is now one line (81 characters which is fine independently on your choice
of the limit).

...

> - return inv_icm42600_core_probe(regmap, chip, spi->irq,
> + return inv_icm42600_core_probe(regmap, chip,
> inv_icm42600_spi_bus_setup);

One line.

--
With Best Regards,
Andy Shevchenko