mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-05 22:12:16 +00:00
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>
This commit is contained in:
parent
bbf25010f1
commit
1855256c49
35 changed files with 103 additions and 97 deletions
|
@ -54,7 +54,7 @@ struct dmi_strmatch {
|
|||
};
|
||||
|
||||
struct dmi_system_id {
|
||||
int (*callback)(struct dmi_system_id *);
|
||||
int (*callback)(const struct dmi_system_id *);
|
||||
const char *ident;
|
||||
struct dmi_strmatch matches[4];
|
||||
void *driver_data;
|
||||
|
@ -71,22 +71,22 @@ struct dmi_device {
|
|||
|
||||
#ifdef CONFIG_DMI
|
||||
|
||||
extern int dmi_check_system(struct dmi_system_id *list);
|
||||
extern char * dmi_get_system_info(int field);
|
||||
extern struct dmi_device * dmi_find_device(int type, const char *name,
|
||||
struct dmi_device *from);
|
||||
extern int dmi_check_system(const struct dmi_system_id *list);
|
||||
extern const char * dmi_get_system_info(int field);
|
||||
extern const struct dmi_device * dmi_find_device(int type, const char *name,
|
||||
const struct dmi_device *from);
|
||||
extern void dmi_scan_machine(void);
|
||||
extern int dmi_get_year(int field);
|
||||
extern int dmi_name_in_vendors(char *str);
|
||||
extern int dmi_name_in_vendors(const char *str);
|
||||
|
||||
#else
|
||||
|
||||
static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
|
||||
static inline char * dmi_get_system_info(int field) { return NULL; }
|
||||
static inline struct dmi_device * dmi_find_device(int type, const char *name,
|
||||
struct dmi_device *from) { return NULL; }
|
||||
static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
|
||||
static inline const char * dmi_get_system_info(int field) { return NULL; }
|
||||
static inline const struct dmi_device * dmi_find_device(int type, const char *name,
|
||||
const struct dmi_device *from) { return NULL; }
|
||||
static inline int dmi_get_year(int year) { return 0; }
|
||||
static inline int dmi_name_in_vendors(char *s) { return 0; }
|
||||
static inline int dmi_name_in_vendors(const char *s) { return 0; }
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue