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 <[email protected]>
Cc: Adaptec OEM Raid Solutions <[email protected]>
---
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
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 <[email protected]>
Cc: Rik Faith <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
> Cc: Adaptec OEM Raid Solutions <[email protected]>
> ---
> 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
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
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
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
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
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