Input: misc - Use dev_get_drvdata
Subsystems (2)
PATCH 1/1 Input: misc - Use dev_get_drvdata
dev_get_drvdata is a simpler implementation comparing to to_platform_device + platform_get_drvdata. This makes the code simpler.
Signed-off-by Chuhong Yuan <[email protected]>
--- drivers/input/misc/gpio-vibra.c | 6 ++---- drivers/input/misc/max77693-haptic.c | 6 ++---- drivers/input/misc/max8925_onkey.c | 10 ++++------ drivers/input/misc/max8997_haptic.c | 3 +-- drivers/input/misc/msm-vibrator.c | 6 ++---- drivers/input/misc/palmas-pwrbutton.c | 6 ++---- drivers/input/misc/regulator-haptic.c | 6 ++---- drivers/input/misc/stpmic1_onkey.c | 6 ++---- drivers/input/misc/twl4030-vibra.c | 3 +-- drivers/input/misc/twl6040-vibra.c | 3 +-- 10 files changed, 19 insertions(+), 36 deletions(-)
drivers/input/misc/gpio-vibra.c +2 -4
@@ -159,8 +159,7 @@ static int gpio_vibrator_probe(struct platform_device *pdev)static int __maybe_unused gpio_vibrator_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct gpio_vibrator *vibrator =platform_get_drvdata (pdev); +struct gpio_vibrator *vibrator =dev_get_drvdata (dev);cancel_work_sync (&vibrator->play_work);if (vibrator->running)
@@ -171,8 +170,7 @@ static int __maybe_unused gpio_vibrator_suspend(struct device *dev)static int __maybe_unused gpio_vibrator_resume (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct gpio_vibrator *vibrator =platform_get_drvdata (pdev); +struct gpio_vibrator *vibrator =dev_get_drvdata (dev);if (vibrator->running)gpio_vibrator_start (vibrator);
drivers/input/misc/max77693-haptic.c +2 -4
@@ -377,8 +377,7 @@ static int max77693_haptic_probe(struct platform_device *pdev)static int __maybe_unused max77693_haptic_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct max77693_haptic *haptic =platform_get_drvdata (pdev); +struct max77693_haptic *haptic =dev_get_drvdata (dev);if (haptic->enabled) {max77693_haptic_disable (haptic);
@@ -390,8 +389,7 @@ static int __maybe_unused max77693_haptic_suspend(struct device *dev)static int __maybe_unused max77693_haptic_resume (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct max77693_haptic *haptic =platform_get_drvdata (pdev); +struct max77693_haptic *haptic =dev_get_drvdata (dev);if (haptic->suspend_state) {max77693_haptic_enable (haptic);
drivers/input/misc/max8925_onkey.c +4 -6
@@ -135,9 +135,8 @@ static int max8925_onkey_probe(struct platform_device *pdev)static int __maybe_unused max8925_onkey_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct max8925_onkey_info *info =platform_get_drvdata (pdev); -struct max8925_chip *chip =dev_get_drvdata (pdev->dev.parent); +struct max8925_onkey_info *info =dev_get_drvdata (dev); +struct max8925_chip *chip =dev_get_drvdata (dev->parent);if (device_may_wakeup (dev)) { chip->wakeup_flag |=1 << info->irq[0 ];
@@ -149,9 +148,8 @@ static int __maybe_unused max8925_onkey_suspend(struct device *dev)static int __maybe_unused max8925_onkey_resume (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct max8925_onkey_info *info =platform_get_drvdata (pdev); -struct max8925_chip *chip =dev_get_drvdata (pdev->dev.parent); +struct max8925_onkey_info *info =dev_get_drvdata (dev); +struct max8925_chip *chip =dev_get_drvdata (dev->parent);if (device_may_wakeup (dev)) { chip->wakeup_flag &= ~(1 << info->irq[0 ]);
drivers/input/misc/max8997_haptic.c +1 -2
@@ -374,8 +374,7 @@ static int max8997_haptic_remove(struct platform_device *pdev)static int __maybe_unused max8997_haptic_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct max8997_haptic *chip =platform_get_drvdata (pdev); +struct max8997_haptic *chip =dev_get_drvdata (dev);max8997_haptic_disable (chip);
drivers/input/misc/msm-vibrator.c +2 -4
@@ -234,8 +234,7 @@ static int msm_vibrator_probe(struct platform_device *pdev)static int __maybe_unused msm_vibrator_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct msm_vibrator *vibrator =platform_get_drvdata (pdev); +struct msm_vibrator *vibrator =dev_get_drvdata (dev);cancel_work_sync (&vibrator->worker);
@@ -247,8 +246,7 @@ static int __maybe_unused msm_vibrator_suspend(struct device *dev)static int __maybe_unused msm_vibrator_resume (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct msm_vibrator *vibrator =platform_get_drvdata (pdev); +struct msm_vibrator *vibrator =dev_get_drvdata (dev);if (vibrator->enabled)msm_vibrator_start (vibrator);
drivers/input/misc/palmas-pwrbutton.c +2 -4
@@ -270,8 +270,7 @@ static int palmas_pwron_remove(struct platform_device *pdev)*/ static int __maybe_unused palmas_pwron_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct palmas_pwron *pwron =platform_get_drvdata (pdev); +struct palmas_pwron *pwron =dev_get_drvdata (dev);cancel_delayed_work_sync (&pwron->input_work);
@@ -291,8 +290,7 @@ static int __maybe_unused palmas_pwron_suspend(struct device *dev)*/ static int __maybe_unused palmas_pwron_resume (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct palmas_pwron *pwron =platform_get_drvdata (pdev); +struct palmas_pwron *pwron =dev_get_drvdata (dev);if (device_may_wakeup (dev))disable_irq_wake (pwron->irq);
drivers/input/misc/regulator-haptic.c +2 -4
@@ -203,8 +203,7 @@ static int regulator_haptic_probe(struct platform_device *pdev)static int __maybe_unused regulator_haptic_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct regulator_haptic *haptic =platform_get_drvdata (pdev); +struct regulator_haptic *haptic =dev_get_drvdata (dev);int error; error =mutex_lock_interruptible (&haptic->mutex);
@@ -222,8 +221,7 @@ static int __maybe_unused regulator_haptic_suspend(struct device *dev)static int __maybe_unused regulator_haptic_resume (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct regulator_haptic *haptic =platform_get_drvdata (pdev); +struct regulator_haptic *haptic =dev_get_drvdata (dev);unsigned int magnitude;mutex_lock (&haptic->mutex);
drivers/input/misc/stpmic1_onkey.c +2 -4
@@ -150,8 +150,7 @@ static int stpmic1_onkey_probe(struct platform_device *pdev)static int __maybe_unused stpmic1_onkey_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct stpmic1_onkey *onkey =platform_get_drvdata (pdev); +struct stpmic1_onkey *onkey =dev_get_drvdata (dev);if (device_may_wakeup (dev)) {enable_irq_wake (onkey->irq_falling);
@@ -162,8 +161,7 @@ static int __maybe_unused stpmic1_onkey_suspend(struct device *dev)static int __maybe_unused stpmic1_onkey_resume (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct stpmic1_onkey *onkey =platform_get_drvdata (pdev); +struct stpmic1_onkey *onkey =dev_get_drvdata (dev);if (device_may_wakeup (dev)) {disable_irq_wake (onkey->irq_falling);
drivers/input/misc/twl4030-vibra.c +1 -2
@@ -145,8 +145,7 @@ static void twl4030_vibra_close(struct input_dev *input)/*** Module ***/ static int __maybe_unused twl4030_vibra_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct vibra_info *info =platform_get_drvdata (pdev); +struct vibra_info *info =dev_get_drvdata (dev);if (info->enabled)vibra_disable (info);
drivers/input/misc/twl6040-vibra.c +1 -2
@@ -212,8 +212,7 @@ static void twl6040_vibra_close(struct input_dev *input)static int __maybe_unused twl6040_vibra_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct vibra_info *info =platform_get_drvdata (pdev); +struct vibra_info *info =dev_get_drvdata (dev);cancel_work_sync (&info->play_work);
Signature · 1 line
2.20.1