All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: linux-kernel@vger.kernel.org
Cc: torvalds@transmeta.org
Subject: [patch] 2.4.13 remove unused warnings on module tables
Date: Mon, 29 Oct 2001 13:12:41 +1100	[thread overview]
Message-ID: <3030.1004321561@kao2.melbourne.sgi.com> (raw)
In-Reply-To: Your message of "Sun, 28 Oct 2001 10:03:17 -0800." <20011028100317.C8059@kroah.com>

On Sun, 28 Oct 2001 10:03:17 -0800, 
Greg KH <greg@kroah.com> wrote:
>On Sun, Oct 28, 2001 at 08:58:36PM +1100, Keith Owens wrote:
>> drivers/usb/serial/belkin_sa.c:106: warning: `id_table_combined' defined but not used
>These, and lots of the other pci_id table warnings are due to the tables
>being used for MODULE_DEVICE_TABLE() information.  When the code is not
>compiled as modules, those tables are not needed.

Against 2.4.13 or 2.4.13-ac*.  It adds a dummy reference (which is then
discarded) for module tables when code is built in.  This removes the
spurious warning messages.

Index: 13.1/include/linux/module.h
--- 13.1/include/linux/module.h Tue, 09 Oct 2001 11:09:32 +1000 kaos (linux-2.4/c/b/46_module.h 1.1.1.1.2.6.1.1 644)
+++ 13.13(w)/include/linux/module.h Mon, 29 Oct 2001 12:04:23 +1100 kaos (linux-2.4/c/b/46_module.h 1.1.1.1.2.8 644)
@@ -11,6 +11,7 @@
 #include <linux/spinlock.h>
 #include <linux/list.h>
 
+#ifndef CONFIG_KBUILD_2_5
 #ifdef __GENKSYMS__
 #  define _set_ver(sym) sym
 #  undef  MODVERSIONS
@@ -21,6 +22,7 @@
 #   include <linux/modversions.h>
 # endif
 #endif /* __GENKSYMS__ */
+#endif /* CONFIG_KBUILD_2_5 */
 
 #include <asm/atomic.h>
 
@@ -257,8 +259,6 @@ static const unsigned long __module_##gt
   __attribute__ ((unused)) = sizeof(struct gtype##_id); \
 static const struct gtype##_id * __module_##gtype##_table \
   __attribute__ ((unused)) = name
-#define MODULE_DEVICE_TABLE(type,name)		\
-  MODULE_GENERIC_TABLE(type##_device,name)
 
 /*
  * The following license idents are currently accepted as indicating free
@@ -312,8 +312,15 @@ static const char __module_using_checksu
 #define MODULE_SUPPORTED_DEVICE(name)
 #define MODULE_PARM(var,type)
 #define MODULE_PARM_DESC(var,desc)
-#define MODULE_GENERIC_TABLE(gtype,name)
-#define MODULE_DEVICE_TABLE(type,name)
+
+/* Create a dummy reference to the table to suppress gcc unused warnings.  Put
+ * the reference in the .data.exit section which is discarded when code is built
+ * in, so the reference does not bloat the running kernel.  Note: cannot be
+ * const, other exit data may be writable.
+ */
+#define MODULE_GENERIC_TABLE(gtype,name) \
+static struct gtype##_id * __module_##gtype##_table \
+  __attribute__ ((unused, __section__(".data.exit"))) = name
 
 #ifndef __GENKSYMS__
 
@@ -327,6 +334,9 @@ extern struct module *module_list;
 #endif /* !__GENKSYMS__ */
 
 #endif /* MODULE */
+
+#define MODULE_DEVICE_TABLE(type,name)		\
+  MODULE_GENERIC_TABLE(type##_device,name)
 
 /* Export a symbol either from the kernel or a module.
 


  reply	other threads:[~2001-10-29  2:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-28  9:58 2.4.13 errors and warnings Keith Owens
2001-10-28 18:03 ` Greg KH
2001-10-29  2:12   ` Keith Owens [this message]
2001-10-29  6:17     ` [patch] 2.4.13 remove unused warnings on module tables Jeff Garzik
2001-10-29  6:24       ` Keith Owens
2001-10-29  6:28         ` Jeff Garzik
2001-10-29 11:17   ` 2.4.13 errors and warnings Kai Germaschewski
2001-10-29 23:35     ` Greg KH

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=3030.1004321561@kao2.melbourne.sgi.com \
    --to=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.