@@ -34,6 +34,7 @@
struct iqs620_pwm_private {
struct iqs62x_core *iqs62x;
+ struct device *dev;
struct pwm_chip chip;
struct notifier_block notifier;
struct mutex lock;
@@ -160,7 +161,7 @@ static int iqs620_pwm_notifier(struct notifier_block *notifier,
mutex_unlock(&iqs620_pwm->lock);
if (ret) {
- dev_err(iqs620_pwm->chip.dev,
+ dev_err(iqs620_pwm->dev,
"Failed to re-initialize device: %d\n", ret);
return NOTIFY_BAD;
}
@@ -181,7 +182,7 @@ static void iqs620_pwm_notifier_unregister(void *context)
ret = blocking_notifier_chain_unregister(&iqs620_pwm->iqs62x->nh,
&iqs620_pwm->notifier);
if (ret)
- dev_err(iqs620_pwm->chip.dev,
+ dev_err(iqs620_pwm->dev,
"Failed to unregister notifier: %d\n", ret);
}
@@ -196,6 +197,7 @@ static int iqs620_pwm_probe(struct platform_device *pdev)
if (!iqs620_pwm)
return -ENOMEM;
+ iqs620_pwm->dev = &pdev->dev;
iqs620_pwm->iqs62x = iqs62x;
ret = regmap_read(iqs62x->regmap, IQS620_PWR_SETTINGS, &val);
This prepares the driver for further changes that will drop struct pwm_chip chip from struct iqs620_pwm_private. The only two functions that make use of struct iqs620_pwm_private::chip (apart from the probe function that is handled later when converting to pwmchip_alloc()) only use the chip's device pointer. Introduce such a pointer in driver data and use that instead. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/pwm/pwm-iqs620a.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)