[PATCH] move DMI prefix strings into struct mafield[]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>

--- 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;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux