pwm: twl-led: Make use of pwmchip_parent() accessor
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 14 Feb 2024 09:33:09 +0000 (10:33 +0100)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 22 Feb 2024 13:39:27 +0000 (14:39 +0100)
struct pwm_chip::dev is about to change. To not have to touch this
driver in the same commit as struct pwm_chip::dev, use the accessor
function provided for exactly this purpose.

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

index c670ccb81653609d3c665a4729b377abaf69f1b3..00ef798dae52032f2c31d9c35fb2b978530939c9 100644 (file)
@@ -100,7 +100,7 @@ static int twl4030_pwmled_config(struct pwm_chip *chip, struct pwm_device *pwm,
 
        ret = twl_i2c_write(TWL4030_MODULE_LED, pwm_config, base, 2);
        if (ret < 0)
-               dev_err(chip->dev, "%s: Failed to configure PWM\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to configure PWM\n", pwm->label);
 
        return ret;
 }
@@ -114,7 +114,7 @@ static int twl4030_pwmled_enable(struct pwm_chip *chip, struct pwm_device *pwm)
        mutex_lock(&twl->mutex);
        ret = twl_i2c_read_u8(TWL4030_MODULE_LED, &val, TWL4030_LEDEN_REG);
        if (ret < 0) {
-               dev_err(chip->dev, "%s: Failed to read LEDEN\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to read LEDEN\n", pwm->label);
                goto out;
        }
 
@@ -122,7 +122,7 @@ static int twl4030_pwmled_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 
        ret = twl_i2c_write_u8(TWL4030_MODULE_LED, val, TWL4030_LEDEN_REG);
        if (ret < 0)
-               dev_err(chip->dev, "%s: Failed to enable PWM\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to enable PWM\n", pwm->label);
 
 out:
        mutex_unlock(&twl->mutex);
@@ -139,7 +139,7 @@ static void twl4030_pwmled_disable(struct pwm_chip *chip,
        mutex_lock(&twl->mutex);
        ret = twl_i2c_read_u8(TWL4030_MODULE_LED, &val, TWL4030_LEDEN_REG);
        if (ret < 0) {
-               dev_err(chip->dev, "%s: Failed to read LEDEN\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to read LEDEN\n", pwm->label);
                goto out;
        }
 
@@ -147,7 +147,7 @@ static void twl4030_pwmled_disable(struct pwm_chip *chip,
 
        ret = twl_i2c_write_u8(TWL4030_MODULE_LED, val, TWL4030_LEDEN_REG);
        if (ret < 0)
-               dev_err(chip->dev, "%s: Failed to disable PWM\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to disable PWM\n", pwm->label);
 
 out:
        mutex_unlock(&twl->mutex);
@@ -203,7 +203,7 @@ static int twl6030_pwmled_config(struct pwm_chip *chip, struct pwm_device *pwm,
        ret = twl_i2c_write_u8(TWL6030_MODULE_ID1, on_time,
                               TWL6030_LED_PWM_CTRL1);
        if (ret < 0)
-               dev_err(chip->dev, "%s: Failed to configure PWM\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to configure PWM\n", pwm->label);
 
        return ret;
 }
@@ -217,7 +217,7 @@ static int twl6030_pwmled_enable(struct pwm_chip *chip, struct pwm_device *pwm)
        mutex_lock(&twl->mutex);
        ret = twl_i2c_read_u8(TWL6030_MODULE_ID1, &val, TWL6030_LED_PWM_CTRL2);
        if (ret < 0) {
-               dev_err(chip->dev, "%s: Failed to read PWM_CTRL2\n",
+               dev_err(pwmchip_parent(chip), "%s: Failed to read PWM_CTRL2\n",
                        pwm->label);
                goto out;
        }
@@ -227,7 +227,7 @@ static int twl6030_pwmled_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 
        ret = twl_i2c_write_u8(TWL6030_MODULE_ID1, val, TWL6030_LED_PWM_CTRL2);
        if (ret < 0)
-               dev_err(chip->dev, "%s: Failed to enable PWM\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to enable PWM\n", pwm->label);
 
 out:
        mutex_unlock(&twl->mutex);
@@ -244,7 +244,7 @@ static void twl6030_pwmled_disable(struct pwm_chip *chip,
        mutex_lock(&twl->mutex);
        ret = twl_i2c_read_u8(TWL6030_MODULE_ID1, &val, TWL6030_LED_PWM_CTRL2);
        if (ret < 0) {
-               dev_err(chip->dev, "%s: Failed to read PWM_CTRL2\n",
+               dev_err(pwmchip_parent(chip), "%s: Failed to read PWM_CTRL2\n",
                        pwm->label);
                goto out;
        }
@@ -254,7 +254,7 @@ static void twl6030_pwmled_disable(struct pwm_chip *chip,
 
        ret = twl_i2c_write_u8(TWL6030_MODULE_ID1, val, TWL6030_LED_PWM_CTRL2);
        if (ret < 0)
-               dev_err(chip->dev, "%s: Failed to disable PWM\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to disable PWM\n", pwm->label);
 
 out:
        mutex_unlock(&twl->mutex);
@@ -295,7 +295,7 @@ static int twl6030_pwmled_request(struct pwm_chip *chip, struct pwm_device *pwm)
        mutex_lock(&twl->mutex);
        ret = twl_i2c_read_u8(TWL6030_MODULE_ID1, &val, TWL6030_LED_PWM_CTRL2);
        if (ret < 0) {
-               dev_err(chip->dev, "%s: Failed to read PWM_CTRL2\n",
+               dev_err(pwmchip_parent(chip), "%s: Failed to read PWM_CTRL2\n",
                        pwm->label);
                goto out;
        }
@@ -305,7 +305,7 @@ static int twl6030_pwmled_request(struct pwm_chip *chip, struct pwm_device *pwm)
 
        ret = twl_i2c_write_u8(TWL6030_MODULE_ID1, val, TWL6030_LED_PWM_CTRL2);
        if (ret < 0)
-               dev_err(chip->dev, "%s: Failed to request PWM\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to request PWM\n", pwm->label);
 
 out:
        mutex_unlock(&twl->mutex);
@@ -321,7 +321,7 @@ static void twl6030_pwmled_free(struct pwm_chip *chip, struct pwm_device *pwm)
        mutex_lock(&twl->mutex);
        ret = twl_i2c_read_u8(TWL6030_MODULE_ID1, &val, TWL6030_LED_PWM_CTRL2);
        if (ret < 0) {
-               dev_err(chip->dev, "%s: Failed to read PWM_CTRL2\n",
+               dev_err(pwmchip_parent(chip), "%s: Failed to read PWM_CTRL2\n",
                        pwm->label);
                goto out;
        }
@@ -331,7 +331,7 @@ static void twl6030_pwmled_free(struct pwm_chip *chip, struct pwm_device *pwm)
 
        ret = twl_i2c_write_u8(TWL6030_MODULE_ID1, val, TWL6030_LED_PWM_CTRL2);
        if (ret < 0)
-               dev_err(chip->dev, "%s: Failed to free PWM\n", pwm->label);
+               dev_err(pwmchip_parent(chip), "%s: Failed to free PWM\n", pwm->label);
 
 out:
        mutex_unlock(&twl->mutex);