Re: [PATCH v3 2/2] iio: imu: inv_icm42600: switch to use generic name irq get
From: Jonathan Cameron
Date: Wed Apr 09 2025 - 13:13:20 EST
On Wed, 9 Apr 2025 20:07:43 +0300
Andy Shevchenko <andy@xxxxxxxxxx> wrote:
> 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.
I'd rather stick to 'just over 80' where it really helps. Rather than
generally switch to 100. Maybe that day will come but I'm not sure it is
yet.
>
> ...
>
> > -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?
>
> ...
>
> > + /* 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,
>
> > + 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.
>