@@ -42,6 +42,7 @@ struct mtk_pwm_data {
};
struct mtk_disp_pwm {
+ struct device *parent;
const struct mtk_pwm_data *data;
struct clk *clk_main;
struct clk *clk_mm;
@@ -90,14 +91,14 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
if (!mdp->enabled) {
err = clk_prepare_enable(mdp->clk_main);
if (err < 0) {
- dev_err(chip->dev, "Can't enable mdp->clk_main: %pe\n",
+ dev_err(mdp->parent, "Can't enable mdp->clk_main: %pe\n",
ERR_PTR(err));
return err;
}
err = clk_prepare_enable(mdp->clk_mm);
if (err < 0) {
- dev_err(chip->dev, "Can't enable mdp->clk_mm: %pe\n",
+ dev_err(mdp->parent, "Can't enable mdp->clk_mm: %pe\n",
ERR_PTR(err));
clk_disable_unprepare(mdp->clk_main);
return err;
@@ -180,13 +181,13 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip,
err = clk_prepare_enable(mdp->clk_main);
if (err < 0) {
- dev_err(chip->dev, "Can't enable mdp->clk_main: %pe\n", ERR_PTR(err));
+ dev_err(mdp->parent, "Can't enable mdp->clk_main: %pe\n", ERR_PTR(err));
return err;
}
err = clk_prepare_enable(mdp->clk_mm);
if (err < 0) {
- dev_err(chip->dev, "Can't enable mdp->clk_mm: %pe\n", ERR_PTR(err));
+ dev_err(mdp->parent, "Can't enable mdp->clk_mm: %pe\n", ERR_PTR(err));
clk_disable_unprepare(mdp->clk_main);
return err;
}
@@ -239,6 +240,7 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
return PTR_ERR(chip);
mdp = to_mtk_disp_pwm(chip);
+ mdp->parent = &pdev->dev;
mdp->data = of_device_get_match_data(&pdev->dev);
mdp->base = devm_platform_ioremap_resource(pdev, 0);
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-mtk-disp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)