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 /include | |
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 'include')
-rw-r--r-- | include/linux/dmi.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index b8ac7b01c45e..00fc7a9c35ec 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -54,7 +54,7 @@ struct dmi_strmatch { | |||
54 | }; | 54 | }; |
55 | 55 | ||
56 | struct dmi_system_id { | 56 | struct dmi_system_id { |
57 | int (*callback)(struct dmi_system_id *); | 57 | int (*callback)(const struct dmi_system_id *); |
58 | const char *ident; | 58 | const char *ident; |
59 | struct dmi_strmatch matches[4]; | 59 | struct dmi_strmatch matches[4]; |
60 | void *driver_data; | 60 | void *driver_data; |
@@ -71,22 +71,22 @@ struct dmi_device { | |||
71 | 71 | ||
72 | #ifdef CONFIG_DMI | 72 | #ifdef CONFIG_DMI |
73 | 73 | ||
74 | extern int dmi_check_system(struct dmi_system_id *list); | 74 | extern int dmi_check_system(const struct dmi_system_id *list); |
75 | extern char * dmi_get_system_info(int field); | 75 | extern const char * dmi_get_system_info(int field); |
76 | extern struct dmi_device * dmi_find_device(int type, const char *name, | 76 | extern const struct dmi_device * dmi_find_device(int type, const char *name, |
77 | struct dmi_device *from); | 77 | const struct dmi_device *from); |
78 | extern void dmi_scan_machine(void); | 78 | extern void dmi_scan_machine(void); |
79 | extern int dmi_get_year(int field); | 79 | extern int dmi_get_year(int field); |
80 | extern int dmi_name_in_vendors(char *str); | 80 | extern int dmi_name_in_vendors(const char *str); |
81 | 81 | ||
82 | #else | 82 | #else |
83 | 83 | ||
84 | static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } | 84 | static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; } |
85 | static inline char * dmi_get_system_info(int field) { return NULL; } | 85 | static inline const char * dmi_get_system_info(int field) { return NULL; } |
86 | static inline struct dmi_device * dmi_find_device(int type, const char *name, | 86 | static inline const struct dmi_device * dmi_find_device(int type, const char *name, |
87 | struct dmi_device *from) { return NULL; } | 87 | const struct dmi_device *from) { return NULL; } |
88 | static inline int dmi_get_year(int year) { return 0; } | 88 | static inline int dmi_get_year(int year) { return 0; } |
89 | static inline int dmi_name_in_vendors(char *s) { return 0; } | 89 | static inline int dmi_name_in_vendors(const char *s) { return 0; } |
90 | 90 | ||
91 | #endif | 91 | #endif |
92 | 92 | ||