diff mbox series

[v1,086/101] pwm: raspberrypi-poe: Store parent device in driver data

Message ID 20230808171931.944154-87-u.kleine-koenig@pengutronix.de
State Superseded
Headers show
Series pwm: Fix lifetime issues for pwm_chips | expand

Commit Message

Uwe Kleine-König Aug. 8, 2023, 5:19 p.m. UTC
struct pwm_chip::dev is about to change. To not have to touch this
driver in the same commit as struct pwm_chip::dev, store a pointer to
the parent device in driver data.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-raspberrypi-poe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-raspberrypi-poe.c b/drivers/pwm/pwm-raspberrypi-poe.c
index 4b2711d59e7c..b6d1326a3741 100644
--- a/drivers/pwm/pwm-raspberrypi-poe.c
+++ b/drivers/pwm/pwm-raspberrypi-poe.c
@@ -26,6 +26,7 @@ 
 #define RPI_PWM_CUR_DUTY_REG		0x0
 
 struct raspberrypi_pwm {
+	struct device *parent;
 	struct rpi_firmware *firmware;
 	unsigned int duty_cycle;
 };
@@ -121,7 +122,7 @@  static int raspberrypi_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 	ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG,
 					   duty_cycle);
 	if (ret) {
-		dev_err(chip->dev, "Failed to set duty cycle: %pe\n",
+		dev_err(rpipwm->parent, "Failed to set duty cycle: %pe\n",
 			ERR_PTR(ret));
 		return ret;
 	}
@@ -163,6 +164,7 @@  static int raspberrypi_pwm_probe(struct platform_device *pdev)
 		return PTR_ERR(chip);
 	rpipwm = raspberrypi_pwm_from_chip(chip);
 
+	rpipwm->parent = &pdev->dev;
 	rpipwm->firmware = firmware;
 	chip->ops = &raspberrypi_pwm_ops;