From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
linux-pwm@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 2/3] pwm: renesas-tpu: Fix late Runtime PM enablement
Date: Mon, 16 Mar 2020 18:04:40 +0200 [thread overview]
Message-ID: <20200316160440.GO4732@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200316160108.qylpoglfhhqvqqwt@pengutronix.de>
Hi Geert,
Thank you for the patch.
On Mon, Mar 16, 2020 at 05:01:08PM +0100, Uwe Kleine-König wrote:
> On Mon, Mar 16, 2020 at 11:32:15AM +0100, Geert Uytterhoeven wrote:
> > Runtime PM should be enabled before calling pwmchip_add(), as PWM users
> > can appear immediately after the PWM chip has been added.
> > Likewise, Runtime PM should always be disabled after the removal of the
> > PWM chip, even if the latter failed.
> > Fixes: 99b82abb0a35b073 ("pwm: Add Renesas TPU PWM driver")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > drivers/pwm/pwm-renesas-tpu.c | 9 ++++-----
> > 1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c
> > index 4a855a21b782dea3..8032acc84161a9dd 100644
> > --- a/drivers/pwm/pwm-renesas-tpu.c
> > +++ b/drivers/pwm/pwm-renesas-tpu.c
> > @@ -415,16 +415,17 @@ static int tpu_probe(struct platform_device *pdev)
> > tpu->chip.base = -1;
> > tpu->chip.npwm = TPU_CHANNEL_MAX;
> >
> > + pm_runtime_enable(&pdev->dev);
> > +
> > ret = pwmchip_add(&tpu->chip);
> > if (ret < 0) {
> > dev_err(&pdev->dev, "failed to register PWM chip\n");
> > + pm_runtime_disable(&pdev->dev);
> > return ret;
> > }
> >
> > dev_info(&pdev->dev, "TPU PWM %d registered\n", tpu->pdev->id);
> >
> > - pm_runtime_enable(&pdev->dev);
> > -
> > return 0;
> > }
This part looks good to me.
> >
> > @@ -434,12 +435,10 @@ static int tpu_remove(struct platform_device *pdev)
> > int ret;
> >
> > ret = pwmchip_remove(&tpu->chip);
> > - if (ret)
> > - return ret;
> >
> > pm_runtime_disable(&pdev->dev);
> >
> > - return 0;
> > + return ret;
> > }
>
> Maybe I was a bit quick with my reply to the previous patch. I wonder if
> it is right to call pm_runtime_disable if pwmchip_remove failed?
It should at least be explained in the commit message why this is the
right thing to do.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2020-03-16 16:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 10:32 [PATCH 0/3] pwm: Renesas R-Car and TPU fixes Geert Uytterhoeven
2020-03-16 10:32 ` [PATCH 1/3] pwm: rcar: Fix late Runtime PM enablement Geert Uytterhoeven
2020-03-16 15:40 ` Uwe Kleine-König
2020-03-16 15:42 ` Geert Uytterhoeven
2020-03-16 15:57 ` Uwe Kleine-König
2020-03-16 16:02 ` Laurent Pinchart
2020-03-16 10:32 ` [PATCH 2/3] pwm: renesas-tpu: " Geert Uytterhoeven
2020-03-16 16:01 ` Uwe Kleine-König
2020-03-16 16:04 ` Laurent Pinchart [this message]
2020-03-16 16:06 ` Geert Uytterhoeven
2020-03-16 16:11 ` Laurent Pinchart
2020-03-16 10:32 ` [PATCH 3/3] pwm: renesas-tpu: Drop confusing registered message Geert Uytterhoeven
2020-03-16 16:05 ` Laurent Pinchart
2020-03-16 16:27 ` Uwe Kleine-König
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=20200316160440.GO4732@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=geert+renesas@glider.be \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=yoshihiro.shimoda.uh@renesas.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