From: "Alexey Dobriyan" <adobriyan@gmail.com>
To: "Andrew Morton" <akpm@linux-foundation.org>
Cc: "Greg KH" <greg@kroah.com>, "Jeff Garzik" <jeff@garzik.org>,
"Kees Cook" <kees@ubuntu.com>,
linux-kernel@vger.kernel.org, "Ben Collins" <bcollins@ubuntu.com>,
"Michael Wu" <flamingice@sourmilk.net>
Subject: Re: [PATCH] pci: fix unterminated pci_device_id lists
Date: Thu, 13 Sep 2007 10:34:02 +0400 [thread overview]
Message-ID: <b6fcc0a0709122334qa31fffby4afbf857c92efb89@mail.gmail.com> (raw)
In-Reply-To: <20070912160827.e359a53b.akpm@linux-foundation.org>
[non-terminated PCI ids arrays]
Here is compile-time hack (yep, warped and whitespace damaged :))
It's better than modpost-time hack. because it triggers earlier.
It's worse than modpost-time hack, because of tree-wide changes.
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index f4e4298..b895b5f 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -237,7 +237,7 @@ static const struct {
};
-static struct pci_device_id rtl8139_pci_tbl[] = {
+PCI_MODULE_DEVICE_TABLE_BEGIN(rtl8139_pci_tbl)
{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
@@ -273,10 +273,7 @@ static struct pci_device_id rtl8139_pci_tbl[] = {
{PCI_ANY_ID, 0x8139, 0x10ec, 0x8139, 0, 0, RTL8139 },
{PCI_ANY_ID, 0x8139, 0x1186, 0x1300, 0, 0, RTL8139 },
{PCI_ANY_ID, 0x8139, 0x13d1, 0xab06, 0, 0, RTL8139 },
-
- {0,}
-};
-MODULE_DEVICE_TABLE (pci, rtl8139_pci_tbl);
+PCI_MODULE_DEVICE_TABLE_END
static struct {
const char str[ETH_GSTRING_LEN];
diff --git a/include/linux/module.h b/include/linux/module.h
index b6a646c..aef3cd9 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -137,6 +137,13 @@ extern struct module __this_module;
#define MODULE_DEVICE_TABLE(type,name) \
MODULE_GENERIC_TABLE(type##_device,name)
+#define PCI_MODULE_DEVICE_TABLE_BEGIN(name) \
+ MODULE_DEVICE_TABLE(pci, name); \
+ static struct pci_device_id name[] = {
+
+#define PCI_MODULE_DEVICE_TABLE_END \
+ {}};
+
/* Version of form [<epoch>:]<version>[-<extra-version>].
Or for CVS/RCS ID version, everything but the number is stripped.
<epoch>: A (small) unsigned integer which allows you to start versions
next prev parent reply other threads:[~2007-09-13 6:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-12 6:41 Kees Cook
2007-09-12 11:10 ` Jeff Garzik
2007-09-12 11:48 ` Alexey Dobriyan
2007-09-12 21:53 ` Greg KH
2007-09-12 23:08 ` Andrew Morton
2007-09-13 6:34 ` Alexey Dobriyan [this message]
2007-09-13 6:42 ` Jeff Garzik
2007-09-15 9:01 ` Jan Engelhardt
2007-09-13 6:58 ` Sam Ravnborg
2007-09-13 0:49 ` [PATCH] modpost: detect unterminated device id lists Kees Cook
2007-09-13 1:21 ` Andrew Morton
2007-09-16 22:14 ` Andrew Morton
2007-09-17 0:24 ` Satyam Sharma
2007-09-17 6:46 ` Andrew Morton
2007-09-17 21:45 ` Satyam Sharma
2007-09-17 21:50 ` Andrew Morton
2007-09-17 23:36 ` Mauro Carvalho Chehab
2007-09-17 1:22 ` Satyam Sharma
2007-09-17 3:45 ` Kees Cook
2007-09-17 6:48 ` Andrew Morton
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=b6fcc0a0709122334qa31fffby4afbf857c92efb89@mail.gmail.com \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bcollins@ubuntu.com \
--cc=flamingice@sourmilk.net \
--cc=greg@kroah.com \
--cc=jeff@garzik.org \
--cc=kees@ubuntu.com \
--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
Powered by JetHome