LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jonas Bonn <jonas@southpole.se>
Cc: jonas@southpole.se, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, jgarzik@pobox.com,
	Greg KH <greg@kroah.com>
Subject: Re: [PATCH] net: use DECLARE_PCI_DEVICE_TABLE
Date: Thu, 6 Mar 2008 15:41:50 -0800	[thread overview]
Message-ID: <20080306154150.0ba906fa.akpm@linux-foundation.org> (raw)
In-Reply-To: <1204800947-21569-2-git-send-email-jonas@southpole.se>

On Thu,  6 Mar 2008 11:55:39 +0100
Jonas Bonn <jonas@southpole.se> wrote:

> Makes struct pci_device_id array const and moves it to __devinitconst
> 
> Signed-off-by: Jonas Bonn <jonas@southpole.se>
> ---
>  drivers/net/cassini.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
> index 14299f8..1451533 100644
> --- a/drivers/net/cassini.c
> +++ b/drivers/net/cassini.c
> @@ -233,7 +233,7 @@ static u16 link_modes[] __devinitdata = {
>  	CAS_BMCR_SPEED1000|BMCR_FULLDPLX /* 5 : 1000bt full duplex */
>  };
>  
> -static struct pci_device_id cas_pci_tbl[] __devinitdata = {
> +static DECLARE_PCI_DEVICE_TABLE(cas_pci_tbl) = {
>  	{ PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_CASSINI,
>  	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
>  	{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SATURN,

Bah.

a) DECLARE_PCI_DEVICE_TABLE is misnamed.  It is used to *define* tables,
   not to declare them.  It should be called DEFINE_PCI_DEVICE_TABLE.

b) It's lame, anyway.  We could implement any number of such helper
   thingies, but we choose not to.


So I wouldn't go adding code which uses this thing until it has a correct
name, and until we've decided that we actually want to live with it.


Here's the easy part:

 Documentation/pci.txt |    4 ++--
 include/linux/pci.h   |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -puN Documentation/pci.txt~rename-declare_pci_device_table-to-define_pci_device_table Documentation/pci.txt
--- a/Documentation/pci.txt~rename-declare_pci_device_table-to-define_pci_device_table
+++ a/Documentation/pci.txt
@@ -123,7 +123,7 @@ initialization with a pointer to a struc
 
 
 The ID table is an array of struct pci_device_id entries ending with an
-all-zero entry; use of the macro DECLARE_PCI_DEVICE_TABLE is the preferred
+all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred
 method of declaring the table.  Each entry consists of:
 
 	vendor,device	Vendor and device ID to match (or PCI_ANY_ID)
@@ -193,7 +193,7 @@ Tips on when/where to use the above attr
 	o Do not mark the struct pci_driver.
 
 	o The ID table array should be marked __devinitconst; this is done
-	  automatically if the table is declared with DECLARE_PCI_DEVICE_TABLE().
+	  automatically if the table is declared with DEFINE_PCI_DEVICE_TABLE().
 
 	o The probe() and remove() functions should be marked __devinit
 	  and __devexit respectively.  All initialization functions
diff -puN include/linux/pci.h~rename-declare_pci_device_table-to-define_pci_device_table include/linux/pci.h
--- a/include/linux/pci.h~rename-declare_pci_device_table-to-define_pci_device_table
+++ a/include/linux/pci.h
@@ -389,13 +389,13 @@ struct pci_driver {
 #define	to_pci_driver(drv) container_of(drv, struct pci_driver, driver)
 
 /**
- * DECLARE_PCI_DEVICE_TABLE - macro used to describe a pci device table
+ * DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table
  * @_table: device table name
  *
  * This macro is used to create a struct pci_device_id array (a device table)
  * in a generic manner.
  */
-#define DECLARE_PCI_DEVICE_TABLE(_table) \
+#define DEFINE_PCI_DEVICE_TABLE(_table) \
 	const struct pci_device_id _table[] __devinitconst
 
 /**
_


  parent reply	other threads:[~2008-03-06 23:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 10:55 struct pci_device_id declaration cleanups Jonas Bonn
2008-03-06 10:55 ` [PATCH] net: use DECLARE_PCI_DEVICE_TABLE Jonas Bonn
2008-03-06 10:55   ` Jonas Bonn
2008-03-06 10:55     ` Jonas Bonn
2008-03-06 10:55       ` Jonas Bonn
2008-03-06 10:55         ` Jonas Bonn
2008-03-06 10:55           ` Jonas Bonn
2008-03-06 10:55             ` Jonas Bonn
2008-03-06 10:55               ` Jonas Bonn
2008-03-06 10:55                 ` Jonas Bonn
2008-03-06 23:41   ` Andrew Morton [this message]
2008-03-07  0:18     ` David Miller
2008-03-07  7:58     ` Jonas Bonn
2008-03-06 12:25 ` struct pci_device_id declaration cleanups Christoph Hellwig
2008-03-06 12:36   ` Jonas Bonn

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=20080306154150.0ba906fa.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=jgarzik@pobox.com \
    --cc=jonas@southpole.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH] net: use DECLARE_PCI_DEVICE_TABLE' \
    /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

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).