diff mbox series

[v1,081/101] pwm: mediatek: Store parent device in driver data

Message ID 20230808171931.944154-82-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-mediatek.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
index 68cdeeb1ecf2..11e345474e1a 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -51,6 +51,7 @@  struct pwm_mediatek_of_data {
  * @soc: pointer to chip's platform data
  */
 struct pwm_mediatek_chip {
+	struct device *parent;
 	void __iomem *regs;
 	struct clk *clk_top;
 	struct clk *clk_main;
@@ -149,7 +150,7 @@  static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
 
 	if (clkdiv > PWM_CLK_DIV_MAX) {
 		pwm_mediatek_clk_disable(chip, pwm);
-		dev_err(chip->dev, "period of %d ns not supported\n", period_ns);
+		dev_err(pc->parent, "period of %d ns not supported\n", period_ns);
 		return -EINVAL;
 	}
 
@@ -246,6 +247,7 @@  static int pwm_mediatek_probe(struct platform_device *pdev)
 	pc = to_pwm_mediatek_chip(chip);
 
 	pc->soc = soc;
+	pc->parent = &pdev->dev;
 
 	pc->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->regs))