* [PATCH] move DMI prefix strings into struct mafield[]
@ 2008-11-21 16:59 Helge Deller
0 siblings, 0 replies; only message in thread
From: Helge Deller @ 2008-11-21 16:59 UTC (permalink / raw)
To: lenb, linux-acpi
Move the DMI prefix strings (which are max. 3 chars long) directly into the
struct mafield[], instead of storing a pointer to them.
This introduces no functional changes, but gives the advantage of
saving some bytes in the executable (additional stringspace and the relocation
table entries are gone).
Signed-off-by: Helge Deller <deller@gmx.de>
--- a/drivers/firmware/dmi-id.c
+++ b/drivers/firmware/dmi-id.c
@@ -70,7 +70,7 @@ static void ascii_filter(char *d, const char *s)
static ssize_t get_modalias(char *buffer, size_t buffer_size)
{
static const struct mafield {
- const char *prefix;
+ char prefix[4];
int field;
} fields[] = {
{ "bvn", DMI_BIOS_VENDOR },
@@ -85,7 +85,7 @@ static ssize_t get_modalias(char *buffer, size_t buffer_size)
{ "cvn", DMI_CHASSIS_VENDOR },
{ "ct", DMI_CHASSIS_TYPE },
{ "cvr", DMI_CHASSIS_VERSION },
- { NULL, DMI_NONE }
+ { "", DMI_NONE }
};
ssize_t l, left;
@@ -95,7 +95,7 @@ static ssize_t get_modalias(char *buffer, size_t buffer_size)
strcpy(buffer, "dmi");
p = buffer + 3; left = buffer_size - 4;
- for (f = fields; f->prefix && left > 0; f++) {
+ for (f = fields; f->prefix[0] && left > 0; f++) {
const char *c;
char *t;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-11-21 17:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-21 16:59 [PATCH] move DMI prefix strings into struct mafield[] Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox