Skip to contentSkip to conversation

usb: dwc3-pci: Ensure system sleep PM ops are defined only when used

PATCH In review Mark Brown 4 participants 6 messages Aug 6, 2013 – Aug 9, 2013

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 usb: dwc3-pci: Ensure system sleep PM ops are defined only when used

From: Andy Green <[email protected]>

You might have CONFIG_PM, but you might not have CONFIG_SUSPEND, in which case these are unused.

---
 drivers/usb/dwc3/dwc3-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-pci.c +1 -1
index 5d746e5..4902021 100644
@@ -191,7 +191,7 @@ static DEFINE_PCI_DEVICE_TABLE(dwc3_pci_id_table) = {
 };
 MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_SUSPEND
 static int dwc3_pci_suspend(struct device *dev)
 {
 	struct pci_dev	*pci = to_pci_dev(dev);
Signature · 1 line
1.8.4.rc1
#1 lore raw

Hi Mark,

Quoted 7 lines · Mark Brown

From: Andy Green <[email protected]>

You might have CONFIG_PM, but you might not have CONFIG_SUSPEND, in which case these are unused.

What about doing this instead?

drivers/usb/dwc3/dwc3-pci.c +5 -10
@@ -191,7 +191,7 @@ static DEFINE_PCI_DEVICE_TABLE(dwc3_pci_id_table) = {
 };
 MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int dwc3_pci_suspend(struct device *dev)
 {
        struct pci_dev  *pci = to_pci_dev(dev);
@@ -216,15 +216,10 @@ static int dwc3_pci_resume(struct device *dev)
 
        return 0;
 }
+#endif /* CONFIG_PM_SLEEP */
 
-static const struct dev_pm_ops dwc3_pci_dev_pm_ops = {
-       SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_suspend, dwc3_pci_resume)
-};
-
-#define DEV_PM_OPS     (&dwc3_pci_dev_pm_ops)
-#else
-#define DEV_PM_OPS     NULL
-#endif /* CONFIG_PM */
+static SIMPLE_DEV_PM_OPS(dwc3_pci_dev_pm_ops, dwc3_pci_suspend,
+                        dwc3_pci_resume);
 
 static struct pci_driver dwc3_pci_driver = {
        .name           = "dwc3-pci",
@@ -232,7 +227,7 @@ static struct pci_driver dwc3_pci_driver = {
        .probe          = dwc3_pci_probe,
        .remove         = dwc3_pci_remove,
        .driver         = {
-               .pm     = DEV_PM_OPS,
+               .pm     = &dwc3_pci_dev_pm_ops,
        },
 };
#3 lore raw
Quoted 7 lines · Mark Brown
Quoted 6 lines · Fabio Estevam
Quoted 5 lines · Mark Brown

From: Andy Green <[email protected]>

You might have CONFIG_PM, but you might not have CONFIG_SUSPEND, in which case these are unused.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

What about doing this instead?

Makes sense to me - Andy?

Sure, it seems a much more complete solution.

-Andy

#4 lore raw
Quoted 8 lines · Andy Green
Quoted 7 lines · Mark Brown
Quoted 6 lines · Fabio Estevam
Quoted 5 lines · Mark Brown

From: Andy Green <[email protected]>

You might have CONFIG_PM, but you might not have CONFIG_SUSPEND, in which case these are unused.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

What about doing this instead?

Makes sense to me - Andy?

Sure, it seems a much more complete solution.

looks good to me too, please send it as a real patch (if you already have, sorry about that, catching up with my inbox now).

Signature · 1 line
balbi
#5 lore raw
Quoted 2 lines · Felipe Balbi

looks good to me too, please send it as a real patch (if you already have, sorry about that, catching up with my inbox now).

Yes, I have already sent it as a formal patch.