mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
drivers: misc: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
Convert the deprecated SIMPLE_DEV_PM_OPS to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr(). This lets us drop the __maybe_unused annotations from the suspend and resume callbacks, also reduces kernel size in case CONFIG_PM or CONFIG_PM_SLEEP is disabled. Also allow to remove #ifdef CONFIG_PM_SLEEP. Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://patch.msgid.link/20260821121315.23574-1-triet.hoang.dev@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6edddc1d10
commit
80195a4358
|
|
@ -188,7 +188,6 @@ static void alcor_pci_remove(struct pci_dev *pdev)
|
|||
pci_set_drvdata(pdev, NULL);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int alcor_suspend(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -203,9 +202,8 @@ static int alcor_resume(struct device *dev)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(alcor_pci_pm_ops, alcor_suspend, alcor_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(alcor_pci_pm_ops, alcor_suspend, alcor_resume);
|
||||
|
||||
static struct pci_driver alcor_driver = {
|
||||
.name = DRV_NAME_ALCOR_PCI,
|
||||
|
|
@ -213,7 +211,7 @@ static struct pci_driver alcor_driver = {
|
|||
.probe = alcor_pci_probe,
|
||||
.remove = alcor_pci_remove,
|
||||
.driver = {
|
||||
.pm = &alcor_pci_pm_ops
|
||||
.pm = pm_sleep_ptr(&alcor_pci_pm_ops)
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void cb710_set_irq_handler(struct cb710_slot *slot,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(cb710_set_irq_handler);
|
||||
|
||||
static int __maybe_unused cb710_suspend(struct device *dev_d)
|
||||
static int cb710_suspend(struct device *dev_d)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev_d);
|
||||
struct cb710_chip *chip = pci_get_drvdata(pdev);
|
||||
|
|
@ -175,7 +175,7 @@ static int __maybe_unused cb710_suspend(struct device *dev_d)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused cb710_resume(struct device *dev_d)
|
||||
static int cb710_resume(struct device *dev_d)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev_d);
|
||||
struct cb710_chip *chip = pci_get_drvdata(pdev);
|
||||
|
|
@ -296,14 +296,14 @@ static const struct pci_device_id cb710_pci_tbl[] = {
|
|||
{ }
|
||||
};
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(cb710_pm_ops, cb710_suspend, cb710_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(cb710_pm_ops, cb710_suspend, cb710_resume);
|
||||
|
||||
static struct pci_driver cb710_driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.id_table = cb710_pci_tbl,
|
||||
.probe = cb710_probe,
|
||||
.remove = cb710_remove_one,
|
||||
.driver.pm = &cb710_pm_ops,
|
||||
.driver.pm = pm_sleep_ptr(&cb710_pm_ops),
|
||||
};
|
||||
|
||||
static int __init cb710_init_module(void)
|
||||
|
|
|
|||
|
|
@ -416,7 +416,6 @@ static void isl29003_remove(struct i2c_client *client)
|
|||
kfree(i2c_get_clientdata(client));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int isl29003_suspend(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
|
|
@ -441,12 +440,7 @@ static int isl29003_resume(struct device *dev)
|
|||
data->power_state_before_suspend);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(isl29003_pm_ops, isl29003_suspend, isl29003_resume);
|
||||
#define ISL29003_PM_OPS (&isl29003_pm_ops)
|
||||
|
||||
#else
|
||||
#define ISL29003_PM_OPS NULL
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(isl29003_pm_ops, isl29003_suspend, isl29003_resume);
|
||||
|
||||
static const struct i2c_device_id isl29003_id[] = {
|
||||
{ .name = "isl29003" },
|
||||
|
|
@ -457,7 +451,7 @@ MODULE_DEVICE_TABLE(i2c, isl29003_id);
|
|||
static struct i2c_driver isl29003_driver = {
|
||||
.driver = {
|
||||
.name = ISL29003_DRV_NAME,
|
||||
.pm = ISL29003_PM_OPS,
|
||||
.pm = pm_sleep_ptr(&isl29003_pm_ops),
|
||||
},
|
||||
.probe = isl29003_probe,
|
||||
.remove = isl29003_remove,
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ static void lis302dl_spi_remove(struct spi_device *spi)
|
|||
lis3lv02d_remove_fs(&lis3_dev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int lis3lv02d_spi_suspend(struct device *dev)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
|
|
@ -127,15 +126,14 @@ static int lis3lv02d_spi_resume(struct device *dev)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(lis3lv02d_spi_pm, lis3lv02d_spi_suspend,
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(lis3lv02d_spi_pm, lis3lv02d_spi_suspend,
|
||||
lis3lv02d_spi_resume);
|
||||
|
||||
static struct spi_driver lis302dl_spi_driver = {
|
||||
.driver = {
|
||||
.name = DRV_NAME,
|
||||
.pm = &lis3lv02d_spi_pm,
|
||||
.pm = pm_sleep_ptr(&lis3lv02d_spi_pm),
|
||||
.of_match_table = of_match_ptr(lis302dl_spi_dt_ids),
|
||||
},
|
||||
.probe = lis302dl_spi_probe,
|
||||
|
|
|
|||
|
|
@ -705,14 +705,14 @@ static void pch_phub_remove(struct pci_dev *pdev)
|
|||
kfree(chip);
|
||||
}
|
||||
|
||||
static int __maybe_unused pch_phub_suspend(struct device *dev_d)
|
||||
static int pch_phub_suspend(struct device *dev_d)
|
||||
{
|
||||
device_wakeup_disable(dev_d);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused pch_phub_resume(struct device *dev_d)
|
||||
static int pch_phub_resume(struct device *dev_d)
|
||||
{
|
||||
device_wakeup_disable(dev_d);
|
||||
|
||||
|
|
@ -729,14 +729,14 @@ static const struct pci_device_id pch_phub_pcidev_id[] = {
|
|||
};
|
||||
MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id);
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(pch_phub_pm_ops, pch_phub_suspend, pch_phub_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(pch_phub_pm_ops, pch_phub_suspend, pch_phub_resume);
|
||||
|
||||
static struct pci_driver pch_phub_driver = {
|
||||
.name = "pch_phub",
|
||||
.id_table = pch_phub_pcidev_id,
|
||||
.probe = pch_phub_probe,
|
||||
.remove = pch_phub_remove,
|
||||
.driver.pm = &pch_phub_pm_ops,
|
||||
.driver.pm = pm_sleep_ptr(&pch_phub_pm_ops),
|
||||
};
|
||||
|
||||
module_pci_driver(pch_phub_driver);
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ static void phantom_remove(struct pci_dev *pdev)
|
|||
pci_disable_device(pdev);
|
||||
}
|
||||
|
||||
static int __maybe_unused phantom_suspend(struct device *dev_d)
|
||||
static int phantom_suspend(struct device *dev_d)
|
||||
{
|
||||
struct phantom_device *dev = dev_get_drvdata(dev_d);
|
||||
|
||||
|
|
@ -471,7 +471,7 @@ static int __maybe_unused phantom_suspend(struct device *dev_d)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused phantom_resume(struct device *dev_d)
|
||||
static int phantom_resume(struct device *dev_d)
|
||||
{
|
||||
struct phantom_device *dev = dev_get_drvdata(dev_d);
|
||||
|
||||
|
|
@ -488,14 +488,14 @@ static struct pci_device_id phantom_pci_tbl[] = {
|
|||
};
|
||||
MODULE_DEVICE_TABLE(pci, phantom_pci_tbl);
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(phantom_pm_ops, phantom_suspend, phantom_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(phantom_pm_ops, phantom_suspend, phantom_resume);
|
||||
|
||||
static struct pci_driver phantom_pci_driver = {
|
||||
.name = "phantom",
|
||||
.id_table = phantom_pci_tbl,
|
||||
.probe = phantom_probe,
|
||||
.remove = phantom_remove,
|
||||
.driver.pm = &phantom_pm_ops,
|
||||
.driver.pm = pm_sleep_ptr(&phantom_pm_ops),
|
||||
};
|
||||
|
||||
static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION);
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
|
|||
spin_unlock_irqrestore(&fm->lock, flags);
|
||||
}
|
||||
|
||||
static int __maybe_unused tifm_7xx1_suspend(struct device *dev_d)
|
||||
static int tifm_7xx1_suspend(struct device *dev_d)
|
||||
{
|
||||
struct pci_dev *dev = to_pci_dev(dev_d);
|
||||
struct tifm_adapter *fm = pci_get_drvdata(dev);
|
||||
|
|
@ -224,7 +224,7 @@ static int __maybe_unused tifm_7xx1_suspend(struct device *dev_d)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused tifm_7xx1_resume(struct device *dev_d)
|
||||
static int tifm_7xx1_resume(struct device *dev_d)
|
||||
{
|
||||
struct pci_dev *dev = to_pci_dev(dev_d);
|
||||
struct tifm_adapter *fm = pci_get_drvdata(dev);
|
||||
|
|
@ -406,14 +406,14 @@ static const struct pci_device_id tifm_7xx1_pci_tbl[] = {
|
|||
{ }
|
||||
};
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(tifm_7xx1_pm_ops, tifm_7xx1_suspend, tifm_7xx1_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(tifm_7xx1_pm_ops, tifm_7xx1_suspend, tifm_7xx1_resume);
|
||||
|
||||
static struct pci_driver tifm_7xx1_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.id_table = tifm_7xx1_pci_tbl,
|
||||
.probe = tifm_7xx1_probe,
|
||||
.remove = tifm_7xx1_remove,
|
||||
.driver.pm = &tifm_7xx1_pm_ops,
|
||||
.driver.pm = pm_sleep_ptr(&tifm_7xx1_pm_ops),
|
||||
};
|
||||
|
||||
module_pci_driver(tifm_7xx1_driver);
|
||||
|
|
|
|||
|
|
@ -398,8 +398,6 @@ static void tsl2550_remove(struct i2c_client *client)
|
|||
kfree(i2c_get_clientdata(client));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
||||
static int tsl2550_suspend(struct device *dev)
|
||||
{
|
||||
return tsl2550_set_power_state(to_i2c_client(dev), 0);
|
||||
|
|
@ -410,14 +408,7 @@ static int tsl2550_resume(struct device *dev)
|
|||
return tsl2550_set_power_state(to_i2c_client(dev), 1);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(tsl2550_pm_ops, tsl2550_suspend, tsl2550_resume);
|
||||
#define TSL2550_PM_OPS (&tsl2550_pm_ops)
|
||||
|
||||
#else
|
||||
|
||||
#define TSL2550_PM_OPS NULL
|
||||
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(tsl2550_pm_ops, tsl2550_suspend, tsl2550_resume);
|
||||
|
||||
static const struct i2c_device_id tsl2550_id[] = {
|
||||
{ .name = "tsl2550" },
|
||||
|
|
@ -435,7 +426,7 @@ static struct i2c_driver tsl2550_driver = {
|
|||
.driver = {
|
||||
.name = TSL2550_DRV_NAME,
|
||||
.of_match_table = tsl2550_of_match,
|
||||
.pm = TSL2550_PM_OPS,
|
||||
.pm = pm_sleep_ptr(&tsl2550_pm_ops),
|
||||
},
|
||||
.probe = tsl2550_probe,
|
||||
.remove = tsl2550_remove,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user