From: Helge Deller <deller@gmx.de>
To: lenb@kernel.org, linux-acpi@vger.kernel.org
Subject: [PATCH] move DMI prefix strings into struct mafield[]
Date: Fri, 21 Nov 2008 17:59:49 +0100 [thread overview]
Message-ID: <200811211759.50021.deller@gmx.de> (raw)
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;
reply other threads:[~2008-11-21 17:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200811211759.50021.deller@gmx.de \
--to=deller@gmx.de \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox