public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Kennedy <richard@rsk.demon.co.uk>
To: airlied@linux.ie
Cc: lkml <linux-kernel@vger.kernel.org>, dri-devel@lists.sourceforge.net
Subject: [PATCH] drm: reorder struct drm_ioctl_desc to save space on 64 bit builds
Date: Wed, 18 Mar 2009 17:26:44 +0000	[thread overview]
Message-ID: <1237397204.2794.22.camel@localhost.localdomain> (raw)

drm: reorder struct drm_ioctl_desc to save space on 64 bit builds

shrinks drm_ioctl_desc from 24 bytes to 16 bytes by reordering members
to remove padding.

updates DRM_IOCTL_DEF macro to initialise structure members by name to
handle the structure reorder.

The applied patch reduces data used in drm.ko from 10440 to 9032

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
---

This patch is against v2.6.29-rc8, it compiles but hasn't had any other
testing as I don't have any of this hardware.

size reports
drm.ko
text	data	bss
106297	10440	144	116881	1c891
106297	9032	144	115473	1c311 +patch

I also built these 2 drivers
sis.ko
text data bss
3817	2116	0	5933	172d	
3817	1932	0	5749	1675 +patch

radeon.ko
text data bss
94744	9880	16400	121024
94744	9656	16400	120800 +patch

regards
Richard


diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e5f4ae9..62c2ef3 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -281,16 +281,16 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
 
 struct drm_ioctl_desc {
 	unsigned int cmd;
-	drm_ioctl_t *func;
 	int flags;
+	drm_ioctl_t *func;
 };
 
 /**
  * Creates a driver or general drm_ioctl_desc array entry for the given
  * ioctl, for use by drm_ioctl().
  */
-#define DRM_IOCTL_DEF(ioctl, func, flags) \
-	[DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags}
+#define DRM_IOCTL_DEF(ioctl, _func, _flags) \
+	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags}
 
 struct drm_magic_entry {
 	struct list_head head;



                 reply	other threads:[~2009-03-18 17:27 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=1237397204.2794.22.camel@localhost.localdomain \
    --to=richard@rsk.demon.co.uk \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.sourceforge.net \
    --cc=linux-kernel@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