Linux PWM subsystem development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: "Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"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 1/3] pwm: rcar: Fix late Runtime PM enablement
Date: Mon, 16 Mar 2020 18:02:14 +0200	[thread overview]
Message-ID: <20200316160214.GN4732@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200316103216.29383-2-geert+renesas@glider.be>

Hi Geert,

Thank you for the patch.

On Mon, Mar 16, 2020 at 11:32:14AM +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 be disabled after the removal of the PWM
> chip.
> 
> Fixes: ed6c1476bf7f16d5 ("pwm: Add support for R-Car PWM Timer")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/pwm/pwm-rcar.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
> index 2685577b6dd45be7..7ab9eb6616d950cb 100644
> --- a/drivers/pwm/pwm-rcar.c
> +++ b/drivers/pwm/pwm-rcar.c
> @@ -229,24 +229,28 @@ static int rcar_pwm_probe(struct platform_device *pdev)
>  	rcar_pwm->chip.base = -1;
>  	rcar_pwm->chip.npwm = 1;
>  
> +	pm_runtime_enable(&pdev->dev);
> +
>  	ret = pwmchip_add(&rcar_pwm->chip);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed to register PWM chip: %d\n", ret);
> +		pm_runtime_disable(&pdev->dev);
>  		return ret;
>  	}
>  
> -	pm_runtime_enable(&pdev->dev);
> -
>  	return 0;
>  }
>  
>  static int rcar_pwm_remove(struct platform_device *pdev)
>  {
>  	struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev);
> +	int ret;
> +
> +	ret = pwmchip_remove(&rcar_pwm->chip);
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> -	return pwmchip_remove(&rcar_pwm->chip);
> +	return ret;
>  }
>  
>  static const struct of_device_id rcar_pwm_of_table[] = {

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2020-03-16 16:02 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 [this message]
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
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=20200316160214.GN4732@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