public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids
@ 2010-12-07 15:31 Namhyung Kim
  2010-12-07 15:31 ` [PATCH 2/3] [SCSI] fdomain: fix compiler warning on fdomain_pci_tbl Namhyung Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Namhyung Kim @ 2010-12-07 15:31 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel, Adaptec OEM Raid Solutions

Annotate dptids as '__used' to fix following warning:

  CC      drivers/scsi/dpt_i2o.o
drivers/scsi/dpt_i2o.c:183: warning: ‘dptids’ defined but not used

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Adaptec OEM Raid Solutions <aacraid@adaptec.com>
---
 drivers/scsi/dpt_i2o.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index cffcb10..b276077 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -180,7 +180,7 @@ static u8 adpt_read_blink_led(adpt_hba* host)
  *============================================================================
  */
 
-static struct pci_device_id dptids[] = {
+static struct pci_device_id dptids[] __used = {
 	{ PCI_DPT_VENDOR_ID, PCI_DPT_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
 	{ PCI_DPT_VENDOR_ID, PCI_DPT_RAPTOR_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
 	{ 0, }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] [SCSI] fdomain: fix compiler warning on fdomain_pci_tbl
  2010-12-07 15:31 [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids Namhyung Kim
@ 2010-12-07 15:31 ` Namhyung Kim
  2010-12-07 15:31 ` [PATCH 3/3] [SCSI] initio: fix compiler warning on i91u_pci_devices Namhyung Kim
  2010-12-07 15:57 ` [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids James Bottomley
  2 siblings, 0 replies; 9+ messages in thread
From: Namhyung Kim @ 2010-12-07 15:31 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel, Rik Faith

Annotate fdomain_pci_tbl as '__used' to fix following warning:

  CC      drivers/scsi/fdomain.o
drivers/scsi/fdomain.c:1775: warning: ‘fdomain_pci_tbl’ defined but not used

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Rik Faith <faith@cs.unc.edu>
---
 drivers/scsi/fdomain.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 69b7aa5..974c0d9 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1772,7 +1772,7 @@ struct scsi_host_template fdomain_driver_template = {
 #ifndef PCMCIA
 #ifdef CONFIG_PCI
 
-static struct pci_device_id fdomain_pci_tbl[] __devinitdata = {
+static struct pci_device_id fdomain_pci_tbl[] __devinitdata __used = {
 	{ PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
 	{ }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] [SCSI] initio: fix compiler warning on i91u_pci_devices
  2010-12-07 15:31 [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids Namhyung Kim
  2010-12-07 15:31 ` [PATCH 2/3] [SCSI] fdomain: fix compiler warning on fdomain_pci_tbl Namhyung Kim
@ 2010-12-07 15:31 ` Namhyung Kim
  2010-12-07 15:57 ` [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids James Bottomley
  2 siblings, 0 replies; 9+ messages in thread
From: Namhyung Kim @ 2010-12-07 15:31 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel

Annotate i91u_pci_devices as '__used' to fix following warning:

  CC      drivers/scsi/initio.o
drivers/scsi/initio.c:131: warning: ‘i91u_pci_devices’ defined but not used

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 drivers/scsi/initio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 9627d06..01c54cf 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -128,7 +128,7 @@ static int setup_debug = 0;
 static void i91uSCBPost(u8 * pHcb, u8 * pScb);
 
 /* PCI Devices supported by this driver */
-static struct pci_device_id i91u_pci_devices[] = {
+static struct pci_device_id i91u_pci_devices[] __used = {
 	{ PCI_VENDOR_ID_INIT,  I950_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{ PCI_VENDOR_ID_INIT,  I940_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{ PCI_VENDOR_ID_INIT,  I935_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids
  2010-12-07 15:31 [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids Namhyung Kim
  2010-12-07 15:31 ` [PATCH 2/3] [SCSI] fdomain: fix compiler warning on fdomain_pci_tbl Namhyung Kim
  2010-12-07 15:31 ` [PATCH 3/3] [SCSI] initio: fix compiler warning on i91u_pci_devices Namhyung Kim
@ 2010-12-07 15:57 ` James Bottomley
  2010-12-07 16:12   ` Namhyung Kim
  2 siblings, 1 reply; 9+ messages in thread
From: James Bottomley @ 2010-12-07 15:57 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: linux-scsi, linux-kernel, Adaptec OEM Raid Solutions

On Wed, 2010-12-08 at 00:31 +0900, Namhyung Kim wrote:
> Annotate dptids as '__used' to fix following warning:
> 
>   CC      drivers/scsi/dpt_i2o.o
> drivers/scsi/dpt_i2o.c:183: warning: ‘dptids’ defined but not used
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> Cc: Adaptec OEM Raid Solutions <aacraid@adaptec.com>
> ---
>  drivers/scsi/dpt_i2o.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
> index cffcb10..b276077 100644
> --- a/drivers/scsi/dpt_i2o.c
> +++ b/drivers/scsi/dpt_i2o.c
> @@ -180,7 +180,7 @@ static u8 adpt_read_blink_led(adpt_hba* host)
>   *============================================================================
>   */
>  
> -static struct pci_device_id dptids[] = {
> +static struct pci_device_id dptids[] __used = {
>  	{ PCI_DPT_VENDOR_ID, PCI_DPT_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
>  	{ PCI_DPT_VENDOR_ID, PCI_DPT_RAPTOR_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
>  	{ 0, }

Um so this is definitely used in the MODULE_DEVICE_TABLE just below.

I deduce you have some type of config which causes that to be a nop
(say !CONFIG_MODULE)?  In which case, surely the correct fix is in
module.h?

James

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids
  2010-12-07 15:57 ` [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids James Bottomley
@ 2010-12-07 16:12   ` Namhyung Kim
  2010-12-07 16:30     ` James Bottomley
  0 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2010-12-07 16:12 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi, linux-kernel, Adaptec OEM Raid Solutions

2010-12-07 (화), 09:57 -0600, James Bottomley:
> Um so this is definitely used in the MODULE_DEVICE_TABLE just below.
> 
> I deduce you have some type of config which causes that to be a nop
> (say !CONFIG_MODULE)?  In which case, surely the correct fix is in
> module.h?
> 

Hi,

MODULE_DEVICE_TABLE expands to nop when !MODULE (not !CONFIG_MODULE) so
allyesconfig build always emits the warnings. Possible patch for this
would be wraping it up in #ifdefs but when I sent a same patch to Greg
KH he didn't want to add more #ifdefs in .c files.

-- 
Regards,
Namhyung Kim

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids
  2010-12-07 16:12   ` Namhyung Kim
@ 2010-12-07 16:30     ` James Bottomley
  2010-12-07 17:24       ` Namhyung Kim
  0 siblings, 1 reply; 9+ messages in thread
From: James Bottomley @ 2010-12-07 16:30 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: linux-scsi, linux-kernel

On Wed, 2010-12-08 at 01:12 +0900, Namhyung Kim wrote:
> 2010-12-07 (화), 09:57 -0600, James Bottomley:
> > Um so this is definitely used in the MODULE_DEVICE_TABLE just below.
> > 
> > I deduce you have some type of config which causes that to be a nop
> > (say !CONFIG_MODULE)?  In which case, surely the correct fix is in
> > module.h?
> > 
> 
> Hi,
> 
> MODULE_DEVICE_TABLE expands to nop when !MODULE (not !CONFIG_MODULE) so
> allyesconfig build always emits the warnings. Possible patch for this
> would be wraping it up in #ifdefs but when I sent a same patch to Greg
> KH he didn't want to add more #ifdefs in .c files.

I didn't mean changing any c files.  I meant fixing the module include
to make the table used even in the !MODULE case.  That way we only alter
one file instead of a significant proportion of the drivers.

James

---

diff --git a/include/linux/module.h b/include/linux/module.h
index 7575bbb..d49aa9c 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -90,7 +90,10 @@ extern const struct gtype##_id __mod_##gtype##_table		\
 extern struct module __this_module;
 #define THIS_MODULE (&__this_module)
 #else  /* !MODULE */
-#define MODULE_GENERIC_TABLE(gtype,name)
+/* Flag name as used to avoid warnings about the unused device id table */
+#define MODULE_GENERIC_TABLE(gtype,name)			\
+static const struct gtype##_id __mod_##gtype##_table		\
+  __attribute__ ((unused, alias(__stringify(name))))
 #define THIS_MODULE ((struct module *)0)
 #endif
 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids
  2010-12-07 16:30     ` James Bottomley
@ 2010-12-07 17:24       ` Namhyung Kim
  2010-12-08 16:20         ` Namhyung Kim
  0 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2010-12-07 17:24 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi, linux-kernel

2010-12-07 (화), 10:30 -0600, James Bottomley:
> On Wed, 2010-12-08 at 01:12 +0900, Namhyung Kim wrote:
> > MODULE_DEVICE_TABLE expands to nop when !MODULE (not !CONFIG_MODULE) so
> > allyesconfig build always emits the warnings. Possible patch for this
> > would be wraping it up in #ifdefs but when I sent a same patch to Greg
> > KH he didn't want to add more #ifdefs in .c files.
> 
> I didn't mean changing any c files.  I meant fixing the module include
> to make the table used even in the !MODULE case.  That way we only alter
> one file instead of a significant proportion of the drivers.
> 

It would not be a _significant_ proportion because normal drivers may
refer the table in their driver struct. :)

Anyway the patch below looks good to me. I'll happily drop my patches if
you apply this in your tree.

Thanks.

> 
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 7575bbb..d49aa9c 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -90,7 +90,10 @@ extern const struct gtype##_id __mod_##gtype##_table		\
>  extern struct module __this_module;
>  #define THIS_MODULE (&__this_module)
>  #else  /* !MODULE */
> -#define MODULE_GENERIC_TABLE(gtype,name)
> +/* Flag name as used to avoid warnings about the unused device id table */
> +#define MODULE_GENERIC_TABLE(gtype,name)			\
> +static const struct gtype##_id __mod_##gtype##_table		\
> +  __attribute__ ((unused, alias(__stringify(name))))
>  #define THIS_MODULE ((struct module *)0)
>  #endif
>  


-- 
Regards,
Namhyung Kim


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids
  2010-12-07 17:24       ` Namhyung Kim
@ 2010-12-08 16:20         ` Namhyung Kim
  2010-12-08 16:24           ` James Bottomley
  0 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2010-12-08 16:20 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi, linux-kernel

2010-12-08 (수), 02:24 +0900, Namhyung Kim:
> 2010-12-07 (화), 10:30 -0600, James Bottomley:
> > On Wed, 2010-12-08 at 01:12 +0900, Namhyung Kim wrote:
> > > MODULE_DEVICE_TABLE expands to nop when !MODULE (not !CONFIG_MODULE) so
> > > allyesconfig build always emits the warnings. Possible patch for this
> > > would be wraping it up in #ifdefs but when I sent a same patch to Greg
> > > KH he didn't want to add more #ifdefs in .c files.
> > 
> > I didn't mean changing any c files.  I meant fixing the module include
> > to make the table used even in the !MODULE case.  That way we only alter
> > one file instead of a significant proportion of the drivers.
> > 
> 
> It would not be a _significant_ proportion because normal drivers may
> refer the table in their driver struct. :)
> 
> Anyway the patch below looks good to me. I'll happily drop my patches if
> you apply this in your tree.
> 

Hi,

As akpm told me, using DEFINE_PCI_DEVICE_TABLE could also remove the
warnings (probably by making the table const) but it still requires
modifying .c files. What do you think?


-- 
Regards,
Namhyung Kim

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids
  2010-12-08 16:20         ` Namhyung Kim
@ 2010-12-08 16:24           ` James Bottomley
  0 siblings, 0 replies; 9+ messages in thread
From: James Bottomley @ 2010-12-08 16:24 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: linux-scsi, linux-kernel

On Thu, 2010-12-09 at 01:20 +0900, Namhyung Kim wrote:
> 2010-12-08 (수), 02:24 +0900, Namhyung Kim:
> > 2010-12-07 (화), 10:30 -0600, James Bottomley:
> > > On Wed, 2010-12-08 at 01:12 +0900, Namhyung Kim wrote:
> > > > MODULE_DEVICE_TABLE expands to nop when !MODULE (not !CONFIG_MODULE) so
> > > > allyesconfig build always emits the warnings. Possible patch for this
> > > > would be wraping it up in #ifdefs but when I sent a same patch to Greg
> > > > KH he didn't want to add more #ifdefs in .c files.
> > > 
> > > I didn't mean changing any c files.  I meant fixing the module include
> > > to make the table used even in the !MODULE case.  That way we only alter
> > > one file instead of a significant proportion of the drivers.
> > > 
> > 
> > It would not be a _significant_ proportion because normal drivers may
> > refer the table in their driver struct. :)
> > 
> > Anyway the patch below looks good to me. I'll happily drop my patches if
> > you apply this in your tree.
> > 
> 
> Hi,
> 
> As akpm told me, using DEFINE_PCI_DEVICE_TABLE could also remove the
> warnings (probably by making the table const) but it still requires
> modifying .c files. What do you think?

The warning only appears in the non-modular case, which is pretty
unusual for drivers nowadays, so I think the simplest elimination
solution is the best one (i.e. just kill it at source in the header).

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-12-08 16:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-07 15:31 [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids Namhyung Kim
2010-12-07 15:31 ` [PATCH 2/3] [SCSI] fdomain: fix compiler warning on fdomain_pci_tbl Namhyung Kim
2010-12-07 15:31 ` [PATCH 3/3] [SCSI] initio: fix compiler warning on i91u_pci_devices Namhyung Kim
2010-12-07 15:57 ` [PATCH 1/3] [SCSI] dpt_i2o: fix compiler warning on dptids James Bottomley
2010-12-07 16:12   ` Namhyung Kim
2010-12-07 16:30     ` James Bottomley
2010-12-07 17:24       ` Namhyung Kim
2010-12-08 16:20         ` Namhyung Kim
2010-12-08 16:24           ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox