linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Rusty Russell <rusty@rustcorp.com.au>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Quentin Casasnovas <quentin.casasnovas@oracle.com>
Subject: mod_devicetable: Make dmi_strmatch.substr const char *
Date: Mon, 18 May 2015 17:07:35 -0700	[thread overview]
Message-ID: <1431994055.2870.102.camel@perches.com> (raw)

Hey David, Rusty, Quentin

This commit:
------------------------------
commit d945b697d0eea5a811ec299c5f1a25889bb0242b
From: David Woodhouse <dwmw2@infradead.org>
Date: Tue, 16 Sep 2008 16:23:28 -0700
Subject: [PATCH] Automatic MODULE_ALIAS() for DMI match tables.

This makes modpost handle MODULE_DEVICE_TABLE(dmi, xxxx).

I had to change the string pointers in the match table to char arrays,
and picked a size of 79 bytes almost at random -- do we need to make it
bigger than that? I was a bit concerned about the 'bloat' this
introduces into the match tables, but they should all be __initdata so
it shouldn't matter too much.

(Actually, modpost does go through the relocations and look at most of
them; it wouldn't be impossible to make it handle string pointers -- but
doesn't seem to be worth the effort, since they're __initdata).
------------------------------
	
changed dmi_strmatch.substr from char * to char[79];

Changing it back to const char * would shrink an x86-64
defconfig more than 100KB.

$ size vmlinux.old vmlinux.new
    text    data     bss      dec    hex filename
11941725 1825624 1085440 14852789 e2a2b5 vmlinux.old
11921172 1730648 1085440 14737260 e0df6c vmlinux.new

modpost has changed a bit since 2008, is it's time to change it back?

---
 include/linux/mod_devicetable.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

---
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 7ab00d6..66c4309 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -462,7 +462,7 @@ enum dmi_field {
 struct dmi_strmatch {
 	unsigned char slot:7;
 	unsigned char exact_match:1;
-	char substr[79];
+	const char *substr;
 };
 
 struct dmi_system_id {



             reply	other threads:[~2015-05-19  0:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19  0:07 Joe Perches [this message]
2015-05-19  6:46 ` mod_devicetable: Make dmi_strmatch.substr const char * David Woodhouse
2015-05-19 15:56   ` One Thousand Gnomes
2015-05-19 19:19     ` Joe Perches
2015-05-20  5:19       ` Rusty Russell
2015-05-20  7:25         ` Michal Marek
2015-05-20  7:58           ` Joe Perches
2015-05-20 20:31           ` Rusty Russell

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=1431994055.2870.102.camel@perches.com \
    --to=joe@perches.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quentin.casasnovas@oracle.com \
    --cc=rusty@rustcorp.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).