Message ID | 20230718175310.3946687-1-u.kleine-koenig@pengutronix.de |
---|---|
State | Accepted |
Headers | show |
Series | pwm: ntxec: Use device_set_of_node_from_dev() | expand |
On Tue, 18 Jul 2023 19:53:10 +0200, Uwe Kleine-König wrote: > Compared to overwriting pdev->dev.of_node directly, this takes care of > reference counting. It also prevents that the parent device matches this > driver. See commit 9b22c17a3cc5 ("of: Check 'of_node_reused' flag on > of_match_device()") for further details. > > Applied, thanks! [1/1] pwm: ntxec: Use device_set_of_node_from_dev() commit: 387c74e5f91d8e6f0c6e49fddd8b0e53118e5def Best regards,
diff --git a/drivers/pwm/pwm-ntxec.c b/drivers/pwm/pwm-ntxec.c index ab63b081df53..7ff5a33c17f3 100644 --- a/drivers/pwm/pwm-ntxec.c +++ b/drivers/pwm/pwm-ntxec.c @@ -141,7 +141,7 @@ static int ntxec_pwm_probe(struct platform_device *pdev) struct ntxec_pwm *priv; struct pwm_chip *chip; - pdev->dev.of_node = pdev->dev.parent->of_node; + device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv)
Compared to overwriting pdev->dev.of_node directly, this takes care of reference counting. It also prevents that the parent device matches this driver. See commit 9b22c17a3cc5 ("of: Check 'of_node_reused' flag on of_match_device()") for further details. Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/pwm/pwm-ntxec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5