Message ID | 20220324103443.4563-1-hesham.almatary@huawei.com |
---|---|
State | Accepted |
Commit | 7bb732fea3944171afa45b4a71298f822589c8a6 |
Headers | show |
Series | thermal:hisi_termal: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() | expand |
Hi Hesham, Le jeu., mars 24 2022 at 10:34:43 +0000, Hesham Almatary <hesham.almatary@huawei.com> a écrit : > Cleaning up the driver to use pm_sleep_ptr() macro instead of #ifdef > guards is simpler and allows the compiler to remove those functions > if built without CONFIG_PM_SLEEP support. > > Signed-off-by: Hesham Almatary <hesham.almatary@huawei.com> Looks good. Reviewed-by: Paul Cercueil <paul@crapouillou.net> Cheers, -Paul > --- > drivers/thermal/hisi_thermal.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/thermal/hisi_thermal.c > b/drivers/thermal/hisi_thermal.c > index 9a21ac0ceb11..b29ab09040d5 100644 > --- a/drivers/thermal/hisi_thermal.c > +++ b/drivers/thermal/hisi_thermal.c > @@ -629,7 +629,6 @@ static int hisi_thermal_remove(struct > platform_device *pdev) > return 0; > } > > -#ifdef CONFIG_PM_SLEEP > static int hisi_thermal_suspend(struct device *dev) > { > struct hisi_thermal_data *data = dev_get_drvdata(dev); > @@ -651,15 +650,14 @@ static int hisi_thermal_resume(struct device > *dev) > > return ret; > } > -#endif > > -static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, > +static DEFINE_SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, > hisi_thermal_suspend, hisi_thermal_resume); > > static struct platform_driver hisi_thermal_driver = { > .driver = { > .name = "hisi_thermal", > - .pm = &hisi_thermal_pm_ops, > + .pm = pm_sleep_ptr(&hisi_thermal_pm_ops), > .of_match_table = of_hisi_thermal_match, > }, > .probe = hisi_thermal_probe, > -- > 2.25.1 >
On Thu, Mar 24, 2022 at 1:11 PM Paul Cercueil <paul@crapouillou.net> wrote: > > Hi Hesham, > > Le jeu., mars 24 2022 at 10:34:43 +0000, Hesham Almatary > <hesham.almatary@huawei.com> a écrit : > > Cleaning up the driver to use pm_sleep_ptr() macro instead of #ifdef > > guards is simpler and allows the compiler to remove those functions > > if built without CONFIG_PM_SLEEP support. > > > > Signed-off-by: Hesham Almatary <hesham.almatary@huawei.com> > > Looks good. > > Reviewed-by: Paul Cercueil <paul@crapouillou.net> And applied as 5.19 material, thanks! > > --- > > drivers/thermal/hisi_thermal.c | 6 ++---- > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/thermal/hisi_thermal.c > > b/drivers/thermal/hisi_thermal.c > > index 9a21ac0ceb11..b29ab09040d5 100644 > > --- a/drivers/thermal/hisi_thermal.c > > +++ b/drivers/thermal/hisi_thermal.c > > @@ -629,7 +629,6 @@ static int hisi_thermal_remove(struct > > platform_device *pdev) > > return 0; > > } > > > > -#ifdef CONFIG_PM_SLEEP > > static int hisi_thermal_suspend(struct device *dev) > > { > > struct hisi_thermal_data *data = dev_get_drvdata(dev); > > @@ -651,15 +650,14 @@ static int hisi_thermal_resume(struct device > > *dev) > > > > return ret; > > } > > -#endif > > > > -static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, > > +static DEFINE_SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, > > hisi_thermal_suspend, hisi_thermal_resume); > > > > static struct platform_driver hisi_thermal_driver = { > > .driver = { > > .name = "hisi_thermal", > > - .pm = &hisi_thermal_pm_ops, > > + .pm = pm_sleep_ptr(&hisi_thermal_pm_ops), > > .of_match_table = of_hisi_thermal_match, > > }, > > .probe = hisi_thermal_probe, > > -- > > 2.25.1 > > > >
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 9a21ac0ceb11..b29ab09040d5 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -629,7 +629,6 @@ static int hisi_thermal_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int hisi_thermal_suspend(struct device *dev) { struct hisi_thermal_data *data = dev_get_drvdata(dev); @@ -651,15 +650,14 @@ static int hisi_thermal_resume(struct device *dev) return ret; } -#endif -static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, +static DEFINE_SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, hisi_thermal_suspend, hisi_thermal_resume); static struct platform_driver hisi_thermal_driver = { .driver = { .name = "hisi_thermal", - .pm = &hisi_thermal_pm_ops, + .pm = pm_sleep_ptr(&hisi_thermal_pm_ops), .of_match_table = of_hisi_thermal_match, }, .probe = hisi_thermal_probe,
Cleaning up the driver to use pm_sleep_ptr() macro instead of #ifdef guards is simpler and allows the compiler to remove those functions if built without CONFIG_PM_SLEEP support. Signed-off-by: Hesham Almatary <hesham.almatary@huawei.com> --- drivers/thermal/hisi_thermal.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)