aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-07-21 18:37:25 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2009-07-23 18:17:28 -0400
commitd9ab77161d811ffb0bccf396f7155cc905c1b9e1 (patch)
tree6d055acd69351a56b7014388e24d33199139d79c
parent511647ff58fd0f1c1f415d2c757d841650edac91 (diff)
Driver Core: Make PM operations a const pointer
They are not supposed to be modified by drivers, so make them const. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r--drivers/base/platform.c2
-rw-r--r--drivers/base/power/main.c8
-rw-r--r--drivers/pci/pci-driver.c16
-rw-r--r--include/linux/device.h9
4 files changed, 19 insertions, 16 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 455e55971d0e..ae5c4aa6d269 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -889,7 +889,7 @@ static int platform_pm_restore_noirq(struct device *dev)
889 889
890#endif /* !CONFIG_HIBERNATION */ 890#endif /* !CONFIG_HIBERNATION */
891 891
892static struct dev_pm_ops platform_dev_pm_ops = { 892static const struct dev_pm_ops platform_dev_pm_ops = {
893 .prepare = platform_pm_prepare, 893 .prepare = platform_pm_prepare,
894 .complete = platform_pm_complete, 894 .complete = platform_pm_complete,
895 .suspend = platform_pm_suspend, 895 .suspend = platform_pm_suspend,
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 58a3e572f2c9..1b1a786b7dec 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -157,8 +157,9 @@ void device_pm_move_last(struct device *dev)
157 * @ops: PM operations to choose from. 157 * @ops: PM operations to choose from.
158 * @state: PM transition of the system being carried out. 158 * @state: PM transition of the system being carried out.
159 */ 159 */
160static int pm_op(struct device *dev, struct dev_pm_ops *ops, 160static int pm_op(struct device *dev,
161 pm_message_t state) 161 const struct dev_pm_ops *ops,
162 pm_message_t state)
162{ 163{
163 int error = 0; 164 int error = 0;
164 165
@@ -220,7 +221,8 @@ static int pm_op(struct device *dev, struct dev_pm_ops *ops,
220 * The operation is executed with interrupts disabled by the only remaining 221 * The operation is executed with interrupts disabled by the only remaining
221 * functional CPU in the system. 222 * functional CPU in the system.
222 */ 223 */
223static int pm_noirq_op(struct device *dev, struct dev_pm_ops *ops, 224static int pm_noirq_op(struct device *dev,
225 const struct dev_pm_ops *ops,
224 pm_message_t state) 226 pm_message_t state)
225{ 227{
226 int error = 0; 228 int error = 0;
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index d76c4c85367e..0c2ea44ae5e1 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -575,7 +575,7 @@ static void pci_pm_complete(struct device *dev)
575static int pci_pm_suspend(struct device *dev) 575static int pci_pm_suspend(struct device *dev)
576{ 576{
577 struct pci_dev *pci_dev = to_pci_dev(dev); 577 struct pci_dev *pci_dev = to_pci_dev(dev);
578 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 578 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
579 579
580 if (pci_has_legacy_pm_support(pci_dev)) 580 if (pci_has_legacy_pm_support(pci_dev))
581 return pci_legacy_suspend(dev, PMSG_SUSPEND); 581 return pci_legacy_suspend(dev, PMSG_SUSPEND);
@@ -613,7 +613,7 @@ static int pci_pm_suspend(struct device *dev)
613static int pci_pm_suspend_noirq(struct device *dev) 613static int pci_pm_suspend_noirq(struct device *dev)
614{ 614{
615 struct pci_dev *pci_dev = to_pci_dev(dev); 615 struct pci_dev *pci_dev = to_pci_dev(dev);
616 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 616 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
617 617
618 if (pci_has_legacy_pm_support(pci_dev)) 618 if (pci_has_legacy_pm_support(pci_dev))
619 return pci_legacy_suspend_late(dev, PMSG_SUSPEND); 619 return pci_legacy_suspend_late(dev, PMSG_SUSPEND);
@@ -672,7 +672,7 @@ static int pci_pm_resume_noirq(struct device *dev)
672static int pci_pm_resume(struct device *dev) 672static int pci_pm_resume(struct device *dev)
673{ 673{
674 struct pci_dev *pci_dev = to_pci_dev(dev); 674 struct pci_dev *pci_dev = to_pci_dev(dev);
675 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 675 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
676 int error = 0; 676 int error = 0;
677 677
678 /* 678 /*
@@ -711,7 +711,7 @@ static int pci_pm_resume(struct device *dev)
711static int pci_pm_freeze(struct device *dev) 711static int pci_pm_freeze(struct device *dev)
712{ 712{
713 struct pci_dev *pci_dev = to_pci_dev(dev); 713 struct pci_dev *pci_dev = to_pci_dev(dev);
714 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 714 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
715 715
716 if (pci_has_legacy_pm_support(pci_dev)) 716 if (pci_has_legacy_pm_support(pci_dev))
717 return pci_legacy_suspend(dev, PMSG_FREEZE); 717 return pci_legacy_suspend(dev, PMSG_FREEZE);
@@ -780,7 +780,7 @@ static int pci_pm_thaw_noirq(struct device *dev)
780static int pci_pm_thaw(struct device *dev) 780static int pci_pm_thaw(struct device *dev)
781{ 781{
782 struct pci_dev *pci_dev = to_pci_dev(dev); 782 struct pci_dev *pci_dev = to_pci_dev(dev);
783 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 783 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
784 int error = 0; 784 int error = 0;
785 785
786 if (pci_has_legacy_pm_support(pci_dev)) 786 if (pci_has_legacy_pm_support(pci_dev))
@@ -799,7 +799,7 @@ static int pci_pm_thaw(struct device *dev)
799static int pci_pm_poweroff(struct device *dev) 799static int pci_pm_poweroff(struct device *dev)
800{ 800{
801 struct pci_dev *pci_dev = to_pci_dev(dev); 801 struct pci_dev *pci_dev = to_pci_dev(dev);
802 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 802 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
803 803
804 if (pci_has_legacy_pm_support(pci_dev)) 804 if (pci_has_legacy_pm_support(pci_dev))
805 return pci_legacy_suspend(dev, PMSG_HIBERNATE); 805 return pci_legacy_suspend(dev, PMSG_HIBERNATE);
@@ -872,7 +872,7 @@ static int pci_pm_restore_noirq(struct device *dev)
872static int pci_pm_restore(struct device *dev) 872static int pci_pm_restore(struct device *dev)
873{ 873{
874 struct pci_dev *pci_dev = to_pci_dev(dev); 874 struct pci_dev *pci_dev = to_pci_dev(dev);
875 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 875 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
876 int error = 0; 876 int error = 0;
877 877
878 /* 878 /*
@@ -910,7 +910,7 @@ static int pci_pm_restore(struct device *dev)
910 910
911#endif /* !CONFIG_HIBERNATION */ 911#endif /* !CONFIG_HIBERNATION */
912 912
913struct dev_pm_ops pci_dev_pm_ops = { 913const struct dev_pm_ops pci_dev_pm_ops = {
914 .prepare = pci_pm_prepare, 914 .prepare = pci_pm_prepare,
915 .complete = pci_pm_complete, 915 .complete = pci_pm_complete,
916 .suspend = pci_pm_suspend, 916 .suspend = pci_pm_suspend,
diff --git a/include/linux/device.h b/include/linux/device.h
index aebb81036db2..a28642975053 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -62,7 +62,7 @@ struct bus_type {
62 int (*suspend)(struct device *dev, pm_message_t state); 62 int (*suspend)(struct device *dev, pm_message_t state);
63 int (*resume)(struct device *dev); 63 int (*resume)(struct device *dev);
64 64
65 struct dev_pm_ops *pm; 65 const struct dev_pm_ops *pm;
66 66
67 struct bus_type_private *p; 67 struct bus_type_private *p;
68}; 68};
@@ -132,7 +132,7 @@ struct device_driver {
132 int (*resume) (struct device *dev); 132 int (*resume) (struct device *dev);
133 struct attribute_group **groups; 133 struct attribute_group **groups;
134 134
135 struct dev_pm_ops *pm; 135 const struct dev_pm_ops *pm;
136 136
137 struct driver_private *p; 137 struct driver_private *p;
138}; 138};
@@ -200,7 +200,8 @@ struct class {
200 int (*suspend)(struct device *dev, pm_message_t state); 200 int (*suspend)(struct device *dev, pm_message_t state);
201 int (*resume)(struct device *dev); 201 int (*resume)(struct device *dev);
202 202
203 struct dev_pm_ops *pm; 203 const struct dev_pm_ops *pm;
204
204 struct class_private *p; 205 struct class_private *p;
205}; 206};
206 207
@@ -291,7 +292,7 @@ struct device_type {
291 char *(*nodename)(struct device *dev); 292 char *(*nodename)(struct device *dev);
292 void (*release)(struct device *dev); 293 void (*release)(struct device *dev);
293 294
294 struct dev_pm_ops *pm; 295 const struct dev_pm_ops *pm;
295}; 296};
296 297
297/* interface for exporting device attributes */ 298/* interface for exporting device attributes */