Re: [PATCH v3] driver core: platform: Add an error message to platform_get_irq*()

From: Rafael J. Wysocki
Date: Thu Jan 03 2019 - 12:23:12 EST


On Thu, Jan 3, 2019 at 5:12 PM Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
>
> Quoting Rafael J. Wysocki (2019-01-03 01:40:26)
> > On Wed, Jan 2, 2019 at 7:51 PM Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
> > > @@ -130,6 +125,22 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
> > > return r ? r->start : -ENXIO;
> > > #endif
> > > }
> > > +
> > > +/**
> > > + * platform_get_irq - get an IRQ for a device
> > > + * @dev: platform device
> > > + * @num: IRQ number index
> > > + */
> > > +int platform_get_irq(struct platform_device *dev, unsigned int num)
> > > +{
> > > + int ret;
> > > +
> > > + ret = __platform_get_irq(dev, num);
> > > + if (ret < 0 && ret != -EPROBE_DEFER)
> > > + dev_err(&dev->dev, "IRQ index %u not found\n", num);
> >
> > Why don't you log the error code too?
> >
>
> I don't see much benefit to seeing -ENXIO or -EINVAL printed here, so I
> left out the error code.

OK, so the value of the message is to tell the user that some driver
asked for an invalid IRQ, right?