[PATCH v11] pwm: bcm2835: Allow PWM driver to be used in atomic context

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Fri Dec 22 02:30:47 PST 2023


Hello Sean,

On Wed, Dec 20, 2023 at 02:24:25PM +0000, Sean Young wrote:
> @@ -151,8 +153,26 @@ static int bcm2835_pwm_probe(struct platform_device *pdev)
>  		return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk),
>  				     "clock not found\n");
>  
> +	ret = clk_rate_exclusive_get(pc->clk);
> +	if (ret)
> +		return dev_err_probe(&pdev->dev, ret,
> +				     "fail to get exclusive rate\n");
> +
> +	ret = devm_add_action_or_reset(&pdev->dev, devm_clk_rate_exclusive_put,
> +				       pc->clk);
> +	if (ret) {
> +		clk_rate_exclusive_put(pc->clk);

That clk_rate_exclusive_put() is wrong. If devm_add_action_or_reset()
fails that is already cared for.

Given that Thierry already applied this patch, getting this fixed in a
timely manner would be good.

> +		return ret;
> +	}
> +
> +	pc->rate = clk_get_rate(pc->clk);
> +	if (!pc->rate)
> +		return dev_err_probe(&pdev->dev, -EINVAL,
> +				     "failed to get clock rate\n");
> +
>  	pc->chip.dev = &pdev->dev;
>  	pc->chip.ops = &bcm2835_pwm_ops;
> +	pc->chip.atomic = true;
>  	pc->chip.npwm = 2;
>  
>  	platform_set_drvdata(pdev, pc);

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20231222/d9478292/attachment.sig>


More information about the linux-arm-kernel mailing list