]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
pwm: Drop pwm_[sg]et_chip_data()
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 5 Jul 2023 08:06:50 +0000 (10:06 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 13 Oct 2023 08:07:17 +0000 (10:07 +0200)
The semantic of chip_data is a bit surprising as it's cleared when
pwm_put() is called. Also there is a big overlap with the standard driver
data.

All drivers were adapted to not make use of chip_data any more, so it can
go away.

Link: https://lore.kernel.org/r/20230705080650.2353391-9-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/core.c
include/linux/pwm.h

index a2824eb4e236dc97fce47086dcb14c898ba4980e..29078486534d40323015ca255c2b5d5328854b4f 100644 (file)
@@ -208,36 +208,6 @@ static void of_pwmchip_remove(struct pwm_chip *chip)
                of_node_put(chip->dev->of_node);
 }
 
-/**
- * pwm_set_chip_data() - set private chip data for a PWM
- * @pwm: PWM device
- * @data: pointer to chip-specific data
- *
- * Returns: 0 on success or a negative error code on failure.
- */
-int pwm_set_chip_data(struct pwm_device *pwm, void *data)
-{
-       if (!pwm)
-               return -EINVAL;
-
-       pwm->chip_data = data;
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(pwm_set_chip_data);
-
-/**
- * pwm_get_chip_data() - get private chip data for a PWM
- * @pwm: PWM device
- *
- * Returns: A pointer to the chip-private data for the PWM device.
- */
-void *pwm_get_chip_data(struct pwm_device *pwm)
-{
-       return pwm ? pwm->chip_data : NULL;
-}
-EXPORT_SYMBOL_GPL(pwm_get_chip_data);
-
 static bool pwm_ops_check(const struct pwm_chip *chip)
 {
        const struct pwm_ops *ops = chip->ops;
@@ -980,7 +950,6 @@ void pwm_put(struct pwm_device *pwm)
        if (pwm->chip->ops->free)
                pwm->chip->ops->free(pwm->chip, pwm);
 
-       pwm_set_chip_data(pwm, NULL);
        pwm->label = NULL;
 
        module_put(pwm->chip->owner);
index 56e3b7a09824ae1a9a689646d90103ec42b5d848..e3b437587b32d7d84d5f367d6643b3c1fa1ce702 100644 (file)
@@ -71,7 +71,6 @@ struct pwm_state {
  * @hwpwm: per-chip relative index of the PWM device
  * @pwm: global index of the PWM device
  * @chip: PWM chip providing this PWM device
- * @chip_data: chip-private data associated with the PWM device
  * @args: PWM arguments
  * @state: last applied state
  * @last: last implemented state (for PWM_DEBUG)
@@ -82,7 +81,6 @@ struct pwm_device {
        unsigned int hwpwm;
        unsigned int pwm;
        struct pwm_chip *chip;
-       void *chip_data;
 
        struct pwm_args args;
        struct pwm_state state;
@@ -383,8 +381,6 @@ static inline void pwm_disable(struct pwm_device *pwm)
 /* PWM provider APIs */
 int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result,
                unsigned long timeout);
-int pwm_set_chip_data(struct pwm_device *pwm, void *data);
-void *pwm_get_chip_data(struct pwm_device *pwm);
 
 int __pwmchip_add(struct pwm_chip *chip, struct module *owner);
 #define pwmchip_add(chip) __pwmchip_add(chip, THIS_MODULE)
@@ -447,16 +443,6 @@ static inline int pwm_capture(struct pwm_device *pwm,
        return -EINVAL;
 }
 
-static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data)
-{
-       return -EINVAL;
-}
-
-static inline void *pwm_get_chip_data(struct pwm_device *pwm)
-{
-       return NULL;
-}
-
 static inline int pwmchip_add(struct pwm_chip *chip)
 {
        return -EINVAL;