diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-03 15:15:40 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-09 20:22:20 -0400 |
commit | 1855256c497ecfefc730df6032243f26855ce52c (patch) | |
tree | b73947f1a5e1b798e1dec068ac1cda25ae910bf6 /drivers | |
parent | bbf25010f1a6b761914430f5fca081ec8c7accd1 (diff) |
drivers/firmware: const-ify DMI API and internals
Three main sets of changes:
1) dmi_get_system_info() return value should have been marked const,
since callers should not be changing that data.
2) const-ify DMI internals, since DMI firmware tables should,
whenever possible, be marked const to ensure we never ever write to
that data area.
3) const-ify DMI API, to enable marking tables const where possible
in low-level drivers.
And if we're really lucky, this might enable some additional
optimizations on the part of the compiler.
The bulk of the changes are #2 and #3, which are interrelated. #1 could
have been a separate patch, but it was so small compared to the others,
it was easier to roll it into this changeset.
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/osl.c | 2 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 2 | ||||
-rw-r--r-- | drivers/acpi/sleep/main.c | 2 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 8 | ||||
-rw-r--r-- | drivers/ata/ata_piix.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_ali.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_cs5530.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_via.c | 2 | ||||
-rw-r--r-- | drivers/char/i8k.c | 4 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 9 | ||||
-rw-r--r-- | drivers/firmware/dmi_scan.c | 57 | ||||
-rw-r--r-- | drivers/hwmon/abituguru.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/applesmc.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/hdaps.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/alim15x3.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/via82cxxx.c | 2 | ||||
-rw-r--r-- | drivers/input/misc/wistron_btns.c | 2 | ||||
-rw-r--r-- | drivers/input/mouse/lifebook.c | 6 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 2 | ||||
-rw-r--r-- | drivers/misc/msi-laptop.c | 2 | ||||
-rw-r--r-- | drivers/misc/sony-laptop.c | 4 | ||||
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 2 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/core.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/uhci-hcd.c | 2 | ||||
-rw-r--r-- | drivers/video/imacfb.c | 2 |
25 files changed, 68 insertions, 62 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 12c09fafce9a..352cf81af581 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -1214,7 +1214,7 @@ acpi_os_validate_address ( | |||
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | #ifdef CONFIG_DMI | 1216 | #ifdef CONFIG_DMI |
1217 | static int dmi_osi_linux(struct dmi_system_id *d) | 1217 | static int dmi_osi_linux(const struct dmi_system_id *d) |
1218 | { | 1218 | { |
1219 | printk(KERN_NOTICE "%s detected: enabling _OSI(Linux)\n", d->ident); | 1219 | printk(KERN_NOTICE "%s detected: enabling _OSI(Linux)\n", d->ident); |
1220 | enable_osi_linux(1); | 1220 | enable_osi_linux(1); |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f18261368e76..1e8287b4f40c 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -92,7 +92,7 @@ module_param(bm_history, uint, 0644); | |||
92 | * | 92 | * |
93 | * To skip this limit, boot/load with a large max_cstate limit. | 93 | * To skip this limit, boot/load with a large max_cstate limit. |
94 | */ | 94 | */ |
95 | static int set_max_cstate(struct dmi_system_id *id) | 95 | static int set_max_cstate(const struct dmi_system_id *id) |
96 | { | 96 | { |
97 | if (max_cstate > ACPI_PROCESSOR_MAX_POWER) | 97 | if (max_cstate > ACPI_PROCESSOR_MAX_POWER) |
98 | return 0; | 98 | return 0; |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 2cbb9aabd00e..5055acf2163c 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -215,7 +215,7 @@ static struct pm_ops acpi_pm_ops = { | |||
215 | * Toshiba fails to preserve interrupts over S1, reinitialization | 215 | * Toshiba fails to preserve interrupts over S1, reinitialization |
216 | * of 8259 is needed after S1 resume. | 216 | * of 8259 is needed after S1 resume. |
217 | */ | 217 | */ |
218 | static int __init init_ints_after_s1(struct dmi_system_id *d) | 218 | static int __init init_ints_after_s1(const struct dmi_system_id *d) |
219 | { | 219 | { |
220 | printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident); | 220 | printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident); |
221 | init_8259A_after_S1 = 1; | 221 | init_8259A_after_S1 = 1; |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index bc6d5866ef98..ad898e10c1a9 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -1360,7 +1360,7 @@ static int acpi_thermal_resume(struct acpi_device *device) | |||
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | #ifdef CONFIG_DMI | 1362 | #ifdef CONFIG_DMI |
1363 | static int thermal_act(struct dmi_system_id *d) { | 1363 | static int thermal_act(const struct dmi_system_id *d) { |
1364 | 1364 | ||
1365 | if (act == 0) { | 1365 | if (act == 0) { |
1366 | printk(KERN_NOTICE "ACPI: %s detected: " | 1366 | printk(KERN_NOTICE "ACPI: %s detected: " |
@@ -1369,14 +1369,14 @@ static int thermal_act(struct dmi_system_id *d) { | |||
1369 | } | 1369 | } |
1370 | return 0; | 1370 | return 0; |
1371 | } | 1371 | } |
1372 | static int thermal_nocrt(struct dmi_system_id *d) { | 1372 | static int thermal_nocrt(const struct dmi_system_id *d) { |
1373 | 1373 | ||
1374 | printk(KERN_NOTICE "ACPI: %s detected: " | 1374 | printk(KERN_NOTICE "ACPI: %s detected: " |
1375 | "disabling all critical thermal trip point actions.\n", d->ident); | 1375 | "disabling all critical thermal trip point actions.\n", d->ident); |
1376 | nocrt = 1; | 1376 | nocrt = 1; |
1377 | return 0; | 1377 | return 0; |
1378 | } | 1378 | } |
1379 | static int thermal_tzp(struct dmi_system_id *d) { | 1379 | static int thermal_tzp(const struct dmi_system_id *d) { |
1380 | 1380 | ||
1381 | if (tzp == 0) { | 1381 | if (tzp == 0) { |
1382 | printk(KERN_NOTICE "ACPI: %s detected: " | 1382 | printk(KERN_NOTICE "ACPI: %s detected: " |
@@ -1385,7 +1385,7 @@ static int thermal_tzp(struct dmi_system_id *d) { | |||
1385 | } | 1385 | } |
1386 | return 0; | 1386 | return 0; |
1387 | } | 1387 | } |
1388 | static int thermal_psv(struct dmi_system_id *d) { | 1388 | static int thermal_psv(const struct dmi_system_id *d) { |
1389 | 1389 | ||
1390 | if (psv == 0) { | 1390 | if (psv == 0) { |
1391 | printk(KERN_NOTICE "ACPI: %s detected: " | 1391 | printk(KERN_NOTICE "ACPI: %s detected: " |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 6996eb5b7506..92c2d5082bef 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -919,7 +919,7 @@ static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
919 | #ifdef CONFIG_PM | 919 | #ifdef CONFIG_PM |
920 | static int piix_broken_suspend(void) | 920 | static int piix_broken_suspend(void) |
921 | { | 921 | { |
922 | static struct dmi_system_id sysids[] = { | 922 | static const struct dmi_system_id sysids[] = { |
923 | { | 923 | { |
924 | .ident = "TECRA M3", | 924 | .ident = "TECRA M3", |
925 | .matches = { | 925 | .matches = { |
@@ -1183,7 +1183,7 @@ static void __devinit piix_init_sata_map(struct pci_dev *pdev, | |||
1183 | 1183 | ||
1184 | static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) | 1184 | static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) |
1185 | { | 1185 | { |
1186 | static struct dmi_system_id sysids[] = { | 1186 | static const struct dmi_system_id sysids[] = { |
1187 | { | 1187 | { |
1188 | /* Clevo M570U sets IOCFG bit 18 if the cdrom | 1188 | /* Clevo M570U sets IOCFG bit 18 if the cdrom |
1189 | * isn't used to boot the system which | 1189 | * isn't used to boot the system which |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 71bdc3b3189c..32a10c99c06f 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -40,7 +40,7 @@ | |||
40 | * Cable special cases | 40 | * Cable special cases |
41 | */ | 41 | */ |
42 | 42 | ||
43 | static struct dmi_system_id cable_dmi_table[] = { | 43 | static const struct dmi_system_id cable_dmi_table[] = { |
44 | { | 44 | { |
45 | .ident = "HP Pavilion N5430", | 45 | .ident = "HP Pavilion N5430", |
46 | .matches = { | 46 | .matches = { |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index c6066aa43ec8..eaaea848b649 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -214,7 +214,7 @@ static struct ata_port_operations cs5530_port_ops = { | |||
214 | .port_start = ata_port_start, | 214 | .port_start = ata_port_start, |
215 | }; | 215 | }; |
216 | 216 | ||
217 | static struct dmi_system_id palmax_dmi_table[] = { | 217 | static const struct dmi_system_id palmax_dmi_table[] = { |
218 | { | 218 | { |
219 | .ident = "Palmax PD1100", | 219 | .ident = "Palmax PD1100", |
220 | .matches = { | 220 | .matches = { |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 636c4f1a0b24..f143db4559e0 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -129,7 +129,7 @@ static const struct via_isa_bridge { | |||
129 | * Cable special cases | 129 | * Cable special cases |
130 | */ | 130 | */ |
131 | 131 | ||
132 | static struct dmi_system_id cable_dmi_table[] = { | 132 | static const struct dmi_system_id cable_dmi_table[] = { |
133 | { | 133 | { |
134 | .ident = "Acer Ferrari 3400", | 134 | .ident = "Acer Ferrari 3400", |
135 | .matches = { | 135 | .matches = { |
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index 0289705967de..cd406416effd 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
@@ -98,9 +98,9 @@ struct smm_regs { | |||
98 | unsigned int edi __attribute__ ((packed)); | 98 | unsigned int edi __attribute__ ((packed)); |
99 | }; | 99 | }; |
100 | 100 | ||
101 | static inline char *i8k_get_dmi_data(int field) | 101 | static inline const char *i8k_get_dmi_data(int field) |
102 | { | 102 | { |
103 | char *dmi_data = dmi_get_system_info(field); | 103 | const char *dmi_data = dmi_get_system_info(field); |
104 | 104 | ||
105 | return dmi_data && *dmi_data ? dmi_data : "?"; | 105 | return dmi_data && *dmi_data ? dmi_data : "?"; |
106 | } | 106 | } |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index dd441ff4af56..7901d5f218ec 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -1965,10 +1965,10 @@ struct dmi_ipmi_data | |||
1965 | u8 slave_addr; | 1965 | u8 slave_addr; |
1966 | }; | 1966 | }; |
1967 | 1967 | ||
1968 | static int __devinit decode_dmi(struct dmi_header *dm, | 1968 | static int __devinit decode_dmi(const struct dmi_header *dm, |
1969 | struct dmi_ipmi_data *dmi) | 1969 | struct dmi_ipmi_data *dmi) |
1970 | { | 1970 | { |
1971 | u8 *data = (u8 *)dm; | 1971 | const u8 *data = (const u8 *)dm; |
1972 | unsigned long base_addr; | 1972 | unsigned long base_addr; |
1973 | u8 reg_spacing; | 1973 | u8 reg_spacing; |
1974 | u8 len = dm->length; | 1974 | u8 len = dm->length; |
@@ -2091,13 +2091,14 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data) | |||
2091 | 2091 | ||
2092 | static void __devinit dmi_find_bmc(void) | 2092 | static void __devinit dmi_find_bmc(void) |
2093 | { | 2093 | { |
2094 | struct dmi_device *dev = NULL; | 2094 | const struct dmi_device *dev = NULL; |
2095 | struct dmi_ipmi_data data; | 2095 | struct dmi_ipmi_data data; |
2096 | int rv; | 2096 | int rv; |
2097 | 2097 | ||
2098 | while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) { | 2098 | while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) { |
2099 | memset(&data, 0, sizeof(data)); | 2099 | memset(&data, 0, sizeof(data)); |
2100 | rv = decode_dmi((struct dmi_header *) dev->device_data, &data); | 2100 | rv = decode_dmi((const struct dmi_header *) dev->device_data, |
2101 | &data); | ||
2101 | if (!rv) | 2102 | if (!rv) |
2102 | try_init_dmi(&data); | 2103 | try_init_dmi(&data); |
2103 | } | 2104 | } |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index f7318b3b51f2..0cdadea7a40e 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -8,9 +8,9 @@ | |||
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <asm/dmi.h> | 9 | #include <asm/dmi.h> |
10 | 10 | ||
11 | static char * __init dmi_string(struct dmi_header *dm, u8 s) | 11 | static char * __init dmi_string(const struct dmi_header *dm, u8 s) |
12 | { | 12 | { |
13 | u8 *bp = ((u8 *) dm) + dm->length; | 13 | const u8 *bp = ((u8 *) dm) + dm->length; |
14 | char *str = ""; | 14 | char *str = ""; |
15 | 15 | ||
16 | if (s) { | 16 | if (s) { |
@@ -37,7 +37,7 @@ static char * __init dmi_string(struct dmi_header *dm, u8 s) | |||
37 | * pointing to completely the wrong place for example | 37 | * pointing to completely the wrong place for example |
38 | */ | 38 | */ |
39 | static int __init dmi_table(u32 base, int len, int num, | 39 | static int __init dmi_table(u32 base, int len, int num, |
40 | void (*decode)(struct dmi_header *)) | 40 | void (*decode)(const struct dmi_header *)) |
41 | { | 41 | { |
42 | u8 *buf, *data; | 42 | u8 *buf, *data; |
43 | int i = 0; | 43 | int i = 0; |
@@ -53,7 +53,8 @@ static int __init dmi_table(u32 base, int len, int num, | |||
53 | * OR we run off the end of the table (also happens) | 53 | * OR we run off the end of the table (also happens) |
54 | */ | 54 | */ |
55 | while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) { | 55 | while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) { |
56 | struct dmi_header *dm = (struct dmi_header *)data; | 56 | const struct dmi_header *dm = (const struct dmi_header *)data; |
57 | |||
57 | /* | 58 | /* |
58 | * We want to know the total length (formated area and strings) | 59 | * We want to know the total length (formated area and strings) |
59 | * before decoding to make sure we won't run off the table in | 60 | * before decoding to make sure we won't run off the table in |
@@ -71,7 +72,7 @@ static int __init dmi_table(u32 base, int len, int num, | |||
71 | return 0; | 72 | return 0; |
72 | } | 73 | } |
73 | 74 | ||
74 | static int __init dmi_checksum(u8 *buf) | 75 | static int __init dmi_checksum(const u8 *buf) |
75 | { | 76 | { |
76 | u8 sum = 0; | 77 | u8 sum = 0; |
77 | int a; | 78 | int a; |
@@ -89,9 +90,10 @@ int dmi_available; | |||
89 | /* | 90 | /* |
90 | * Save a DMI string | 91 | * Save a DMI string |
91 | */ | 92 | */ |
92 | static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string) | 93 | static void __init dmi_save_ident(const struct dmi_header *dm, int slot, int string) |
93 | { | 94 | { |
94 | char *p, *d = (char*) dm; | 95 | const char *d = (const char*) dm; |
96 | char *p; | ||
95 | 97 | ||
96 | if (dmi_ident[slot]) | 98 | if (dmi_ident[slot]) |
97 | return; | 99 | return; |
@@ -103,9 +105,9 @@ static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string) | |||
103 | dmi_ident[slot] = p; | 105 | dmi_ident[slot] = p; |
104 | } | 106 | } |
105 | 107 | ||
106 | static void __init dmi_save_uuid(struct dmi_header *dm, int slot, int index) | 108 | static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int index) |
107 | { | 109 | { |
108 | u8 *d = (u8*) dm + index; | 110 | const u8 *d = (u8*) dm + index; |
109 | char *s; | 111 | char *s; |
110 | int is_ff = 1, is_00 = 1, i; | 112 | int is_ff = 1, is_00 = 1, i; |
111 | 113 | ||
@@ -132,9 +134,9 @@ static void __init dmi_save_uuid(struct dmi_header *dm, int slot, int index) | |||
132 | dmi_ident[slot] = s; | 134 | dmi_ident[slot] = s; |
133 | } | 135 | } |
134 | 136 | ||
135 | static void __init dmi_save_type(struct dmi_header *dm, int slot, int index) | 137 | static void __init dmi_save_type(const struct dmi_header *dm, int slot, int index) |
136 | { | 138 | { |
137 | u8 *d = (u8*) dm + index; | 139 | const u8 *d = (u8*) dm + index; |
138 | char *s; | 140 | char *s; |
139 | 141 | ||
140 | if (dmi_ident[slot]) | 142 | if (dmi_ident[slot]) |
@@ -148,13 +150,13 @@ static void __init dmi_save_type(struct dmi_header *dm, int slot, int index) | |||
148 | dmi_ident[slot] = s; | 150 | dmi_ident[slot] = s; |
149 | } | 151 | } |
150 | 152 | ||
151 | static void __init dmi_save_devices(struct dmi_header *dm) | 153 | static void __init dmi_save_devices(const struct dmi_header *dm) |
152 | { | 154 | { |
153 | int i, count = (dm->length - sizeof(struct dmi_header)) / 2; | 155 | int i, count = (dm->length - sizeof(struct dmi_header)) / 2; |
154 | struct dmi_device *dev; | 156 | struct dmi_device *dev; |
155 | 157 | ||
156 | for (i = 0; i < count; i++) { | 158 | for (i = 0; i < count; i++) { |
157 | char *d = (char *)(dm + 1) + (i * 2); | 159 | const char *d = (char *)(dm + 1) + (i * 2); |
158 | 160 | ||
159 | /* Skip disabled device */ | 161 | /* Skip disabled device */ |
160 | if ((*d & 0x80) == 0) | 162 | if ((*d & 0x80) == 0) |
@@ -173,7 +175,7 @@ static void __init dmi_save_devices(struct dmi_header *dm) | |||
173 | } | 175 | } |
174 | } | 176 | } |
175 | 177 | ||
176 | static void __init dmi_save_oem_strings_devices(struct dmi_header *dm) | 178 | static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm) |
177 | { | 179 | { |
178 | int i, count = *(u8 *)(dm + 1); | 180 | int i, count = *(u8 *)(dm + 1); |
179 | struct dmi_device *dev; | 181 | struct dmi_device *dev; |
@@ -194,7 +196,7 @@ static void __init dmi_save_oem_strings_devices(struct dmi_header *dm) | |||
194 | } | 196 | } |
195 | } | 197 | } |
196 | 198 | ||
197 | static void __init dmi_save_ipmi_device(struct dmi_header *dm) | 199 | static void __init dmi_save_ipmi_device(const struct dmi_header *dm) |
198 | { | 200 | { |
199 | struct dmi_device *dev; | 201 | struct dmi_device *dev; |
200 | void * data; | 202 | void * data; |
@@ -225,7 +227,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm) | |||
225 | * and machine entries. For 2.5 we should pull the smbus controller info | 227 | * and machine entries. For 2.5 we should pull the smbus controller info |
226 | * out of here. | 228 | * out of here. |
227 | */ | 229 | */ |
228 | static void __init dmi_decode(struct dmi_header *dm) | 230 | static void __init dmi_decode(const struct dmi_header *dm) |
229 | { | 231 | { |
230 | switch(dm->type) { | 232 | switch(dm->type) { |
231 | case 0: /* BIOS Information */ | 233 | case 0: /* BIOS Information */ |
@@ -265,9 +267,10 @@ static void __init dmi_decode(struct dmi_header *dm) | |||
265 | } | 267 | } |
266 | } | 268 | } |
267 | 269 | ||
268 | static int __init dmi_present(char __iomem *p) | 270 | static int __init dmi_present(const char __iomem *p) |
269 | { | 271 | { |
270 | u8 buf[15]; | 272 | u8 buf[15]; |
273 | |||
271 | memcpy_fromio(buf, p, 15); | 274 | memcpy_fromio(buf, p, 15); |
272 | if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { | 275 | if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { |
273 | u16 num = (buf[13] << 8) | buf[12]; | 276 | u16 num = (buf[13] << 8) | buf[12]; |
@@ -348,10 +351,10 @@ void __init dmi_scan_machine(void) | |||
348 | * returns non zero or we hit the end. Callback function is called for | 351 | * returns non zero or we hit the end. Callback function is called for |
349 | * each successful match. Returns the number of matches. | 352 | * each successful match. Returns the number of matches. |
350 | */ | 353 | */ |
351 | int dmi_check_system(struct dmi_system_id *list) | 354 | int dmi_check_system(const struct dmi_system_id *list) |
352 | { | 355 | { |
353 | int i, count = 0; | 356 | int i, count = 0; |
354 | struct dmi_system_id *d = list; | 357 | const struct dmi_system_id *d = list; |
355 | 358 | ||
356 | while (d->ident) { | 359 | while (d->ident) { |
357 | for (i = 0; i < ARRAY_SIZE(d->matches); i++) { | 360 | for (i = 0; i < ARRAY_SIZE(d->matches); i++) { |
@@ -380,7 +383,7 @@ EXPORT_SYMBOL(dmi_check_system); | |||
380 | * Returns one DMI data value, can be used to perform | 383 | * Returns one DMI data value, can be used to perform |
381 | * complex DMI data checks. | 384 | * complex DMI data checks. |
382 | */ | 385 | */ |
383 | char *dmi_get_system_info(int field) | 386 | const char *dmi_get_system_info(int field) |
384 | { | 387 | { |
385 | return dmi_ident[field]; | 388 | return dmi_ident[field]; |
386 | } | 389 | } |
@@ -391,7 +394,7 @@ EXPORT_SYMBOL(dmi_get_system_info); | |||
391 | * dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information. | 394 | * dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information. |
392 | * @str: Case sensitive Name | 395 | * @str: Case sensitive Name |
393 | */ | 396 | */ |
394 | int dmi_name_in_vendors(char *str) | 397 | int dmi_name_in_vendors(const char *str) |
395 | { | 398 | { |
396 | static int fields[] = { DMI_BIOS_VENDOR, DMI_BIOS_VERSION, DMI_SYS_VENDOR, | 399 | static int fields[] = { DMI_BIOS_VENDOR, DMI_BIOS_VERSION, DMI_SYS_VENDOR, |
397 | DMI_PRODUCT_NAME, DMI_PRODUCT_VERSION, DMI_BOARD_VENDOR, | 400 | DMI_PRODUCT_NAME, DMI_PRODUCT_VERSION, DMI_BOARD_VENDOR, |
@@ -418,13 +421,15 @@ EXPORT_SYMBOL(dmi_name_in_vendors); | |||
418 | * A new search is initiated by passing %NULL as the @from argument. | 421 | * A new search is initiated by passing %NULL as the @from argument. |
419 | * If @from is not %NULL, searches continue from next device. | 422 | * If @from is not %NULL, searches continue from next device. |
420 | */ | 423 | */ |
421 | struct dmi_device * dmi_find_device(int type, const char *name, | 424 | const struct dmi_device * dmi_find_device(int type, const char *name, |
422 | struct dmi_device *from) | 425 | const struct dmi_device *from) |
423 | { | 426 | { |
424 | struct list_head *d, *head = from ? &from->list : &dmi_devices; | 427 | const struct list_head *head = from ? &from->list : &dmi_devices; |
428 | struct list_head *d; | ||
425 | 429 | ||
426 | for(d = head->next; d != &dmi_devices; d = d->next) { | 430 | for(d = head->next; d != &dmi_devices; d = d->next) { |
427 | struct dmi_device *dev = list_entry(d, struct dmi_device, list); | 431 | const struct dmi_device *dev = |
432 | list_entry(d, struct dmi_device, list); | ||
428 | 433 | ||
429 | if (((type == DMI_DEV_TYPE_ANY) || (dev->type == type)) && | 434 | if (((type == DMI_DEV_TYPE_ANY) || (dev->type == type)) && |
430 | ((name == NULL) || (strcmp(dev->name, name) == 0))) | 435 | ((name == NULL) || (strcmp(dev->name, name) == 0))) |
@@ -444,7 +449,7 @@ EXPORT_SYMBOL(dmi_find_device); | |||
444 | int dmi_get_year(int field) | 449 | int dmi_get_year(int field) |
445 | { | 450 | { |
446 | int year; | 451 | int year; |
447 | char *s = dmi_get_system_info(field); | 452 | const char *s = dmi_get_system_info(field); |
448 | 453 | ||
449 | if (!s) | 454 | if (!s) |
450 | return -1; | 455 | return -1; |
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index d575ee958de5..2317f4bb9c92 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c | |||
@@ -1449,7 +1449,7 @@ static int __init abituguru_init(void) | |||
1449 | struct resource res = { .flags = IORESOURCE_IO }; | 1449 | struct resource res = { .flags = IORESOURCE_IO }; |
1450 | 1450 | ||
1451 | #ifdef CONFIG_DMI | 1451 | #ifdef CONFIG_DMI |
1452 | char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | 1452 | const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); |
1453 | 1453 | ||
1454 | /* safety check, refuse to load on non Abit motherboards */ | 1454 | /* safety check, refuse to load on non Abit motherboards */ |
1455 | if (!force && (!board_vendor || | 1455 | if (!force && (!board_vendor || |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 941729a131f5..56213b7f8188 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -1071,7 +1071,7 @@ static const struct attribute_group temperature_attributes_group = | |||
1071 | /* | 1071 | /* |
1072 | * applesmc_dmi_match - found a match. return one, short-circuiting the hunt. | 1072 | * applesmc_dmi_match - found a match. return one, short-circuiting the hunt. |
1073 | */ | 1073 | */ |
1074 | static int applesmc_dmi_match(struct dmi_system_id *id) | 1074 | static int applesmc_dmi_match(const struct dmi_system_id *id) |
1075 | { | 1075 | { |
1076 | int i = 0; | 1076 | int i = 0; |
1077 | struct dmi_match_data* dmi_data = id->driver_data; | 1077 | struct dmi_match_data* dmi_data = id->driver_data; |
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index e0cf5e6fe5bc..a7c6d407572b 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c | |||
@@ -480,14 +480,14 @@ static struct attribute_group hdaps_attribute_group = { | |||
480 | /* Module stuff */ | 480 | /* Module stuff */ |
481 | 481 | ||
482 | /* hdaps_dmi_match - found a match. return one, short-circuiting the hunt. */ | 482 | /* hdaps_dmi_match - found a match. return one, short-circuiting the hunt. */ |
483 | static int __init hdaps_dmi_match(struct dmi_system_id *id) | 483 | static int __init hdaps_dmi_match(const struct dmi_system_id *id) |
484 | { | 484 | { |
485 | printk(KERN_INFO "hdaps: %s detected.\n", id->ident); | 485 | printk(KERN_INFO "hdaps: %s detected.\n", id->ident); |
486 | return 1; | 486 | return 1; |
487 | } | 487 | } |
488 | 488 | ||
489 | /* hdaps_dmi_match_invert - found an inverted match. */ | 489 | /* hdaps_dmi_match_invert - found an inverted match. */ |
490 | static int __init hdaps_dmi_match_invert(struct dmi_system_id *id) | 490 | static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id) |
491 | { | 491 | { |
492 | hdaps_invert = 1; | 492 | hdaps_invert = 1; |
493 | printk(KERN_INFO "hdaps: inverting axis readings.\n"); | 493 | printk(KERN_INFO "hdaps: inverting axis readings.\n"); |
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 11ecb618007c..20ebe3b7049c 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -588,7 +588,7 @@ out: | |||
588 | * Cable special cases | 588 | * Cable special cases |
589 | */ | 589 | */ |
590 | 590 | ||
591 | static struct dmi_system_id cable_dmi_table[] = { | 591 | static const struct dmi_system_id cable_dmi_table[] = { |
592 | { | 592 | { |
593 | .ident = "HP Pavilion N5430", | 593 | .ident = "HP Pavilion N5430", |
594 | .matches = { | 594 | .matches = { |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index a7be7795e6af..c10203a32159 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -419,7 +419,7 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const | |||
419 | * Cable special cases | 419 | * Cable special cases |
420 | */ | 420 | */ |
421 | 421 | ||
422 | static struct dmi_system_id cable_dmi_table[] = { | 422 | static const struct dmi_system_id cable_dmi_table[] = { |
423 | { | 423 | { |
424 | .ident = "Acer Ferrari 3400", | 424 | .ident = "Acer Ferrari 3400", |
425 | .matches = { | 425 | .matches = { |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 60121f10f8d9..b438d998625c 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -247,7 +247,7 @@ static int have_wifi; | |||
247 | static int have_bluetooth; | 247 | static int have_bluetooth; |
248 | static int have_leds; | 248 | static int have_leds; |
249 | 249 | ||
250 | static int __init dmi_matched(struct dmi_system_id *dmi) | 250 | static int __init dmi_matched(const struct dmi_system_id *dmi) |
251 | { | 251 | { |
252 | const struct key_entry *key; | 252 | const struct key_entry *key; |
253 | 253 | ||
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 91109b49fde1..608674d0be8b 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
@@ -27,7 +27,7 @@ struct lifebook_data { | |||
27 | 27 | ||
28 | static const char *desired_serio_phys; | 28 | static const char *desired_serio_phys; |
29 | 29 | ||
30 | static int lifebook_set_serio_phys(struct dmi_system_id *d) | 30 | static int lifebook_set_serio_phys(const struct dmi_system_id *d) |
31 | { | 31 | { |
32 | desired_serio_phys = d->driver_data; | 32 | desired_serio_phys = d->driver_data; |
33 | return 0; | 33 | return 0; |
@@ -35,13 +35,13 @@ static int lifebook_set_serio_phys(struct dmi_system_id *d) | |||
35 | 35 | ||
36 | static unsigned char lifebook_use_6byte_proto; | 36 | static unsigned char lifebook_use_6byte_proto; |
37 | 37 | ||
38 | static int lifebook_set_6byte_proto(struct dmi_system_id *d) | 38 | static int lifebook_set_6byte_proto(const struct dmi_system_id *d) |
39 | { | 39 | { |
40 | lifebook_use_6byte_proto = 1; | 40 | lifebook_use_6byte_proto = 1; |
41 | return 0; | 41 | return 0; |
42 | } | 42 | } |
43 | 43 | ||
44 | static struct dmi_system_id lifebook_dmi_table[] = { | 44 | static const struct dmi_system_id lifebook_dmi_table[] = { |
45 | { | 45 | { |
46 | .ident = "FLORA-ie 55mi", | 46 | .ident = "FLORA-ie 55mi", |
47 | .matches = { | 47 | .matches = { |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 666ad3a53fdb..d349c4a5e3e8 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -602,7 +602,7 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
602 | 602 | ||
603 | #if defined(__i386__) | 603 | #if defined(__i386__) |
604 | #include <linux/dmi.h> | 604 | #include <linux/dmi.h> |
605 | static struct dmi_system_id toshiba_dmi_table[] = { | 605 | static const struct dmi_system_id toshiba_dmi_table[] = { |
606 | { | 606 | { |
607 | .ident = "Toshiba Satellite", | 607 | .ident = "Toshiba Satellite", |
608 | .matches = { | 608 | .matches = { |
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c index 349be934db7c..83679c762925 100644 --- a/drivers/misc/msi-laptop.c +++ b/drivers/misc/msi-laptop.c | |||
@@ -283,7 +283,7 @@ static struct platform_device *msipf_device; | |||
283 | 283 | ||
284 | /* Initialization */ | 284 | /* Initialization */ |
285 | 285 | ||
286 | static int dmi_check_cb(struct dmi_system_id *id) | 286 | static int dmi_check_cb(const struct dmi_system_id *id) |
287 | { | 287 | { |
288 | printk("msi-laptop: Identified laptop model '%s'.\n", id->ident); | 288 | printk("msi-laptop: Identified laptop model '%s'.\n", id->ident); |
289 | return 0; | 289 | return 0; |
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index d38ddce592c0..e73a71f04bb4 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -807,7 +807,7 @@ static struct sony_nc_event *sony_nc_events; | |||
807 | /* Vaio C* --maybe also FE*, N* and AR* ?-- special init sequence | 807 | /* Vaio C* --maybe also FE*, N* and AR* ?-- special init sequence |
808 | * for Fn keys | 808 | * for Fn keys |
809 | */ | 809 | */ |
810 | static int sony_nc_C_enable(struct dmi_system_id *id) | 810 | static int sony_nc_C_enable(const struct dmi_system_id *id) |
811 | { | 811 | { |
812 | int result = 0; | 812 | int result = 0; |
813 | 813 | ||
@@ -845,7 +845,7 @@ static struct sony_nc_event sony_C_events[] = { | |||
845 | }; | 845 | }; |
846 | 846 | ||
847 | /* SNC-only model map */ | 847 | /* SNC-only model map */ |
848 | static struct dmi_system_id sony_nc_ids[] = { | 848 | static const struct dmi_system_id sony_nc_ids[] = { |
849 | { | 849 | { |
850 | .ident = "Sony Vaio FE Series", | 850 | .ident = "Sony Vaio FE Series", |
851 | .callback = sony_nc_C_enable, | 851 | .callback = sony_nc_C_enable, |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 0222bbaf7b76..6c0b2f0a51ab 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -4448,7 +4448,7 @@ static void ibm_exit(struct ibm_struct *ibm) | |||
4448 | 4448 | ||
4449 | static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp) | 4449 | static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp) |
4450 | { | 4450 | { |
4451 | struct dmi_device *dev = NULL; | 4451 | const struct dmi_device *dev = NULL; |
4452 | char ec_fw_string[18]; | 4452 | char ec_fw_string[18]; |
4453 | 4453 | ||
4454 | if (!tp) | 4454 | if (!tp) |
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 0691f473e9d4..4e9fd37cff35 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c | |||
@@ -500,7 +500,7 @@ static int __init pnpbios_probe_system(void) | |||
500 | return 0; | 500 | return 0; |
501 | } | 501 | } |
502 | 502 | ||
503 | static int __init exploding_pnp_bios(struct dmi_system_id *d) | 503 | static int __init exploding_pnp_bios(const struct dmi_system_id *d) |
504 | { | 504 | { |
505 | printk(KERN_WARNING "%s detected. Disabling PnPBIOS\n", d->ident); | 505 | printk(KERN_WARNING "%s detected. Disabling PnPBIOS\n", d->ident); |
506 | return 0; | 506 | return 0; |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 805e5fc5f5db..4db17f75f4f1 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -237,7 +237,7 @@ static int resume_detect_interrupts_are_broken(struct uhci_hcd *uhci) | |||
237 | static int remote_wakeup_is_broken(struct uhci_hcd *uhci) | 237 | static int remote_wakeup_is_broken(struct uhci_hcd *uhci) |
238 | { | 238 | { |
239 | int port; | 239 | int port; |
240 | char *sys_info; | 240 | const char *sys_info; |
241 | static char bad_Asus_board[] = "A7V8X"; | 241 | static char bad_Asus_board[] = "A7V8X"; |
242 | 242 | ||
243 | /* One of Asus's motherboards has a bug which causes it to | 243 | /* One of Asus's motherboards has a bug which causes it to |
diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c index 18ea4a549105..6455fd2a39f2 100644 --- a/drivers/video/imacfb.c +++ b/drivers/video/imacfb.c | |||
@@ -58,7 +58,7 @@ static int model = M_UNKNOWN; | |||
58 | static int manual_height; | 58 | static int manual_height; |
59 | static int manual_width; | 59 | static int manual_width; |
60 | 60 | ||
61 | static int set_system(struct dmi_system_id *id) | 61 | static int set_system(const struct dmi_system_id *id) |
62 | { | 62 | { |
63 | printk(KERN_INFO "imacfb: %s detected - set system to %ld\n", | 63 | printk(KERN_INFO "imacfb: %s detected - set system to %ld\n", |
64 | id->ident, (long)id->driver_data); | 64 | id->ident, (long)id->driver_data); |