[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200414104926.2yxpxclsqdp2gz3f@earth.universe>
Date: Tue, 14 Apr 2020 12:49:26 +0200
From: Sebastian Reichel <sebastian.reichel@...labora.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: saravanan sekar <sravanhome@...il.com>,
Lee Jones <lee.jones@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald <pmeerw@...erw.net>,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-iio <linux-iio@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v8 4/6] power: supply: Add support for mps mp2629 battery
charger
Hi,
On Tue, Apr 14, 2020 at 12:05:15PM +0300, Andy Shevchenko wrote:
> On Mon, Apr 13, 2020 at 11:48 PM Sebastian Reichel
> <sebastian.reichel@...labora.com> wrote:
> > On Mon, Apr 13, 2020 at 10:28:19PM +0200, saravanan sekar wrote:
> > > On 13/04/20 10:10 pm, Andy Shevchenko wrote:
> > > > On Mon, Apr 13, 2020 at 8:37 PM Saravanan Sekar <sravanhome@...il.com> wrote:
>
> ...
>
> > > > > + irq = platform_get_irq(to_platform_device(pdev->dev.parent), 0);
> > > > Why not to use temporary variable dev?
> > > >
> > > > This should be platform_get_irq_optional().
> > >
> > > Platform_get_irq in turn calls platform_get_irq_optional. It was suggested
> > > by Lee and is it mandatory to change it?
> >
> > platform_get_irq is fine.
>
> I don't think so. It will spill an error in case there is no IRQ or
> error happened.
I suppose even for an optional IRQ we want an error message when an
error happens (i.e. IRQ is specified, but not used because $reason).
> So, either is should be _optional, or below conditional simply wrong, should be
> if (irq < 0)
> return irq;
In other words: Making the irq mandatory. Sounds reasonable to me
considering the driver code. Without IRQ userspace needs to poll to
know about error states like thermal shutdown.
-- Sebastian
>
> > > > > + if (irq) {
> >
> > But this must be
> >
> > if (irq > 0)
> >
> > or you will also try to continue with error codes.
> >
> > > > > + ret = devm_request_irq(dev, irq, mp2629_irq_handler,
> > > > > + IRQF_TRIGGER_RISING, "mp2629-charger",
> > > > > + charger);
> > > > > + if (ret) {
> > > > > + dev_err(dev, "failed to request gpio IRQ\n");
> > > > > + goto iio_fail;
> > > > > + }
> > > > > + }
> > > > > +}
>
> --
> With Best Regards,
> Andy Shevchenko
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists