diff options
author | Márton Németh <nm127@freemail.hu> | 2010-01-10 11:15:36 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-01-16 15:56:43 -0500 |
commit | c97adf9e7bebf17a86b95e2131bf9ba76c4857c7 (patch) | |
tree | 11667422c8b8a8d9f2980affd5f74611c4d12724 | |
parent | c14973f93027500301fc40333e16ae49e58923a7 (diff) |
acpi: make ACPI device id constant
The ids field of the struct acpi_driver is constant in <linux/acpi/acpi_bus.h>
so it is worth to make the initialization data also constant.
The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
struct I1 {
...
const struct I2 *x;
...
};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
struct I1 y = {
.x = E,
};
@c@
identifier r.I2;
identifier s.E;
@@
const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+ const
struct I2 E[] = ...;
// </smpl>
Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/acpi/pci_link.c | 2 | ||||
-rw-r--r-- | drivers/acpi/pci_root.c | 2 | ||||
-rw-r--r-- | drivers/acpi/power.c | 2 | ||||
-rw-r--r-- | drivers/acpi/power_meter.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 394ae89409c2..04b0f007c9b7 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -56,7 +56,7 @@ ACPI_MODULE_NAME("pci_link"); | |||
56 | static int acpi_pci_link_add(struct acpi_device *device); | 56 | static int acpi_pci_link_add(struct acpi_device *device); |
57 | static int acpi_pci_link_remove(struct acpi_device *device, int type); | 57 | static int acpi_pci_link_remove(struct acpi_device *device, int type); |
58 | 58 | ||
59 | static struct acpi_device_id link_device_ids[] = { | 59 | static const struct acpi_device_id link_device_ids[] = { |
60 | {"PNP0C0F", 0}, | 60 | {"PNP0C0F", 0}, |
61 | {"", 0}, | 61 | {"", 0}, |
62 | }; | 62 | }; |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 101cce3681d1..64f55b6db73c 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -46,7 +46,7 @@ static int acpi_pci_root_add(struct acpi_device *device); | |||
46 | static int acpi_pci_root_remove(struct acpi_device *device, int type); | 46 | static int acpi_pci_root_remove(struct acpi_device *device, int type); |
47 | static int acpi_pci_root_start(struct acpi_device *device); | 47 | static int acpi_pci_root_start(struct acpi_device *device); |
48 | 48 | ||
49 | static struct acpi_device_id root_device_ids[] = { | 49 | static const struct acpi_device_id root_device_ids[] = { |
50 | {"PNP0A03", 0}, | 50 | {"PNP0A03", 0}, |
51 | {"", 0}, | 51 | {"", 0}, |
52 | }; | 52 | }; |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 22b297916519..0f30c3c1eea4 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -65,7 +65,7 @@ static int acpi_power_remove(struct acpi_device *device, int type); | |||
65 | static int acpi_power_resume(struct acpi_device *device); | 65 | static int acpi_power_resume(struct acpi_device *device); |
66 | static int acpi_power_open_fs(struct inode *inode, struct file *file); | 66 | static int acpi_power_open_fs(struct inode *inode, struct file *file); |
67 | 67 | ||
68 | static struct acpi_device_id power_device_ids[] = { | 68 | static const struct acpi_device_id power_device_ids[] = { |
69 | {ACPI_POWER_HID, 0}, | 69 | {ACPI_POWER_HID, 0}, |
70 | {"", 0}, | 70 | {"", 0}, |
71 | }; | 71 | }; |
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c index 2ef7030a0c28..ca75c36f754c 100644 --- a/drivers/acpi/power_meter.c +++ b/drivers/acpi/power_meter.c | |||
@@ -64,7 +64,7 @@ static int can_cap_in_hardware(void) | |||
64 | return force_cap_on || cap_in_hardware; | 64 | return force_cap_on || cap_in_hardware; |
65 | } | 65 | } |
66 | 66 | ||
67 | static struct acpi_device_id power_meter_ids[] = { | 67 | static const struct acpi_device_id power_meter_ids[] = { |
68 | {"ACPI000D", 0}, | 68 | {"ACPI000D", 0}, |
69 | {"", 0}, | 69 | {"", 0}, |
70 | }; | 70 | }; |