2017-06-29 05:28:42

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] usb: dwc3: pci: constify dev_pm_ops structures.

dev_pm_ops are not supposed to change at runtime. All functions
working with dev_pm_ops provided by <linux/device.h> work with const
dev_pm_ops. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
2707 456 0 3163 c5b drivers/usb/dwc3/dwc3-pci.o

File size After adding 'const':
text data bss dec hex filename
2899 264 0 3163 c5b drivers/usb/dwc3/dwc3-pci.o

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/usb/dwc3/dwc3-pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index a15ec71..9b0fb05 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -342,7 +342,7 @@ static int dwc3_pci_resume(struct device *dev)
}
#endif /* CONFIG_PM_SLEEP */

-static struct dev_pm_ops dwc3_pci_dev_pm_ops = {
+static const struct dev_pm_ops dwc3_pci_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_suspend, dwc3_pci_resume)
SET_RUNTIME_PM_OPS(dwc3_pci_runtime_suspend, dwc3_pci_runtime_resume,
NULL)
--
1.9.1