@@ -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;
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(-)