@@ -27,6 +27,7 @@ struct stm32_breakinput {
};
struct stm32_pwm {
+ struct device *parent;
struct mutex lock; /* protect pwm config/enable */
struct clk *clk;
struct regmap *regmap;
@@ -108,7 +109,7 @@ static int stm32_pwm_raw_capture(struct stm32_pwm *priv, struct pwm_device *pwm,
unsigned long tmo_ms, u32 *raw_prd,
u32 *raw_dty)
{
- struct device *parent = pwm->chip->dev->parent;
+ struct device *parent = priv->parent;
enum stm32_timers_dmas dma_id;
u32 ccen, ccr;
int ret;
@@ -184,7 +185,7 @@ static int stm32_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm,
ret = clk_enable(priv->clk);
if (ret) {
- dev_err(chip->dev, "failed to enable counter clock\n");
+ dev_err(priv->parent, "failed to enable counter clock\n");
goto unlock;
}
@@ -621,6 +622,7 @@ static int stm32_pwm_probe(struct platform_device *pdev)
priv = to_stm32_pwm_dev(chip);
mutex_init(&priv->lock);
+ priv->parent = &pdev->dev;
priv->regmap = ddata->regmap;
priv->clk = ddata->clk;
priv->max_arr = ddata->max_arr;
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-stm32.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)