linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: saravanan sekar <sravanhome@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	devicetree <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v8 4/6] power: supply: Add support for mps mp2629 battery charger
Date: Tue, 14 Apr 2020 12:49:26 +0200	[thread overview]
Message-ID: <20200414104926.2yxpxclsqdp2gz3f@earth.universe> (raw)
In-Reply-To: <CAHp75VdRXWVtveRnvR-k8wqH5R_P7owfQvFf7YT3qM_oVEY3vg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1973 bytes --]

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@collabora.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@gmail.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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-04-14 10:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 17:36 [PATCH v8 0/6] Add battery charger driver support for MP2629 Saravanan Sekar
2020-04-13 17:36 ` [PATCH v8 1/6] dt-bindings: mfd: add document bindings for mp2629 Saravanan Sekar
2020-04-13 17:36 ` [PATCH v8 2/6] mfd: mp2629: Add support for mps battery charger Saravanan Sekar
2020-04-13 17:36 ` [PATCH v8 3/6] iio: adc: mp2629: Add support for mp2629 ADC driver Saravanan Sekar
2020-04-13 17:36 ` [PATCH v8 4/6] power: supply: Add support for mps mp2629 battery charger Saravanan Sekar
2020-04-13 20:10   ` Andy Shevchenko
2020-04-13 20:28     ` saravanan sekar
2020-04-13 20:48       ` Sebastian Reichel
2020-04-14  9:05         ` Andy Shevchenko
2020-04-14 10:49           ` Sebastian Reichel [this message]
2020-04-13 17:36 ` [PATCH v8 5/6] power: supply: mp2629: Add impedance compenstation config Saravanan Sekar
2020-04-13 17:36 ` [PATCH v8 6/6] MAINTAINERS: Add entry for mp2629 Battery Charger driver Saravanan Sekar
2020-04-13 20:01 ` [PATCH v8 0/6] Add battery charger driver support for MP2629 Andy Shevchenko

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=20200414104926.2yxpxclsqdp2gz3f@earth.universe \
    --to=sebastian.reichel@collabora.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=sravanhome@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).