Skip to contentSkip to conversation

Fix build warnings in aer.h

PATCH In review Mike Qiu 4 participants 8 messages Jul 16, 2014 – Jul 22, 2014 PCI

lore
Share & tools
lore

Mike Qiu

author
#0 lore raw

PATCH 1/1 Fix build warnings in aer.h

build log:

In file included from include/ras/ras_event.h:11:0,

                 from drivers/ras/ras.c:13:

include/linux/aer.h:42:129: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:42:129: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

include/linux/aer.h:46:130: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:50:136: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:57:14: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

---
 include/linux/aer.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/aer.h +2 -0
index 4dbaa70..c826d1c 100644
@@ -11,6 +11,8 @@
 #define AER_FATAL			1
 #define AER_CORRECTABLE			2
 
+struct pci_dev;
+
 struct aer_header_log_regs {
 	unsigned int dw0;
 	unsigned int dw1;
Signature · 1 line
1.8.1.4
maintainer
#1 lore raw
Quoted 14 lines · Mike Qiu

build log:

In file included from include/ras/ras_event.h:11:0,

                 from drivers/ras/ras.c:13:

include/linux/aer.h:42:129: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:42:129: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

include/linux/aer.h:46:130: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

Quoted 7 lines

include/linux/aer.h:50:136: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:57:14: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

Hi Mike,

How did you reproduce this build error? There are other include files that use pci_dev without a previous declaration or include of include/linux/pci.h, e.g., include/linux/msi.h, so I want to make sure we don't have similar problems elsewhere.

Bjorn

Quoted 20 lines
---
 include/linux/aer.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/aer.h +2 -1
index 4dbaa70..c826d1c 100644
@@ -11,6 +11,8 @@
 #define AER_FATAL                      1
 #define AER_CORRECTABLE                        2
 
+struct pci_dev;
+
 struct aer_header_log_regs {
        unsigned int dw0;
        unsigned int dw1;
--

1.8.1.4

author
#2 lore raw
Quoted 21 lines · Bjorn Helgaas
Quoted 20 lines · Mike Qiu

build log:

In file included from include/ras/ras_event.h:11:0,

                  from drivers/ras/ras.c:13:

include/linux/aer.h:42:129: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:42:129: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

include/linux/aer.h:46:130: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:50:136: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:57:14: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

Quoted 7 lines
Quoted 1 line

Hi Mike,

How did you reproduce this build error? There are other include files that use pci_dev without a previous declaration or include of include/linux/pci.h, e.g., include/linux/msi.h, so I want to make sure we don't have similar problems elsewhere.

( I have reply it before but seems haven't send out successful, just resend it, if you have seen, pls ignore this) I checkout to linux-next master branch, see the top commit is:

commit b997a07604562f1a54cc531fe1cf7447f0ed6078

Author: Stephen Rothwell <[email protected]>
Date:   Tue Jul 15 18:34:28 2014 +1000

Add linux-next specific files for 20140715

Use default config file(copy from /boot/) then use command "make -j60", and it will show that message. but for "msi.h" I haven't see this warning.

Thanks,
Mike

Quoted 22 lines

Bjorn

Quoted 20 lines
---
  include/linux/aer.h | 2 ++
  1 file changed, 2 insertions(+)
include/linux/aer.h +2 -1
index 4dbaa70..c826d1c 100644
@@ -11,6 +11,8 @@
  #define AER_FATAL                      1
  #define AER_CORRECTABLE                        2
 
+struct pci_dev;
+
  struct aer_header_log_regs {
         unsigned int dw0;
         unsigned int dw1;
--

1.8.1.4

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Mike Qiu

[+cc Tuomas, Randy, Gavin, Gong, Lance, Tony]

Quoted 14 lines · Mike Qiu

build log:

In file included from include/ras/ras_event.h:11:0,

                 from drivers/ras/ras.c:13:

include/linux/aer.h:42:129: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:42:129: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

include/linux/aer.h:46:130: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

Quoted 7 lines

include/linux/aer.h:50:136: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:57:14: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

OK, so the problem doesn't occur on x86 because there we have a struct pci_dev declaration reached earlier via:

  drivers/ras/ras.c
    include/ras/ras_event.h
      include/linux/edac.h
        include/linux/device.h
          include/linux/gfp.h
            arch/x86/include/asm/mmzone.h
              arch/x86/include/asm/mmzone_64.h
                arch/x86/include/asm/smp.h
                  arch/x86/include/asm/mpspec.h
                    arch/x86/include/asm/x86_init.h
                      struct pci_dev;
      include/linux/aer.h
        ... pci_enable_pcie_error_reporting(struct pci_dev *dev);

You're building powerpc, which doesn't have the same pci_dev declaration in the arch header files, so you see the declaration problem in aer.h.

I could apply your fix, but it should go in v3.16 along with the commit (0a2409aad38e ("trace, AER: Move trace into unified interface")) that exposes the problem, and I'm leaving on vacation before I can get this into -next, have it smoke-tested, and ask Linus to pull it.

So you might want to ask Tony to put in his tree, since it looks like he merged 0a2409aad38e in the first place.

Please add these:

Fixes 0a2409aad38e ("trace, AER: Move trace into unified interface")

I know 0a2409aad38e isn't actually *responsible* for the problem, but anybody who backports 0a2409aad38e should pick up this fix as well.

Lance, I added you because of an unrelated issue I noticed while reviewing
this: you added the AER trace events with 1ca1d8d54f92 ("aerdrv: Trace Event for PCI Express Advanced Error Reporting"):

+#define aer_correctable_errors \
+ {BIT(0), "Receiver Error"}, \
...

I'd like to see all those "BIT(...)" things changed to use the #defines that already exist in include/uapi/linux/pci_regs.h, e.g., PCI_ERR_COR_RCVR. That way grep will find these uses, which will make maintenance easier. There's no hurry about this part, of course.

Bjorn

Quoted 20 lines
---
 include/linux/aer.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/aer.h +2 -0
index 4dbaa70..c826d1c 100644
@@ -11,6 +11,8 @@
 #define AER_FATAL                        1
 #define AER_CORRECTABLE                        2
 
+struct pci_dev;
+
 struct aer_header_log_regs {
         unsigned int dw0;
         unsigned int dw1;
Signature · 1 line
1.8.1.4
#4 lore raw
Quoted 42 lines · Bjorn Helgaas

[+cc Tuomas, Randy, Gavin, Gong, Lance, Tony]

Quoted 14 lines · Mike Qiu

build log:

In file included from include/ras/ras_event.h:11:0,

                 from drivers/ras/ras.c:13:

include/linux/aer.h:42:129: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:42:129: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

include/linux/aer.h:46:130: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

Quoted 7 lines

include/linux/aer.h:50:136: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:57:14: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

OK, so the problem doesn't occur on x86 because there we have a struct pci_dev declaration reached earlier via:

  drivers/ras/ras.c
    include/ras/ras_event.h
      include/linux/edac.h
        include/linux/device.h
          include/linux/gfp.h
            arch/x86/include/asm/mmzone.h
              arch/x86/include/asm/mmzone_64.h
                arch/x86/include/asm/smp.h
                  arch/x86/include/asm/mpspec.h
                    arch/x86/include/asm/x86_init.h
                      struct pci_dev;
      include/linux/aer.h
        ... pci_enable_pcie_error_reporting(struct pci_dev *dev);
Quoted 3 lines

You're building powerpc, which doesn't have the same pci_dev declaration in the arch header files, so you see the declaration problem in aer.h.

I get in on many i386 and x86_64 randconfig builds.... [checking]

20140715: 2 of 10 i386 randconfig builds 20140716: 1 of 10 i386 randconfig builds 20140717: 2 of 10 i386 randconfig builds 20140718: 1 of 10 i386 randconfig builds

20140715: 3 of 10 x86_64 randconfig builds 20140716: 1 of 10 x86_64 randconfig builds 20140717: 1 of 10 x86_64 randconfig builds 20140718: 2 of 10 x86_64 randconfig builds 20140721: 1 of 10 x86_64 randconfig builds

Quoted 49 lines

I could apply your fix, but it should go in v3.16 along with the commit (0a2409aad38e ("trace, AER: Move trace into unified interface")) that exposes the problem, and I'm leaving on vacation before I can get this into -next, have it smoke-tested, and ask Linus to pull it.

So you might want to ask Tony to put in his tree, since it looks like he merged 0a2409aad38e in the first place.

Please add these:

Fixes 0a2409aad38e ("trace, AER: Move trace into unified interface")

I know 0a2409aad38e isn't actually *responsible* for the problem, but anybody who backports 0a2409aad38e should pick up this fix as well.

Lance, I added you because of an unrelated issue I noticed while reviewing
this: you added the AER trace events with 1ca1d8d54f92 ("aerdrv: Trace Event for PCI Express Advanced Error Reporting"):

+#define aer_correctable_errors \
+ {BIT(0), "Receiver Error"}, \
...

I'd like to see all those "BIT(...)" things changed to use the #defines that already exist in include/uapi/linux/pci_regs.h, e.g., PCI_ERR_COR_RCVR. That way grep will find these uses, which will make maintenance easier. There's no hurry about this part, of course.

Bjorn

Quoted 18 lines
---
 include/linux/aer.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/aer.h +2 -0
index 4dbaa70..c826d1c 100644
@@ -11,6 +11,8 @@
 #define AER_FATAL                        1
 #define AER_CORRECTABLE                        2
 
+struct pci_dev;
+
 struct aer_header_log_regs {
         unsigned int dw0;
         unsigned int dw1;
Signature · 1 line
~Randy
maintainer
#5 lore raw
Quoted 43 lines · Randy Dunlap
Quoted 42 lines · Bjorn Helgaas

[+cc Tuomas, Randy, Gavin, Gong, Lance, Tony]

Quoted 14 lines · Mike Qiu

build log:

In file included from include/ras/ras_event.h:11:0,

                 from drivers/ras/ras.c:13:

include/linux/aer.h:42:129: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:42:129: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

include/linux/aer.h:46:130: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

Quoted 7 lines

include/linux/aer.h:50:136: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:57:14: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

OK, so the problem doesn't occur on x86 because there we have a struct pci_dev declaration reached earlier via:

  drivers/ras/ras.c
    include/ras/ras_event.h
      include/linux/edac.h
        include/linux/device.h
          include/linux/gfp.h
            arch/x86/include/asm/mmzone.h
              arch/x86/include/asm/mmzone_64.h
                arch/x86/include/asm/smp.h
                  arch/x86/include/asm/mpspec.h
                    arch/x86/include/asm/x86_init.h
                      struct pci_dev;
      include/linux/aer.h
        ... pci_enable_pcie_error_reporting(struct pci_dev *dev);
Quoted 5 lines
Quoted 3 lines

You're building powerpc, which doesn't have the same pci_dev declaration in the arch header files, so you see the declaration problem in aer.h.

I get in on many i386 and x86_64 randconfig builds.... [checking]

Yeah, I should have said *an* x86 config doesn't see the problem. There are lots of config variable involved in that path.

Quoted 8 lines
Quoted 8 lines

I could apply your fix, but it should go in v3.16 along with the commit (0a2409aad38e ("trace, AER: Move trace into unified interface")) that exposes the problem, and I'm leaving on vacation before I can get this into -next, have it smoke-tested, and ask Linus to pull it.

So you might want to ask Tony to put in his tree, since it looks like he merged 0a2409aad38e in the first place.

Quoted 7 lines
Quoted 7 lines

Please add these:

Fixes 0a2409aad38e ("trace, AER: Move trace into unified interface")

I know 0a2409aad38e isn't actually *responsible* for the problem, but anybody who backports 0a2409aad38e should pick up this fix as well.

Actually, since 0a2409aad38e is still in -next, the fix could be merged first to avoid the bisection trap here. But I don't know how Tony feels about rebasing his branches.

Bjorn

#6 lore raw

PATCH 1/1 Fix build warnings in aer.h

From: Mike Qiu <[email protected]>

build log:

In file included from include/ras/ras_event.h:11:0,

                 from drivers/ras/ras.c:13:

include/linux/aer.h:42:129: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:42:129: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

include/linux/aer.h:46:130: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:50:136: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:57:14: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

---
 include/linux/aer.h | 2 ++
 1 file changed, 2 insertions(+)

Linus: The breakage that this fixes is actually only in linux-next, but the commits that found this gap are already in the tip tree, so hard to rebase to get this fix ahead of them to avoid a bisection gap. But since this is so obvious - perhaps it can go into 3.16? If you don't want it, I'll ask hpa to add it to the right topic branch in tip so it is at least close to the commit that reveals the gap.

include/linux/aer.h +2 -0
index 4dbaa70..c826d1c 100644
@@ -11,6 +11,8 @@
 #define AER_FATAL			1
 #define AER_CORRECTABLE			2
 
+struct pci_dev;
+
 struct aer_header_log_regs {
 	unsigned int dw0;
 	unsigned int dw1;
Signature · 6 lines
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-by Tested-by on v1 1/1
#7 lore raw
In reply to Mike Qiu
Quoted 2 lines · Mike Qiu

build log:

When CONFIG_PCIEAER is not enabled:

Quoted 12 lines

In file included from include/ras/ras_event.h:11:0,

                 from drivers/ras/ras.c:13:

include/linux/aer.h:42:129: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:42:129: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

include/linux/aer.h:46:130: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

Quoted 7 lines

include/linux/aer.h:50:136: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

include/linux/aer.h:57:14: warning: ‘struct pci_dev’ declared inside parameter list [enabled by default]

Quoted 18 lines
---
 include/linux/aer.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/aer.h +2 -0
index 4dbaa70..c826d1c 100644
@@ -11,6 +11,8 @@
 #define AER_FATAL			1
 #define AER_CORRECTABLE			2
 
+struct pci_dev;
+
 struct aer_header_log_regs {
 	unsigned int dw0;
 	unsigned int dw1;
Signature · 1 line
~Randy