power: supply: ab8500: Convert to dev_pm_ops

Switch over to using generic dev_pm_ops since these
drivers aren't even using the special power state passed
to the legacy call.

Cc: Marcus Cooper <codekipper@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Linus Walleij 2020-12-12 11:57:09 +01:00 committed by Sebastian Reichel
parent ad89cb5f0a
commit f8efa0a881
4 changed files with 28 additions and 48 deletions

View File

@ -936,29 +936,23 @@ static struct ab8500_btemp_interrupts ab8500_btemp_irq[] = {
{"BTEMP_MEDIUM_HIGH", ab8500_btemp_medhigh_handler}, {"BTEMP_MEDIUM_HIGH", ab8500_btemp_medhigh_handler},
}; };
#if defined(CONFIG_PM) static int __maybe_unused ab8500_btemp_resume(struct device *dev)
static int ab8500_btemp_resume(struct platform_device *pdev)
{ {
struct ab8500_btemp *di = platform_get_drvdata(pdev); struct ab8500_btemp *di = dev_get_drvdata(dev);
ab8500_btemp_periodic(di, true); ab8500_btemp_periodic(di, true);
return 0; return 0;
} }
static int ab8500_btemp_suspend(struct platform_device *pdev, static int __maybe_unused ab8500_btemp_suspend(struct device *dev)
pm_message_t state)
{ {
struct ab8500_btemp *di = platform_get_drvdata(pdev); struct ab8500_btemp *di = dev_get_drvdata(dev);
ab8500_btemp_periodic(di, false); ab8500_btemp_periodic(di, false);
return 0; return 0;
} }
#else
#define ab8500_btemp_suspend NULL
#define ab8500_btemp_resume NULL
#endif
static int ab8500_btemp_remove(struct platform_device *pdev) static int ab8500_btemp_remove(struct platform_device *pdev)
{ {
@ -1137,6 +1131,8 @@ free_btemp_wq:
return ret; return ret;
} }
static SIMPLE_DEV_PM_OPS(ab8500_btemp_pm_ops, ab8500_btemp_suspend, ab8500_btemp_resume);
static const struct of_device_id ab8500_btemp_match[] = { static const struct of_device_id ab8500_btemp_match[] = {
{ .compatible = "stericsson,ab8500-btemp", }, { .compatible = "stericsson,ab8500-btemp", },
{ }, { },
@ -1145,11 +1141,10 @@ static const struct of_device_id ab8500_btemp_match[] = {
static struct platform_driver ab8500_btemp_driver = { static struct platform_driver ab8500_btemp_driver = {
.probe = ab8500_btemp_probe, .probe = ab8500_btemp_probe,
.remove = ab8500_btemp_remove, .remove = ab8500_btemp_remove,
.suspend = ab8500_btemp_suspend,
.resume = ab8500_btemp_resume,
.driver = { .driver = {
.name = "ab8500-btemp", .name = "ab8500-btemp",
.of_match_table = ab8500_btemp_match, .of_match_table = ab8500_btemp_match,
.pm = &ab8500_btemp_pm_ops,
}, },
}; };

View File

@ -3209,11 +3209,10 @@ static int ab8500_charger_usb_notifier_call(struct notifier_block *nb,
return NOTIFY_OK; return NOTIFY_OK;
} }
#if defined(CONFIG_PM) static int __maybe_unused ab8500_charger_resume(struct device *dev)
static int ab8500_charger_resume(struct platform_device *pdev)
{ {
int ret; int ret;
struct ab8500_charger *di = platform_get_drvdata(pdev); struct ab8500_charger *di = dev_get_drvdata(dev);
/* /*
* For ABB revision 1.0 and 1.1 there is a bug in the watchdog * For ABB revision 1.0 and 1.1 there is a bug in the watchdog
@ -3247,10 +3246,9 @@ static int ab8500_charger_resume(struct platform_device *pdev)
return 0; return 0;
} }
static int ab8500_charger_suspend(struct platform_device *pdev, static int __maybe_unused ab8500_charger_suspend(struct device *dev)
pm_message_t state)
{ {
struct ab8500_charger *di = platform_get_drvdata(pdev); struct ab8500_charger *di = dev_get_drvdata(dev);
/* Cancel any pending jobs */ /* Cancel any pending jobs */
cancel_delayed_work(&di->check_hw_failure_work); cancel_delayed_work(&di->check_hw_failure_work);
@ -3272,10 +3270,6 @@ static int ab8500_charger_suspend(struct platform_device *pdev,
return 0; return 0;
} }
#else
#define ab8500_charger_suspend NULL
#define ab8500_charger_resume NULL
#endif
static struct notifier_block charger_nb = { static struct notifier_block charger_nb = {
.notifier_call = ab8500_external_charger_prepare, .notifier_call = ab8500_external_charger_prepare,
@ -3658,6 +3652,8 @@ free_charger_wq:
return ret; return ret;
} }
static SIMPLE_DEV_PM_OPS(ab8500_charger_pm_ops, ab8500_charger_suspend, ab8500_charger_resume);
static const struct of_device_id ab8500_charger_match[] = { static const struct of_device_id ab8500_charger_match[] = {
{ .compatible = "stericsson,ab8500-charger", }, { .compatible = "stericsson,ab8500-charger", },
{ }, { },
@ -3666,11 +3662,10 @@ static const struct of_device_id ab8500_charger_match[] = {
static struct platform_driver ab8500_charger_driver = { static struct platform_driver ab8500_charger_driver = {
.probe = ab8500_charger_probe, .probe = ab8500_charger_probe,
.remove = ab8500_charger_remove, .remove = ab8500_charger_remove,
.suspend = ab8500_charger_suspend,
.resume = ab8500_charger_resume,
.driver = { .driver = {
.name = "ab8500-charger", .name = "ab8500-charger",
.of_match_table = ab8500_charger_match, .of_match_table = ab8500_charger_match,
.pm = &ab8500_charger_pm_ops,
}, },
}; };

View File

@ -2942,10 +2942,9 @@ static void ab8500_fg_sysfs_psy_remove_attrs(struct ab8500_fg *di)
/* Exposure to the sysfs interface <<END>> */ /* Exposure to the sysfs interface <<END>> */
#if defined(CONFIG_PM) static int __maybe_unused ab8500_fg_resume(struct device *dev)
static int ab8500_fg_resume(struct platform_device *pdev)
{ {
struct ab8500_fg *di = platform_get_drvdata(pdev); struct ab8500_fg *di = dev_get_drvdata(dev);
/* /*
* Change state if we're not charging. If we're charging we will wake * Change state if we're not charging. If we're charging we will wake
@ -2959,10 +2958,9 @@ static int ab8500_fg_resume(struct platform_device *pdev)
return 0; return 0;
} }
static int ab8500_fg_suspend(struct platform_device *pdev, static int __maybe_unused ab8500_fg_suspend(struct device *dev)
pm_message_t state)
{ {
struct ab8500_fg *di = platform_get_drvdata(pdev); struct ab8500_fg *di = dev_get_drvdata(dev);
flush_delayed_work(&di->fg_periodic_work); flush_delayed_work(&di->fg_periodic_work);
flush_work(&di->fg_work); flush_work(&di->fg_work);
@ -2980,10 +2978,6 @@ static int ab8500_fg_suspend(struct platform_device *pdev,
return 0; return 0;
} }
#else
#define ab8500_fg_suspend NULL
#define ab8500_fg_resume NULL
#endif
static int ab8500_fg_remove(struct platform_device *pdev) static int ab8500_fg_remove(struct platform_device *pdev)
{ {
@ -3244,6 +3238,8 @@ free_inst_curr_wq:
return ret; return ret;
} }
static SIMPLE_DEV_PM_OPS(ab8500_fg_pm_ops, ab8500_fg_suspend, ab8500_fg_resume);
static const struct of_device_id ab8500_fg_match[] = { static const struct of_device_id ab8500_fg_match[] = {
{ .compatible = "stericsson,ab8500-fg", }, { .compatible = "stericsson,ab8500-fg", },
{ }, { },
@ -3252,11 +3248,10 @@ static const struct of_device_id ab8500_fg_match[] = {
static struct platform_driver ab8500_fg_driver = { static struct platform_driver ab8500_fg_driver = {
.probe = ab8500_fg_probe, .probe = ab8500_fg_probe,
.remove = ab8500_fg_remove, .remove = ab8500_fg_remove,
.suspend = ab8500_fg_suspend,
.resume = ab8500_fg_resume,
.driver = { .driver = {
.name = "ab8500-fg", .name = "ab8500-fg",
.of_match_table = ab8500_fg_match, .of_match_table = ab8500_fg_match,
.pm = &ab8500_fg_pm_ops,
}, },
}; };

View File

@ -1913,10 +1913,9 @@ static int abx500_chargalg_sysfs_init(struct abx500_chargalg *di)
} }
/* Exposure to the sysfs interface <<END>> */ /* Exposure to the sysfs interface <<END>> */
#if defined(CONFIG_PM) static int __maybe_unused abx500_chargalg_resume(struct device *dev)
static int abx500_chargalg_resume(struct platform_device *pdev)
{ {
struct abx500_chargalg *di = platform_get_drvdata(pdev); struct abx500_chargalg *di = dev_get_drvdata(dev);
/* Kick charger watchdog if charging (any charger online) */ /* Kick charger watchdog if charging (any charger online) */
if (di->chg_info.online_chg) if (di->chg_info.online_chg)
@ -1931,10 +1930,9 @@ static int abx500_chargalg_resume(struct platform_device *pdev)
return 0; return 0;
} }
static int abx500_chargalg_suspend(struct platform_device *pdev, static int __maybe_unused abx500_chargalg_suspend(struct device *dev)
pm_message_t state)
{ {
struct abx500_chargalg *di = platform_get_drvdata(pdev); struct abx500_chargalg *di = dev_get_drvdata(dev);
if (di->chg_info.online_chg) if (di->chg_info.online_chg)
cancel_delayed_work_sync(&di->chargalg_wd_work); cancel_delayed_work_sync(&di->chargalg_wd_work);
@ -1943,10 +1941,6 @@ static int abx500_chargalg_suspend(struct platform_device *pdev,
return 0; return 0;
} }
#else
#define abx500_chargalg_suspend NULL
#define abx500_chargalg_resume NULL
#endif
static int abx500_chargalg_remove(struct platform_device *pdev) static int abx500_chargalg_remove(struct platform_device *pdev)
{ {
@ -2080,6 +2074,8 @@ free_chargalg_wq:
return ret; return ret;
} }
static SIMPLE_DEV_PM_OPS(abx500_chargalg_pm_ops, abx500_chargalg_suspend, abx500_chargalg_resume);
static const struct of_device_id ab8500_chargalg_match[] = { static const struct of_device_id ab8500_chargalg_match[] = {
{ .compatible = "stericsson,ab8500-chargalg", }, { .compatible = "stericsson,ab8500-chargalg", },
{ }, { },
@ -2088,11 +2084,10 @@ static const struct of_device_id ab8500_chargalg_match[] = {
static struct platform_driver abx500_chargalg_driver = { static struct platform_driver abx500_chargalg_driver = {
.probe = abx500_chargalg_probe, .probe = abx500_chargalg_probe,
.remove = abx500_chargalg_remove, .remove = abx500_chargalg_remove,
.suspend = abx500_chargalg_suspend,
.resume = abx500_chargalg_resume,
.driver = { .driver = {
.name = "ab8500-chargalg", .name = "ab8500-chargalg",
.of_match_table = ab8500_chargalg_match, .of_match_table = ab8500_chargalg_match,
.pm = &abx500_chargalg_pm_ops,
}, },
}; };