diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-09-04 16:07:06 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-09-06 08:50:48 +0200 |
commit | 6b5e97c020060c2b8ad286002415106ab7034435 (patch) | |
tree | 86987f5fb0a8c46c00bda981fa2eac23ab0c8ba3 /drivers/gpio | |
parent | gpio: xilinx: Use helper function devm_clk_get_optional_enabled() (diff) | |
download | linux-6b5e97c020060c2b8ad286002415106ab7034435.tar.xz linux-6b5e97c020060c2b8ad286002415106ab7034435.zip |
gpio: mpc8xxx: switch to using DEFINE_RUNTIME_DEV_PM_OPS()
Use the preferred API for assigning system sleep pm callbacks in drivers.
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240904140706.70359-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-mpc8xxx.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index e084e08f5438..685ec31db409 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -17,6 +17,8 @@ #include <linux/mod_devicetable.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/pm.h> +#include <linux/pm_runtime.h> #include <linux/property.h> #include <linux/slab.h> #include <linux/spinlock.h> @@ -431,30 +433,28 @@ static void mpc8xxx_remove(struct platform_device *pdev) } } -#ifdef CONFIG_PM -static int mpc8xxx_suspend(struct platform_device *pdev, pm_message_t state) +static int mpc8xxx_suspend(struct device *dev) { - struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev); + struct mpc8xxx_gpio_chip *mpc8xxx_gc = dev_get_drvdata(dev); - if (mpc8xxx_gc->irqn && device_may_wakeup(&pdev->dev)) + if (mpc8xxx_gc->irqn && device_may_wakeup(dev)) enable_irq_wake(mpc8xxx_gc->irqn); return 0; } -static int mpc8xxx_resume(struct platform_device *pdev) +static int mpc8xxx_resume(struct device *dev) { - struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev); + struct mpc8xxx_gpio_chip *mpc8xxx_gc = dev_get_drvdata(dev); - if (mpc8xxx_gc->irqn && device_may_wakeup(&pdev->dev)) + if (mpc8xxx_gc->irqn && device_may_wakeup(dev)) disable_irq_wake(mpc8xxx_gc->irqn); return 0; } -#else -#define mpc8xxx_suspend NULL -#define mpc8xxx_resume NULL -#endif + +static DEFINE_RUNTIME_DEV_PM_OPS(mpc8xx_pm_ops, + mpc8xxx_suspend, mpc8xxx_resume, NULL); #ifdef CONFIG_ACPI static const struct acpi_device_id gpio_acpi_ids[] = { @@ -467,12 +467,11 @@ MODULE_DEVICE_TABLE(acpi, gpio_acpi_ids); static struct platform_driver mpc8xxx_plat_driver = { .probe = mpc8xxx_probe, .remove_new = mpc8xxx_remove, - .suspend = mpc8xxx_suspend, - .resume = mpc8xxx_resume, .driver = { .name = "gpio-mpc8xxx", .of_match_table = mpc8xxx_gpio_ids, .acpi_match_table = ACPI_PTR(gpio_acpi_ids), + .pm = pm_ptr(&mpc8xx_pm_ops), }, }; |