pwm: iqs620a: Prepare removing pwm_chip from driver data
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 14 Feb 2024 09:31:40 +0000 (10:31 +0100)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 19 Feb 2024 10:04:10 +0000 (11:04 +0100)
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.

Link: https://lore.kernel.org/r/e6b1636c0d26d8bcb02a66b2963e2cc394014d76.1707900770.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
drivers/pwm/pwm-iqs620a.c

index 98008cae6d70389c491697a328c467248ca52ea5..faf52d3c2720b4a98072183c41271bc1c47fbf87 100644 (file)
@@ -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);