* [patch] pci: type may be unused in pci_access_init()
@ 2007-04-30 14:34 David Rientjes
2007-05-01 2:22 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: David Rientjes @ 2007-04-30 14:34 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel
The automatic 'type' variable is unused in !CONFIG_PCI_DIRECT and
!CONFIG_PCI_MMCONFIG.
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: David Rientjes <rientjes@google.com>
---
arch/i386/pci/init.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/i386/pci/init.c b/arch/i386/pci/init.c
--- a/arch/i386/pci/init.c
+++ b/arch/i386/pci/init.c
@@ -6,7 +6,7 @@
in the right sequence from here. */
static __init int pci_access_init(void)
{
- int type = 0;
+ int type __attribute__((unused)) = 0;
#ifdef CONFIG_PCI_DIRECT
type = pci_direct_probe();
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch] pci: type may be unused in pci_access_init() 2007-04-30 14:34 [patch] pci: type may be unused in pci_access_init() David Rientjes @ 2007-05-01 2:22 ` Andrew Morton 2007-05-01 2:46 ` David Rientjes 0 siblings, 1 reply; 4+ messages in thread From: Andrew Morton @ 2007-05-01 2:22 UTC (permalink / raw) To: David Rientjes; +Cc: Greg Kroah-Hartman, linux-kernel On Mon, 30 Apr 2007 07:34:52 -0700 (PDT) David Rientjes <rientjes@google.com> wrote: > The automatic 'type' variable is unused in !CONFIG_PCI_DIRECT and > !CONFIG_PCI_MMCONFIG. > > Cc: Greg Kroah-Hartman <gregkh@suse.de> > Signed-off-by: David Rientjes <rientjes@google.com> > --- > arch/i386/pci/init.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/i386/pci/init.c b/arch/i386/pci/init.c > --- a/arch/i386/pci/init.c > +++ b/arch/i386/pci/init.c > @@ -6,7 +6,7 @@ Please use `diff -p'. > in the right sequence from here. */ > static __init int pci_access_init(void) > { > - int type = 0; > + int type __attribute__((unused)) = 0; We have __attribute_used__ for this, but the implementation looks whacky: it's there for gcc-3 but not for gcc-4 and the intel compiler. But it looks like the gcc-3 version is there to iron over a gcc implementation glitch. > #ifdef CONFIG_PCI_DIRECT > type = pci_direct_probe(); Of course, one could do int type = pci_direct_probe(); here instead, but that's a bit fragile. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] pci: type may be unused in pci_access_init() 2007-05-01 2:22 ` Andrew Morton @ 2007-05-01 2:46 ` David Rientjes 2007-05-01 3:20 ` Andrew Morton 0 siblings, 1 reply; 4+ messages in thread From: David Rientjes @ 2007-05-01 2:46 UTC (permalink / raw) To: Andrew Morton; +Cc: Greg Kroah-Hartman, linux-kernel On Mon, 30 Apr 2007, Andrew Morton wrote: > On Mon, 30 Apr 2007 07:34:52 -0700 (PDT) David Rientjes <rientjes@google.com> wrote: > > > The automatic 'type' variable is unused in !CONFIG_PCI_DIRECT and > > !CONFIG_PCI_MMCONFIG. > > > > Cc: Greg Kroah-Hartman <gregkh@suse.de> > > Signed-off-by: David Rientjes <rientjes@google.com> > > --- > > arch/i386/pci/init.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/arch/i386/pci/init.c b/arch/i386/pci/init.c > > --- a/arch/i386/pci/init.c > > +++ b/arch/i386/pci/init.c > > @@ -6,7 +6,7 @@ > > Please use `diff -p'. > The patch would have appeared the same, pci_access_init() is the first function (and there are no prototypes) in arch/i386/pci/init.c and at line 6 it had not yet begun. diff -rupN a/init.c b/init.c --- a/init.c 2007-04-30 19:28:59.887833000 -0700 +++ b/init.c 2007-04-30 19:29:26.615993000 -0700 @@ -6,7 +6,7 @@ in the right sequence from here. */ static __init int pci_access_init(void) { - int type = 0; + int type __attribute__((unused)) = 0; #ifdef CONFIG_PCI_DIRECT type = pci_direct_probe(); > > #ifdef CONFIG_PCI_DIRECT > > type = pci_direct_probe(); > > Of course, one could do > > int type = pci_direct_probe(); > > here instead, but that's a bit fragile. > No, because 'type' can be referenced in the !CONFIG_PCI_DIRECT and CONFIG_PCI_MMCONFIG case: static __init int pci_access_init(void) { int type = 0; #ifdef CONFIG_PCI_DIRECT type = pci_direct_probe(); #endif #ifdef CONFIG_PCI_MMCONFIG pci_mmcfg_init(type); #endif ... So, due to the whacky implementation of __attribute_used__, we can just do this: --- arch/i386/pci/init.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/i386/pci/init.c b/arch/i386/pci/init.c index b21b6da..508d6fd 100644 --- a/arch/i386/pci/init.c +++ b/arch/i386/pci/init.c @@ -6,7 +6,9 @@ in the right sequence from here. */ static __init int pci_access_init(void) { +#if defined(CONFIG_PCI_DIRECT) || defined(CONFIG_PCI_MMCONFIG) int type = 0; +#endif #ifdef CONFIG_PCI_DIRECT type = pci_direct_probe(); ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch] pci: type may be unused in pci_access_init() 2007-05-01 2:46 ` David Rientjes @ 2007-05-01 3:20 ` Andrew Morton 0 siblings, 0 replies; 4+ messages in thread From: Andrew Morton @ 2007-05-01 3:20 UTC (permalink / raw) To: David Rientjes; +Cc: Greg Kroah-Hartman, linux-kernel On Mon, 30 Apr 2007 19:46:12 -0700 (PDT) David Rientjes <rientjes@google.com> wrote: > So, due to the whacky implementation of __attribute_used__, we can just do > this: > --- > arch/i386/pci/init.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/arch/i386/pci/init.c b/arch/i386/pci/init.c > index b21b6da..508d6fd 100644 > --- a/arch/i386/pci/init.c > +++ b/arch/i386/pci/init.c > @@ -6,7 +6,9 @@ > in the right sequence from here. */ > static __init int pci_access_init(void) > { > +#if defined(CONFIG_PCI_DIRECT) || defined(CONFIG_PCI_MMCONFIG) > int type = 0; > +#endif Drat, I was hoping someone would unwhacky __attribute_used__. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-01 3:21 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-04-30 14:34 [patch] pci: type may be unused in pci_access_init() David Rientjes 2007-05-01 2:22 ` Andrew Morton 2007-05-01 2:46 ` David Rientjes 2007-05-01 3:20 ` Andrew Morton
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox