usb: Use new pm_ptr() macro
Subsystems (12)
cover usb: Use new pm_ptr() macro
The pm_ptr() macro was introduced to avoid conditional compilation of the PM code. Instead of having the .suspend/.resume functions compiled conditionally if CONFIG_PM_SLEEP, they are now always visible by the compiler, which can then detect bugs, and will be discarded if unused.
Cheers,
-Paul
Paul Cercueil (20):
usb/host: ohci-platform: Use pm_ptr() macro
usb/host: ehci-spear: Use pm_ptr() macro
usb/host: ehci-npcm7xx: Use pm_ptr() macro
usb/host: ehci-platform: Use pm_ptr() macro
usb/cdns3: core: Use pm_ptr() macro
usb/chipidea: core: Use pm_ptr() macro
usb/misc: usb3503: Use pm_ptr() macro
usb/misc: usb4604: Use pm_ptr() macro
usb/musb: am35x: Use pm_ptr() macro
usb/musb: da8xx: Use pm_ptr() macro
usb/musb: musb_dsps: Use pm_ptr() macro
usb/musb: ux500: Use pm_ptr() macro
usb/phy: am335x: Use pm_ptr() macro
usb/phy: mxs-usb: Use pm_ptr() macro
usb/gadget/udc: atmel: Use pm_ptr() macro
usb/gadget/udc: bdc: Use pm_ptr() macro
usb/gadget/udc: mv-u3d: Use pm_ptr() macro
usb/gadget/udc: pch: Use pm_ptr() macro
usb/gadget/udc: renesas: Use pm_ptr() macro
usb/gadget/udc: snps: Use pm_ptr() macro
drivers/usb/cdns3/core.c | 13 ++++--------- drivers/usb/chipidea/core.c | 26 +++++++++++-------------- drivers/usb/gadget/udc/atmel_usba_udc.c | 8 +++----- drivers/usb/gadget/udc/bdc/bdc_core.c | 9 +++------ drivers/usb/gadget/udc/mv_u3d_core.c | 8 +++----- drivers/usb/gadget/udc/pch_udc.c | 11 +++-------- drivers/usb/gadget/udc/renesas_usb3.c | 8 +++----- drivers/usb/gadget/udc/snps_udc_plat.c | 16 +++++---------- drivers/usb/host/ehci-npcm7xx.c | 8 +++----- drivers/usb/host/ehci-platform.c | 8 +++----- drivers/usb/host/ehci-spear.c | 8 +++----- drivers/usb/host/ohci-platform.c | 19 ++++++++---------- drivers/usb/misc/usb3503.c | 18 ++++++++--------- drivers/usb/misc/usb4604.c | 8 +++----- drivers/usb/musb/am35x.c | 8 +++----- drivers/usb/musb/da8xx.c | 8 +++----- drivers/usb/musb/musb_dsps.c | 20 +++++++------------ drivers/usb/musb/ux500.c | 8 +++----- drivers/usb/phy/phy-am335x.c | 8 +++----- drivers/usb/phy/phy-mxs-usb.c | 11 +++++------ 20 files changed, 87 insertions(+), 144 deletions(-)
Signature · 1 line
2.28.0
PATCH 1/20 usb/host: ohci-platform: Use pm_ptr() macro
Use the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/host/ohci-platform.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/usb/host/ohci-platform.c +8 -11
@@ -176,22 +176,21 @@ static int ohci_platform_probe(struct platform_device *dev)if (pdata->num_ports) ohci->num_ports = pdata->num_ports; -#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO -if (ohci->flags &OHCI_QUIRK_BE_MMIO ) { +if (!IS_ENABLED (CONFIG_USB_OHCI_BIG_ENDIAN_MMIO ) && + ohci->flags &OHCI_QUIRK_BE_MMIO ) {dev_err (&dev->dev,"Error: CONFIG_USB_OHCI_BIG_ENDIAN_MMIO not set\n" ); err = -EINVAL ; goto err_reset; } -#endif -#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_DESC -if (ohci->flags &OHCI_QUIRK_BE_DESC ) { + +if (!IS_ENABLED (CONFIG_USB_OHCI_BIG_ENDIAN_DESC ) && + ohci->flags &OHCI_QUIRK_BE_DESC ) {dev_err (&dev->dev,"Error: CONFIG_USB_OHCI_BIG_ENDIAN_DESC not set\n" ); err = -EINVAL ; goto err_reset; } -#endif pm_runtime_set_active (&dev->dev);pm_runtime_enable (&dev->dev);
@@ -267,8 +266,7 @@ static int ohci_platform_remove(struct platform_device *dev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int ohci_platform_suspend (struct device *dev) +static int __maybe_unused ohci_platform_suspend (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct usb_ohci_pdata *pdata = dev->platform_data;
@@ -286,7 +284,7 @@ static int ohci_platform_suspend(struct device *dev)return ret; } -static int ohci_platform_resume (struct device *dev) +static int __maybe_unused ohci_platform_resume (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct usb_ohci_pdata *pdata =dev_get_platdata (dev);
@@ -306,7 +304,6 @@ static int ohci_platform_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ static const struct of_device_id ohci_platform_ids[] = { { .compatible ="generic-ohci" , },
@@ -332,7 +329,7 @@ static struct platform_driver ohci_platform_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "ohci-platform", - .pm = &ohci_platform_pm_ops, + .pm = pm_ptr(&ohci_platform_pm_ops), .of_match_table = ohci_platform_ids, } };
Signature · 1 line
2.28.0
Alan Stern
maintainerRe: [PATCH 01/20] usb/host: ohci-platform: Use pm_ptr() macro
Quoted 33 lines · Paul Cercueil
Use the newly introduced
pm_ptr()macro, and mark the suspend/resume functions__maybe_unused. These functions can then be moved outside theCONFIG_PM_SUSPENDblock, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.Signed-off-by Paul Cercueil <[email protected]>--- drivers/usb/host/ohci-platform.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)drivers/usb/host/ohci-platform.c +4
-5@@ -176,22 +176,21 @@ static int ohci_platform_probe(struct platform_device *dev)if (pdata->num_ports) ohci->num_ports = pdata->num_ports; -#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO -if (ohci->flags &OHCI_QUIRK_BE_MMIO ) { +if (!IS_ENABLED (CONFIG_USB_OHCI_BIG_ENDIAN_MMIO ) && + ohci->flags &OHCI_QUIRK_BE_MMIO ) {dev_err (&dev->dev,"Error: CONFIG_USB_OHCI_BIG_ENDIAN_MMIO not set\n" ); err = -EINVAL ; goto err_reset; } -#endif -#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_DESC -if (ohci->flags &OHCI_QUIRK_BE_DESC ) { + + if (!IS_ENABLED(CONFIG_USB_OHCI_BIG_ENDIAN_DESC) &&
drivers/usb/host/ohci-platform.c static int ohci_platform_probe(struct platform_device *dev) · line 196
Quoted 10 lines
drivers/usb/host/ohci-platform.c +1
-1+ ohci->flags & OHCI_QUIRK_BE_DESC) {dev_err (&dev->dev,"Error: CONFIG_USB_OHCI_BIG_ENDIAN_DESC not set\n" ); err = -EINVAL ; goto err_reset; } -#endif pm_runtime_set_active (&dev->dev);pm_runtime_enable (&dev->dev);
The changes above don't seem to have any connection with the patch description. Please don't mix multiple changes in a single patch.
The rest of the patch is okay.
Alan Stern
Quoted 39 lines
drivers/usb/host/ohci-platform.c +3
-5@@ -267,8 +266,7 @@ static int ohci_platform_remove(struct platform_device *dev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int ohci_platform_suspend (struct device *dev) +static int __maybe_unused ohci_platform_suspend (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct usb_ohci_pdata *pdata = dev->platform_data;@@ -286,7 +284,7 @@ static int ohci_platform_suspend(struct device *dev)return ret; } -static int ohci_platform_resume (struct device *dev) +static int __maybe_unused ohci_platform_resume (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct usb_ohci_pdata *pdata =dev_get_platdata (dev);@@ -306,7 +304,6 @@ static int ohci_platform_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ static const struct of_device_id ohci_platform_ids[] = { { .compatible ="generic-ohci" , },@@ -332,7 +329,7 @@ static struct platform_driver ohci_platform_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "ohci-platform", - .pm = &ohci_platform_pm_ops, + .pm = pm_ptr(&ohci_platform_pm_ops), .of_match_table = ohci_platform_ids, } };Signature · 1 line
2.28.0
PATCH 2/20 usb/host: ehci-spear: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/host/ehci-spear.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/host/ehci-spear.c +3 -5
@@ -34,8 +34,7 @@ struct spear_ehci {static struct hc_driver __read_mostly ehci_spear_hc_driver; -#ifdef CONFIG_PM_SLEEP -static int ehci_spear_drv_suspend (struct device *dev) +static int __maybe_unused ehci_spear_drv_suspend (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);bool do_wakeup =device_may_wakeup (dev);
@@ -43,14 +42,13 @@ static int ehci_spear_drv_suspend(struct device *dev)return ehci_suspend (hcd, do_wakeup); } -static int ehci_spear_drv_resume (struct device *dev) +static int __maybe_unused ehci_spear_drv_resume (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);ehci_resume (hcd, false);return 0 ; } -#endif /* CONFIG_PM_SLEEP */ static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend, ehci_spear_drv_resume);
@@ -155,7 +153,7 @@ static struct platform_driver spear_ehci_hcd_driver = { .driver = { .name = "spear-ehci", .bus = &platform_bus_type, - .pm = &ehci_spear_pm_ops, + .pm = pm_ptr(&ehci_spear_pm_ops), .of_match_table = spear_ehci_id_table, } };
Signature · 7 lines
2.28.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 3/20 usb/host: ehci-npcm7xx: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/host/ehci-npcm7xx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/host/ehci-npcm7xx.c +3 -5
@@ -37,8 +37,7 @@ static const char hcd_name[] = "npcm7xx-ehci";static struct hc_driver __read_mostly ehci_npcm7xx_hc_driver; -#ifdef CONFIG_PM_SLEEP -static int ehci_npcm7xx_drv_suspend (struct device *dev) +static int __maybe_unused ehci_npcm7xx_drv_suspend (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);bool do_wakeup =device_may_wakeup (dev);
@@ -46,14 +45,13 @@ static int ehci_npcm7xx_drv_suspend(struct device *dev)return ehci_suspend (hcd, do_wakeup); } -static int ehci_npcm7xx_drv_resume (struct device *dev) +static int __maybe_unused ehci_npcm7xx_drv_resume (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);ehci_resume (hcd, false);return 0 ; } -#endif /* CONFIG_PM_SLEEP */ static SIMPLE_DEV_PM_OPS(ehci_npcm7xx_pm_ops, ehci_npcm7xx_drv_suspend, ehci_npcm7xx_drv_resume);
@@ -183,7 +181,7 @@ static struct platform_driver npcm7xx_ehci_hcd_driver = { .driver = { .name = "npcm7xx-ehci", .bus = &platform_bus_type, - .pm = &ehci_npcm7xx_pm_ops, + .pm = pm_ptr(&ehci_npcm7xx_pm_ops), .of_match_table = npcm7xx_ehci_id_table, } };
Signature · 7 lines
2.28.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 4/20 usb/host: ehci-platform: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/host/ehci-platform.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/host/ehci-platform.c +3 -5
@@ -410,8 +410,7 @@ static int ehci_platform_remove(struct platform_device *dev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int ehci_platform_suspend (struct device *dev) +static int __maybe_unused ehci_platform_suspend (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct usb_ehci_pdata *pdata =dev_get_platdata (dev);
@@ -433,7 +432,7 @@ static int ehci_platform_suspend(struct device *dev)return ret; } -static int ehci_platform_resume (struct device *dev) +static int __maybe_unused ehci_platform_resume (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct usb_ehci_pdata *pdata =dev_get_platdata (dev);
@@ -464,7 +463,6 @@ static int ehci_platform_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ static const struct of_device_id vt8500_ehci_ids[] = { { .compatible ="via,vt8500-ehci" , },
@@ -499,7 +497,7 @@ static struct platform_driver ehci_platform_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "ehci-platform", - .pm = &ehci_platform_pm_ops, + .pm = pm_ptr(&ehci_platform_pm_ops), .of_match_table = vt8500_ehci_ids, .acpi_match_table = ACPI_PTR(ehci_acpi_match), }
Signature · 7 lines
2.28.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 04/20] usb/host: ehci-platform: Use pm_ptr() macro
Quoted 53 lines · Paul Cercueil
Use the newly introduced
pm_ptr()macro, and mark the suspend/resume functions__maybe_unused. These functions can then be moved outside theCONFIG_PM_SUSPENDblock, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.Signed-off-by Paul Cercueil <[email protected]>--- drivers/usb/host/ehci-platform.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/usb/host/ehci-platform.c +3
-5@@ -410,8 +410,7 @@ static int ehci_platform_remove(struct platform_device *dev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int ehci_platform_suspend (struct device *dev) +static int __maybe_unused ehci_platform_suspend (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct usb_ehci_pdata *pdata =dev_get_platdata (dev);@@ -433,7 +432,7 @@ static int ehci_platform_suspend(struct device *dev)return ret; } -static int ehci_platform_resume (struct device *dev) +static int __maybe_unused ehci_platform_resume (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct usb_ehci_pdata *pdata =dev_get_platdata (dev);@@ -464,7 +463,6 @@ static int ehci_platform_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ static const struct of_device_id vt8500_ehci_ids[] = { { .compatible ="via,vt8500-ehci" , },@@ -499,7 +497,7 @@ static struct platform_driver ehci_platform_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "ehci-platform", - .pm = &ehci_platform_pm_ops, + .pm = pm_ptr(&ehci_platform_pm_ops), .of_match_table = vt8500_ehci_ids, .acpi_match_table = ACPI_PTR(ehci_acpi_match), }Signature · 1 line
2.28.0
For patches 2 - 4:
PATCH 5/20 usb/cdns3: core: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/cdns3/core.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/usb/cdns3/core.c +4 -9
@@ -546,9 +546,7 @@ static int cdns3_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP - -static int cdns3_suspend (struct device *dev) +static int __maybe_unused cdns3_suspend (struct device *dev) {struct cdns3 *cdns =dev_get_drvdata (dev);unsigned long flags;
@@ -568,7 +566,7 @@ static int cdns3_suspend(struct device *dev)return 0 ; } -static int cdns3_resume (struct device *dev) +static int __maybe_unused cdns3_resume (struct device *dev) {struct cdns3 *cdns =dev_get_drvdata (dev);unsigned long flags;
@@ -588,11 +586,8 @@ static int cdns3_resume(struct device *dev)return 0 ; } -#endif -static const struct dev_pm_ops cdns3_pm_ops = { -SET_SYSTEM_SLEEP_PM_OPS (cdns3_suspend, cdns3_resume) -}; +static SIMPLE_DEV_PM_OPS(cdns3_pm_ops, cdns3_suspend, cdns3_resume);#ifdef CONFIG_OF static const struct of_device_id of_cdns3_match[] = {
@@ -608,7 +603,7 @@ static struct platform_driver cdns3_driver = { .driver = { .name = "cdns-usb3", .of_match_table = of_match_ptr(of_cdns3_match), - .pm = &cdns3_pm_ops, + .pm = pm_ptr(&cdns3_pm_ops), }, };
Signature · 7 lines
2.28.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 6/20 usb/chipidea: core: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/chipidea/core.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
drivers/usb/chipidea/core.c +11 -15
@@ -1231,9 +1231,8 @@ static int ci_hdrc_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM /* Prepare wakeup by SRP before suspend */ -static void ci_otg_fsm_suspend_for_srp (struct ci_hdrc *ci) +static void __maybe_unused ci_otg_fsm_suspend_for_srp (struct ci_hdrc *ci) {if ((ci->fsm.otg->state ==OTG_STATE_A_IDLE ) && !hw_read_otgsc (ci,OTGSC_ID )) {
@@ -1245,7 +1244,7 @@ static void ci_otg_fsm_suspend_for_srp(struct ci_hdrc *ci) }/* Handle SRP when wakeup by data pulse */ -static void ci_otg_fsm_wakeup_by_srp (struct ci_hdrc *ci) +static void __maybe_unused ci_otg_fsm_wakeup_by_srp (struct ci_hdrc *ci) {if ((ci->fsm.otg->state ==OTG_STATE_A_IDLE ) && (ci->fsm.a_bus_drop ==1 ) && (ci->fsm.a_bus_req ==0 )) {
@@ -1259,7 +1258,7 @@ static void ci_otg_fsm_wakeup_by_srp(struct ci_hdrc *ci) } } -static void ci_controller_suspend (struct ci_hdrc *ci) +static void __maybe_unused ci_controller_suspend (struct ci_hdrc *ci) {disable_irq (ci->irq);ci_hdrc_enter_lpm (ci, true);
@@ -1277,7 +1276,7 @@ static void ci_controller_suspend(struct ci_hdrc *ci)* interrupt (wakeup int) only let the controller be out of * low power mode, but not handle any interrupts. */ -static void ci_extcon_wakeup_int (struct ci_hdrc *ci) +static void __maybe_unused ci_extcon_wakeup_int (struct ci_hdrc *ci) {struct ci_hdrc_cable *cable_id, *cable_vbus;u32 otgsc =hw_read_otgsc (ci, ~0 );
@@ -1294,7 +1293,7 @@ static void ci_extcon_wakeup_int(struct ci_hdrc *ci)ci_irq (ci->irq, ci); } -static int ci_controller_resume (struct device *dev) +static int __maybe_unused ci_controller_resume (struct device *dev) {struct ci_hdrc *ci =dev_get_drvdata (dev);int ret;
@@ -1332,8 +1331,7 @@ static int ci_controller_resume(struct device *dev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int ci_suspend (struct device *dev) +static int __maybe_unused ci_suspend (struct device *dev) {struct ci_hdrc *ci =dev_get_drvdata (dev);
@@ -1366,7 +1364,7 @@ static int ci_suspend(struct device *dev)return 0 ; } -static int ci_resume (struct device *dev) +static int __maybe_unused ci_resume (struct device *dev) {struct ci_hdrc *ci =dev_get_drvdata (dev);int ret;
@@ -1386,9 +1384,8 @@ static int ci_resume(struct device *dev)return ret; } -#endif /* CONFIG_PM_SLEEP */ -static int ci_runtime_suspend (struct device *dev) +static int __maybe_unused ci_runtime_suspend (struct device *dev) {struct ci_hdrc *ci =dev_get_drvdata (dev);
@@ -1408,13 +1405,12 @@ static int ci_runtime_suspend(struct device *dev)return 0 ; } -static int ci_runtime_resume (struct device *dev) +static int __maybe_unused ci_runtime_resume (struct device *dev) {return ci_controller_resume (dev); } -#endif /* CONFIG_PM */ -static const struct dev_pm_ops ci_pm_ops = { +static const struct dev_pm_ops __maybe_unused ci_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(ci_suspend, ci_resume)SET_RUNTIME_PM_OPS (ci_runtime_suspend, ci_runtime_resume,NULL ) };
@@ -1424,7 +1420,7 @@ static struct platform_driver ci_hdrc_driver = { .remove = ci_hdrc_remove, .driver = { .name = "ci_hdrc", - .pm = &ci_pm_ops, + .pm = pm_ptr(&ci_pm_ops), .dev_groups = ci_groups, }, };
Signature · 7 lines
2.28.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 06/20] usb/chipidea: core: Use pm_ptr() macro
Quoted 5 lines · Paul Cercueil
Use the newly introduced
pm_ptr()macro, and mark the suspend/resume functions__maybe_unused. These functions can then be moved outside theCONFIG_PM_SUSPENDblock, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
For using __maybe_unused or using MACRO, it depends. The chipidea core has many functions are only used for power management, you need to add __maybe_unused for everyone of them, I still prefer using MACRO.
Peter
Quoted 115 lines
Signed-off-by Paul Cercueil <[email protected]>--- drivers/usb/chipidea/core.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)drivers/usb/chipidea/core.c +11
-15@@ -1231,9 +1231,8 @@ static int ci_hdrc_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM /* Prepare wakeup by SRP before suspend */ -static void ci_otg_fsm_suspend_for_srp (struct ci_hdrc *ci) +static void __maybe_unused ci_otg_fsm_suspend_for_srp (struct ci_hdrc *ci) {if ((ci->fsm.otg->state ==OTG_STATE_A_IDLE ) && !hw_read_otgsc (ci,OTGSC_ID )) {@@ -1245,7 +1244,7 @@ static void ci_otg_fsm_suspend_for_srp(struct ci_hdrc *ci) }/* Handle SRP when wakeup by data pulse */ -static void ci_otg_fsm_wakeup_by_srp (struct ci_hdrc *ci) +static void __maybe_unused ci_otg_fsm_wakeup_by_srp (struct ci_hdrc *ci) {if ((ci->fsm.otg->state ==OTG_STATE_A_IDLE ) && (ci->fsm.a_bus_drop ==1 ) && (ci->fsm.a_bus_req ==0 )) {@@ -1259,7 +1258,7 @@ static void ci_otg_fsm_wakeup_by_srp(struct ci_hdrc *ci) } } -static void ci_controller_suspend (struct ci_hdrc *ci) +static void __maybe_unused ci_controller_suspend (struct ci_hdrc *ci) {disable_irq (ci->irq);ci_hdrc_enter_lpm (ci, true);@@ -1277,7 +1276,7 @@ static void ci_controller_suspend(struct ci_hdrc *ci)* interrupt (wakeup int) only let the controller be out of * low power mode, but not handle any interrupts. */ -static void ci_extcon_wakeup_int (struct ci_hdrc *ci) +static void __maybe_unused ci_extcon_wakeup_int (struct ci_hdrc *ci) {struct ci_hdrc_cable *cable_id, *cable_vbus;u32 otgsc =hw_read_otgsc (ci, ~0 );@@ -1294,7 +1293,7 @@ static void ci_extcon_wakeup_int(struct ci_hdrc *ci)ci_irq (ci->irq, ci); } -static int ci_controller_resume (struct device *dev) +static int __maybe_unused ci_controller_resume (struct device *dev) {struct ci_hdrc *ci =dev_get_drvdata (dev);int ret;@@ -1332,8 +1331,7 @@ static int ci_controller_resume(struct device *dev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int ci_suspend (struct device *dev) +static int __maybe_unused ci_suspend (struct device *dev) {struct ci_hdrc *ci =dev_get_drvdata (dev);@@ -1366,7 +1364,7 @@ static int ci_suspend(struct device *dev)return 0 ; } -static int ci_resume (struct device *dev) +static int __maybe_unused ci_resume (struct device *dev) {struct ci_hdrc *ci =dev_get_drvdata (dev);int ret;@@ -1386,9 +1384,8 @@ static int ci_resume(struct device *dev)return ret; } -#endif /* CONFIG_PM_SLEEP */ -static int ci_runtime_suspend (struct device *dev) +static int __maybe_unused ci_runtime_suspend (struct device *dev) {struct ci_hdrc *ci =dev_get_drvdata (dev);@@ -1408,13 +1405,12 @@ static int ci_runtime_suspend(struct device *dev)return 0 ; } -static int ci_runtime_resume (struct device *dev) +static int __maybe_unused ci_runtime_resume (struct device *dev) {return ci_controller_resume (dev); } -#endif /* CONFIG_PM */ -static const struct dev_pm_ops ci_pm_ops = { +static const struct dev_pm_ops __maybe_unused ci_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(ci_suspend, ci_resume)SET_RUNTIME_PM_OPS (ci_runtime_suspend, ci_runtime_resume,NULL ) };@@ -1424,7 +1420,7 @@ static struct platform_driver ci_hdrc_driver = { .remove = ci_hdrc_remove, .driver = { .name = "ci_hdrc", - .pm = &ci_pm_ops, + .pm = pm_ptr(&ci_pm_ops), .dev_groups = ci_groups, }, };Signature · 1 line
2.28.0
Signature · 2 lines
Thanks, Peter Chen
PATCH 7/20 usb/misc: usb3503: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/misc/usb3503.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/usb/misc/usb3503.c +8 -10
@@ -322,8 +322,7 @@ static int usb3503_platform_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int usb3503_suspend (struct usb3503 *hub) +static int __maybe_unused usb3503_suspend (struct usb3503 *hub) {usb3503_switch_mode (hub,USB3503_MODE_STANDBY );clk_disable_unprepare (hub->clk);
@@ -331,7 +330,7 @@ static int usb3503_suspend(struct usb3503 *hub)return 0 ; } -static int usb3503_resume (struct usb3503 *hub) +static int __maybe_unused usb3503_resume (struct usb3503 *hub) {clk_prepare_enable (hub->clk);usb3503_switch_mode (hub, hub->mode);
@@ -339,30 +338,29 @@ static int usb3503_resume(struct usb3503 *hub)return 0 ; } -static int usb3503_i2c_suspend (struct device *dev) +static int __maybe_unused usb3503_i2c_suspend (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);return usb3503_suspend (i2c_get_clientdata (client)); } -static int usb3503_i2c_resume (struct device *dev) +static int __maybe_unused usb3503_i2c_resume (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);return usb3503_resume (i2c_get_clientdata (client)); } -static int usb3503_platform_suspend (struct device *dev) +static int __maybe_unused usb3503_platform_suspend (struct device *dev) {return usb3503_suspend (dev_get_drvdata (dev)); } -static int usb3503_platform_resume (struct device *dev) +static int __maybe_unused usb3503_platform_resume (struct device *dev) {return usb3503_resume (dev_get_drvdata (dev)); } -#endif static SIMPLE_DEV_PM_OPS(usb3503_i2c_pm_ops, usb3503_i2c_suspend, usb3503_i2c_resume);
@@ -388,7 +386,7 @@ MODULE_DEVICE_TABLE(of, usb3503_of_match);static struct i2c_driver usb3503_i2c_driver = { .driver = { .name =USB3503_I2C_NAME , - .pm = &usb3503_i2c_pm_ops, + .pm =pm_ptr (&usb3503_i2c_pm_ops), .of_match_table =of_match_ptr (usb3503_of_match), }, .probe = usb3503_i2c_probe,
@@ -400,7 +398,7 @@ static struct platform_driver usb3503_platform_driver = { .driver = { .name = USB3503_I2C_NAME, .of_match_table = of_match_ptr(usb3503_of_match), - .pm = &usb3503_platform_pm_ops, + .pm = pm_ptr(&usb3503_platform_pm_ops), }, .probe = usb3503_platform_probe, .remove = usb3503_platform_remove,
Signature · 1 line
2.28.0
PATCH 8/20 usb/misc: usb4604: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/misc/usb4604.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/misc/usb4604.c +3 -5
@@ -112,8 +112,7 @@ static int usb4604_i2c_probe(struct i2c_client *i2c,return usb4604_probe (hub); } -#ifdef CONFIG_PM_SLEEP -static int usb4604_i2c_suspend (struct device *dev) +static int __maybe_unused usb4604_i2c_suspend (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);struct usb4604 *hub =i2c_get_clientdata (client);
@@ -123,7 +122,7 @@ static int usb4604_i2c_suspend(struct device *dev)return 0 ; } -static int usb4604_i2c_resume (struct device *dev) +static int __maybe_unused usb4604_i2c_resume (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);struct usb4604 *hub =i2c_get_clientdata (client);
@@ -132,7 +131,6 @@ static int usb4604_i2c_resume(struct device *dev)return 0 ; } -#endif static SIMPLE_DEV_PM_OPS(usb4604_i2c_pm_ops, usb4604_i2c_suspend, usb4604_i2c_resume);
@@ -154,7 +152,7 @@ MODULE_DEVICE_TABLE(of, usb4604_of_match);static struct i2c_driver usb4604_i2c_driver = { .driver = { .name ="usb4604" , - .pm = &usb4604_i2c_pm_ops, + .pm =pm_ptr (&usb4604_i2c_pm_ops), .of_match_table =of_match_ptr (usb4604_of_match), }, .probe = usb4604_i2c_probe,
Signature · 1 line
2.28.0
PATCH 9/20 usb/musb: am35x: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/musb/am35x.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/musb/am35x.c +3 -5
@@ -547,8 +547,7 @@ static int am35x_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int am35x_suspend (struct device *dev) +static int __maybe_unused am35x_suspend (struct device *dev) {struct am35x_glue *glue =dev_get_drvdata (dev);struct musb_hdrc_platform_data *plat =dev_get_platdata (dev);
@@ -564,7 +563,7 @@ static int am35x_suspend(struct device *dev)return 0 ; } -static int am35x_resume (struct device *dev) +static int __maybe_unused am35x_resume (struct device *dev) {struct am35x_glue *glue =dev_get_drvdata (dev);struct musb_hdrc_platform_data *plat =dev_get_platdata (dev);
@@ -589,7 +588,6 @@ static int am35x_resume(struct device *dev)return 0 ; } -#endif static SIMPLE_DEV_PM_OPS(am35x_pm_ops, am35x_suspend, am35x_resume);
@@ -598,7 +596,7 @@ static struct platform_driver am35x_driver = { .remove = am35x_remove, .driver = { .name = "musb-am35x", - .pm = &am35x_pm_ops, + .pm = pm_ptr(&am35x_pm_ops), }, };
Signature · 1 line
2.28.0
PATCH 10/20 usb/musb: da8xx: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/musb/da8xx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/musb/da8xx.c +3 -5
@@ -598,8 +598,7 @@ static int da8xx_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int da8xx_suspend (struct device *dev) +static int __maybe_unused da8xx_suspend (struct device *dev) {int ret;struct da8xx_glue *glue =dev_get_drvdata (dev);
@@ -612,7 +611,7 @@ static int da8xx_suspend(struct device *dev)return 0 ; } -static int da8xx_resume (struct device *dev) +static int __maybe_unused da8xx_resume (struct device *dev) {int ret;struct da8xx_glue *glue =dev_get_drvdata (dev);
@@ -622,7 +621,6 @@ static int da8xx_resume(struct device *dev)return ret;return phy_power_on (glue->phy); } -#endif static SIMPLE_DEV_PM_OPS(da8xx_pm_ops, da8xx_suspend, da8xx_resume);
@@ -641,7 +639,7 @@ static struct platform_driver da8xx_driver = { .remove = da8xx_remove, .driver = { .name = "musb-da8xx", - .pm = &da8xx_pm_ops, + .pm = pm_ptr(&da8xx_pm_ops), .of_match_table = of_match_ptr(da8xx_id_table), }, };
Signature · 1 line
2.28.0
PATCH 11/20 usb/musb: musb_dsps: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/musb/musb_dsps.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/usb/musb/musb_dsps.c +7 -13
@@ -665,26 +665,22 @@ dsps_dma_controller_create(struct musb *musb, void __iomem *base)return controller; } -#ifdef CONFIG_PM_SLEEP -static void dsps_dma_controller_suspend (struct dsps_glue *glue) +static void __maybe_unused dsps_dma_controller_suspend (struct dsps_glue *glue) {void __iomem *usbss_base = glue->usbss_base;musb_writel (usbss_base,USBSS_IRQ_CLEARR ,USBSS_IRQ_PD_COMP ); } -static void dsps_dma_controller_resume (struct dsps_glue *glue) +static void __maybe_unused dsps_dma_controller_resume (struct dsps_glue *glue) {void __iomem *usbss_base = glue->usbss_base;musb_writel (usbss_base,USBSS_IRQ_ENABLER ,USBSS_IRQ_PD_COMP ); } -#endif #else /* CONFIG_USB_TI_CPPI41_DMA */ -#ifdef CONFIG_PM_SLEEP -static void dsps_dma_controller_suspend (struct dsps_glue *glue) {} -static void dsps_dma_controller_resume (struct dsps_glue *glue) {} -#endif +static void __maybe_unused dsps_dma_controller_suspend (struct dsps_glue *glue) {} +static void __maybe_unused dsps_dma_controller_resume (struct dsps_glue *glue) {}#endif /* CONFIG_USB_TI_CPPI41_DMA */ static struct musb_platform_ops dsps_ops = {
@@ -961,8 +957,7 @@ static const struct of_device_id musb_dsps_of_match[] = { };MODULE_DEVICE_TABLE (of, musb_dsps_of_match); -#ifdef CONFIG_PM_SLEEP -static int dsps_suspend (struct device *dev) +static int __maybe_unused dsps_suspend (struct device *dev) {struct dsps_glue *glue =dev_get_drvdata (dev);const struct dsps_musb_wrapper *wrp = glue->wrp;
@@ -996,7 +991,7 @@ static int dsps_suspend(struct device *dev)return 0 ; } -static int dsps_resume (struct device *dev) +static int __maybe_unused dsps_resume (struct device *dev) {struct dsps_glue *glue =dev_get_drvdata (dev);const struct dsps_musb_wrapper *wrp = glue->wrp;
@@ -1024,7 +1019,6 @@ static int dsps_resume(struct device *dev)return 0 ; } -#endif static SIMPLE_DEV_PM_OPS(dsps_pm_ops, dsps_suspend, dsps_resume);
@@ -1033,7 +1027,7 @@ static struct platform_driver dsps_usbss_driver = { .remove = dsps_remove, .driver = { .name = "musb-dsps", - .pm = &dsps_pm_ops, + .pm = pm_ptr(&dsps_pm_ops), .of_match_table = musb_dsps_of_match, }, };
Signature · 1 line
2.28.0
PATCH 12/20 usb/musb: ux500: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/musb/ux500.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/musb/ux500.c +3 -5
@@ -327,8 +327,7 @@ static int ux500_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int ux500_suspend (struct device *dev) +static int __maybe_unused ux500_suspend (struct device *dev) {struct ux500_glue *glue =dev_get_drvdata (dev);struct musb *musb =glue_to_musb (glue);
@@ -341,7 +340,7 @@ static int ux500_suspend(struct device *dev)return 0 ; } -static int ux500_resume (struct device *dev) +static int __maybe_unused ux500_resume (struct device *dev) {struct ux500_glue *glue =dev_get_drvdata (dev);struct musb *musb =glue_to_musb (glue);
@@ -358,7 +357,6 @@ static int ux500_resume(struct device *dev)return 0 ; } -#endif static SIMPLE_DEV_PM_OPS(ux500_pm_ops, ux500_suspend, ux500_resume);
@@ -374,7 +372,7 @@ static struct platform_driver ux500_driver = { .remove = ux500_remove, .driver = { .name = "musb-ux500", - .pm = &ux500_pm_ops, + .pm = pm_ptr(&ux500_pm_ops), .of_match_table = ux500_match, }, };
Signature · 1 line
2.28.0
PATCH 13/20 usb/phy: am335x: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/phy/phy-am335x.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/phy/phy-am335x.c +3 -5
@@ -90,8 +90,7 @@ static int am335x_phy_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int am335x_phy_suspend (struct device *dev) +static int __maybe_unused am335x_phy_suspend (struct device *dev) {struct am335x_phy *am_phy =dev_get_drvdata (dev);
@@ -111,7 +110,7 @@ static int am335x_phy_suspend(struct device *dev)return 0 ; } -static int am335x_phy_resume (struct device *dev) +static int __maybe_unused am335x_phy_resume (struct device *dev) {struct am335x_phy *am_phy =dev_get_drvdata (dev);
@@ -122,7 +121,6 @@ static int am335x_phy_resume(struct device *dev)return 0 ; } -#endif static SIMPLE_DEV_PM_OPS(am335x_pm_ops, am335x_phy_suspend, am335x_phy_resume);
@@ -137,7 +135,7 @@ static struct platform_driver am335x_phy_driver = { .remove = am335x_phy_remove, .driver = { .name = "am335x-phy-driver", - .pm = &am335x_pm_ops, + .pm = pm_ptr(&am335x_pm_ops), .of_match_table = am335x_phy_ids, }, };
Signature · 1 line
2.28.0
PATCH 14/20 usb/phy: mxs-usb: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/phy/phy-mxs-usb.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/usb/phy/phy-mxs-usb.c +5 -6
@@ -815,8 +815,8 @@ static int mxs_phy_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static void mxs_phy_enable_ldo_in_suspend (struct mxs_phy *mxs_phy,bool on) +static void __maybe_unused +mxs_phy_enable_ldo_in_suspend (struct mxs_phy *mxs_phy,bool on) {unsigned int reg = on ?ANADIG_ANA_MISC0_SET :ANADIG_ANA_MISC0_CLR ;
@@ -832,7 +832,7 @@ static void mxs_phy_enable_ldo_in_suspend(struct mxs_phy *mxs_phy, bool on) reg, BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG_SL); } -static int mxs_phy_system_suspend (struct device *dev) +static int __maybe_unused mxs_phy_system_suspend (struct device *dev) {struct mxs_phy *mxs_phy =dev_get_drvdata (dev);
@@ -842,7 +842,7 @@ static int mxs_phy_system_suspend(struct device *dev)return 0 ; } -static int mxs_phy_system_resume (struct device *dev) +static int __maybe_unused mxs_phy_system_resume (struct device *dev) {struct mxs_phy *mxs_phy =dev_get_drvdata (dev);
@@ -851,7 +851,6 @@ static int mxs_phy_system_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ static SIMPLE_DEV_PM_OPS(mxs_phy_pm, mxs_phy_system_suspend, mxs_phy_system_resume);
@@ -862,7 +861,7 @@ static struct platform_driver mxs_phy_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = mxs_phy_dt_ids, - .pm = &mxs_phy_pm, + .pm = pm_ptr(&mxs_phy_pm), }, };
Signature · 1 line
2.28.0
Re: [PATCH 14/20] usb/phy: mxs-usb: Use pm_ptr() macro
Quoted 54 lines · Paul Cercueil
Use the newly introduced
pm_ptr()macro, and mark the suspend/resume functions__maybe_unused. These functions can then be moved outside theCONFIG_PM_SUSPENDblock, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.Signed-off-by Paul Cercueil <[email protected]>--- drivers/usb/phy/phy-mxs-usb.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)drivers/usb/phy/phy-mxs-usb.c +4
-5@@ -815,8 +815,8 @@ static int mxs_phy_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static void mxs_phy_enable_ldo_in_suspend (struct mxs_phy *mxs_phy,bool on) +static void __maybe_unused +mxs_phy_enable_ldo_in_suspend (struct mxs_phy *mxs_phy,bool on) {unsigned int reg = on ?ANADIG_ANA_MISC0_SET :ANADIG_ANA_MISC0_CLR ;@@ -832,7 +832,7 @@ static void mxs_phy_enable_ldo_in_suspend(struct mxs_phy *mxs_phy, bool on) reg, BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG_SL); } -static int mxs_phy_system_suspend (struct device *dev) +static int __maybe_unused mxs_phy_system_suspend (struct device *dev) {struct mxs_phy *mxs_phy =dev_get_drvdata (dev);@@ -842,7 +842,7 @@ static int mxs_phy_system_suspend(struct device *dev)return 0 ; } -static int mxs_phy_system_resume (struct device *dev) +static int __maybe_unused mxs_phy_system_resume (struct device *dev) {struct mxs_phy *mxs_phy =dev_get_drvdata (dev);@@ -851,7 +851,6 @@ static int mxs_phy_system_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ static SIMPLE_DEV_PM_OPS(mxs_phy_pm, mxs_phy_system_suspend, mxs_phy_system_resume);
drivers/usb/phy/phy-mxs-usb.c static struct platform_driver mxs_phy_driver = { · line 867
Quoted 8 lines
drivers/usb/phy/phy-mxs-usb.c +1
-1@@ -862,7 +861,7 @@ static struct platform_driver mxs_phy_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = mxs_phy_dt_ids, - .pm = &mxs_phy_pm, + .pm = pm_ptr(&mxs_phy_pm), }, };
Signature · 2 lines
Thanks, Peter Chen
Re: [PATCH 14/20] usb/phy: mxs-usb: Use pm_ptr() macro
In reply to Paul CercueilQuoted 8 lines · Paul Cercueil
Use the newly introduced
pm_ptr()macro, and mark the suspend/resume functions__maybe_unused. These functions can then be moved outside theCONFIG_PM_SUSPENDblock, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.Signed-off-by Paul Cercueil <[email protected]>---
Signature · 1 line
balbi
PATCH 15/20 usb/gadget/udc: atmel: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/gadget/udc/atmel_usba_udc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/atmel_usba_udc.c +3 -5
@@ -2359,8 +2359,7 @@ static int usba_udc_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int usba_udc_suspend (struct device *dev) +static int __maybe_unused usba_udc_suspend (struct device *dev) {struct usba_udc *udc =dev_get_drvdata (dev);
@@ -2393,7 +2392,7 @@ static int usba_udc_suspend(struct device *dev)return 0 ; } -static int usba_udc_resume (struct device *dev) +static int __maybe_unused usba_udc_resume (struct device *dev) {struct usba_udc *udc =dev_get_drvdata (dev);
@@ -2417,7 +2416,6 @@ static int usba_udc_resume(struct device *dev)return 0 ; } -#endif static SIMPLE_DEV_PM_OPS(usba_udc_pm_ops, usba_udc_suspend, usba_udc_resume);
@@ -2425,7 +2423,7 @@ static struct platform_driver udc_driver = { .remove = usba_udc_remove, .driver = { .name = "atmel_usba_udc", - .pm = &usba_udc_pm_ops, + .pm = pm_ptr(&usba_udc_pm_ops), .of_match_table = atmel_udc_dt_ids, }, };
Signature · 1 line
2.28.0
PATCH 16/20 usb/gadget/udc: bdc: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/gadget/udc/bdc/bdc_core.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/usb/gadget/udc/bdc/bdc_core.c +3 -6
@@ -597,8 +597,7 @@ static int bdc_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int bdc_suspend (struct device *dev) +static int __maybe_unused bdc_suspend (struct device *dev) {struct bdc *bdc =dev_get_drvdata (dev);int ret;
@@ -611,7 +610,7 @@ static int bdc_suspend(struct device *dev)return ret; } -static int bdc_resume (struct device *dev) +static int __maybe_unused bdc_resume (struct device *dev) {struct bdc *bdc =dev_get_drvdata (dev);int ret;
@@ -630,8 +629,6 @@ static int bdc_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ - static SIMPLE_DEV_PM_OPS(bdc_pm_ops, bdc_suspend, bdc_resume);
@@ -644,7 +641,7 @@ static const struct of_device_id bdc_of_match[] = {static struct platform_driver bdc_driver = { .driver = { .name =BRCM_BDC_NAME , - .pm = &bdc_pm_ops, + .pm =pm_ptr (&bdc_pm_ops), .of_match_table = bdc_of_match, }, .probe = bdc_probe,
Signature · 1 line
2.28.0
PATCH 17/20 usb/gadget/udc: mv-u3d: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/gadget/udc/mv_u3d_core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/mv_u3d_core.c +3 -5
@@ -1988,8 +1988,7 @@ static int mv_u3d_probe(struct platform_device *dev)return retval; } -#ifdef CONFIG_PM_SLEEP -static int mv_u3d_suspend (struct device *dev) +static int __maybe_unused mv_u3d_suspend (struct device *dev) {struct mv_u3d *u3d =dev_get_drvdata (dev);
@@ -2012,7 +2011,7 @@ static int mv_u3d_suspend(struct device *dev)return 0 ; } -static int mv_u3d_resume (struct device *dev) +static int __maybe_unused mv_u3d_resume (struct device *dev) {struct mv_u3d *u3d =dev_get_drvdata (dev);int retval;
@@ -2031,7 +2030,6 @@ static int mv_u3d_resume(struct device *dev)return 0 ; } -#endif static SIMPLE_DEV_PM_OPS(mv_u3d_pm_ops, mv_u3d_suspend, mv_u3d_resume);
@@ -2051,7 +2049,7 @@ static struct platform_driver mv_u3d_driver = { .shutdown = mv_u3d_shutdown, .driver = { .name = "mv-u3d", - .pm = &mv_u3d_pm_ops, + .pm = pm_ptr(&mv_u3d_pm_ops), }, };
Signature · 1 line
2.28.0
PATCH 18/20 usb/gadget/udc: pch: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/gadget/udc/pch_udc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/usb/gadget/udc/pch_udc.c +3 -8
@@ -3042,8 +3042,7 @@ static void pch_udc_remove(struct pci_dev *pdev)pch_udc_exit (dev); } -#ifdef CONFIG_PM_SLEEP -static int pch_udc_suspend (struct device *d) +static int __maybe_unused pch_udc_suspend (struct device *d) {struct pch_udc_dev *dev =dev_get_drvdata (d);
@@ -3053,16 +3052,12 @@ static int pch_udc_suspend(struct device *d)return 0 ; } -static int pch_udc_resume (struct device *d) +static int __maybe_unused pch_udc_resume (struct device *d) {return 0 ; } static SIMPLE_DEV_PM_OPS(pch_udc_pm, pch_udc_suspend, pch_udc_resume); -#define PCH_UDC_PM_OPS (&pch_udc_pm) -#else -#define PCH_UDC_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ static int pch_udc_probe (struct pci_dev *pdev,const struct pci_device_id *id)
@@ -3171,7 +3166,7 @@ static struct pci_driver pch_udc_driver = { .remove = pch_udc_remove, .shutdown = pch_udc_shutdown, .driver = { - .pm = PCH_UDC_PM_OPS, + .pm = pm_ptr(&pch_udc_pm), }, };
Signature · 1 line
2.28.0
PATCH 19/20 usb/gadget/udc: renesas: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/gadget/udc/renesas_usb3.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/renesas_usb3.c +3 -5
@@ -2867,8 +2867,7 @@ static int renesas_usb3_probe(struct platform_device *pdev)return ret; } -#ifdef CONFIG_PM_SLEEP -static int renesas_usb3_suspend (struct device *dev) +static int __maybe_unused renesas_usb3_suspend (struct device *dev) {struct renesas_usb3 *usb3 =dev_get_drvdata (dev);
@@ -2884,7 +2883,7 @@ static int renesas_usb3_suspend(struct device *dev)return 0 ; } -static int renesas_usb3_resume (struct device *dev) +static int __maybe_unused renesas_usb3_resume (struct device *dev) {struct renesas_usb3 *usb3 =dev_get_drvdata (dev);
@@ -2899,7 +2898,6 @@ static int renesas_usb3_resume(struct device *dev)return 0 ; } -#endif static SIMPLE_DEV_PM_OPS(renesas_usb3_pm_ops, renesas_usb3_suspend, renesas_usb3_resume);
@@ -2909,7 +2907,7 @@ static struct platform_driver renesas_usb3_driver = { .remove = renesas_usb3_remove, .driver = { .name = udc_name, - .pm = &renesas_usb3_pm_ops, + .pm = pm_ptr(&renesas_usb3_pm_ops), .of_match_table = of_match_ptr(usb3_of_match), }, };
Signature · 1 line
2.28.0
PATCH 20/20 usb/gadget/udc: snps: Use pm_ptr() macro
In reply to Paul CercueilUse the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler.
--- drivers/usb/gadget/udc/snps_udc_plat.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/usb/gadget/udc/snps_udc_plat.c +5 -11
@@ -257,8 +257,7 @@ static int udc_plat_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int udc_plat_suspend (struct device *dev) +static int __maybe_unused udc_plat_suspend (struct device *dev) {struct udc *udc;
@@ -275,7 +274,7 @@ static int udc_plat_suspend(struct device *dev)return 0 ; } -static int udc_plat_resume (struct device *dev) +static int __maybe_unused udc_plat_resume (struct device *dev) {struct udc *udc;int ret;
@@ -302,11 +301,8 @@ static int udc_plat_resume(struct device *dev)return 0 ; } -static const struct dev_pm_ops udc_plat_pm_ops = { - .suspend = udc_plat_suspend, - .resume = udc_plat_resume, -}; -#endif + +static SIMPLE_DEV_PM_OPS(plat_pm_ops, udc_plat_suspend, udc_plat_resume);#if defined(CONFIG_OF ) static const struct of_device_id of_udc_match[] = {
@@ -324,9 +320,7 @@ static struct platform_driver udc_plat_driver = { .driver = { .name = "snps-udc-plat", .of_match_table = of_match_ptr(of_udc_match), -#ifdef CONFIG_PM_SLEEP - .pm = &udc_plat_pm_ops, -#endif + .pm = pm_ptr(&udc_plat_pm_ops), }, };module_platform_driver (udc_plat_driver);
Signature · 1 line
2.28.0