@@ -40,6 +40,7 @@ struct fsl_pwm_periodcfg {
};
struct fsl_pwm_chip {
+ struct device *parent;
struct mutex lock;
struct regmap *regmap;
@@ -232,7 +233,7 @@ static int fsl_pwm_apply_config(struct pwm_chip *chip,
bool do_write_period = false;
if (!fsl_pwm_calculate_period(fpc, newstate->period, &periodcfg)) {
- dev_err(chip->dev, "failed to calculate new period\n");
+ dev_err(fpc->parent, "failed to calculate new period\n");
return -EINVAL;
}
@@ -246,7 +247,7 @@ static int fsl_pwm_apply_config(struct pwm_chip *chip,
*/
else if (!fsl_pwm_periodcfg_are_equal(&fpc->period, &periodcfg)) {
if (fsl_pwm_is_other_pwm_enabled(fpc, pwm)) {
- dev_err(chip->dev,
+ dev_err(fpc->parent,
"Cannot change period for PWM %u, disable other PWMs first\n",
pwm->hwpwm);
return -EBUSY;
@@ -404,6 +405,7 @@ static int fsl_pwm_probe(struct platform_device *pdev)
mutex_init(&fpc->lock);
+ fpc->parent = &pdev->dev;
fpc->soc = of_device_get_match_data(&pdev->dev);
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-fsl-ftm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)