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