Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gpio: htc-egpio: Use modern PM macros

Use the modern PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Link: https://lore.kernel.org/r/20251124002105.25429-4-jszhang@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Jisheng Zhang and committed by
Bartosz Golaszewski
2557b1f4 56f3a6d7

+8 -13
+8 -13
drivers/gpio/gpio-htc-egpio.c
··· 364 364 return 0; 365 365 } 366 366 367 - #ifdef CONFIG_PM 368 - static int egpio_suspend(struct platform_device *pdev, pm_message_t state) 367 + static int egpio_suspend(struct device *dev) 369 368 { 370 - struct egpio_info *ei = platform_get_drvdata(pdev); 369 + struct egpio_info *ei = dev_get_drvdata(dev); 371 370 372 - if (ei->chained_irq && device_may_wakeup(&pdev->dev)) 371 + if (ei->chained_irq && device_may_wakeup(dev)) 373 372 enable_irq_wake(ei->chained_irq); 374 373 return 0; 375 374 } 376 375 377 - static int egpio_resume(struct platform_device *pdev) 376 + static int egpio_resume(struct device *dev) 378 377 { 379 - struct egpio_info *ei = platform_get_drvdata(pdev); 378 + struct egpio_info *ei = dev_get_drvdata(dev); 380 379 381 - if (ei->chained_irq && device_may_wakeup(&pdev->dev)) 380 + if (ei->chained_irq && device_may_wakeup(dev)) 382 381 disable_irq_wake(ei->chained_irq); 383 382 384 383 /* Update registers from the cache, in case ··· 385 386 egpio_write_cache(ei); 386 387 return 0; 387 388 } 388 - #else 389 - #define egpio_suspend NULL 390 - #define egpio_resume NULL 391 - #endif 392 389 390 + static DEFINE_SIMPLE_DEV_PM_OPS(egpio_pm_ops, egpio_suspend, egpio_resume); 393 391 394 392 static struct platform_driver egpio_driver = { 395 393 .driver = { 396 394 .name = "htc-egpio", 397 395 .suppress_bind_attrs = true, 396 + .pm = pm_sleep_ptr(&egpio_pm_ops), 398 397 }, 399 - .suspend = egpio_suspend, 400 - .resume = egpio_resume, 401 398 }; 402 399 403 400 static int __init egpio_init(void)