Skip to contentSkip to conversation

phy: Add missing forward declaration (fixes compiler warning)

PATCH In review Stefan Weil 2 participants 2 messages Aug 3, 2010 – Aug 15, 2010 Ethernet PHY

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: Add missing forward declaration (fixes compiler warning)

Without forward declaration for struct sk_buff, compilation of drivers/net/phy/fixed.c results in a warning:

CC drivers/net/phy/fixed.o
In file included from drivers/net/phy/fixed.c:20:
include/linux/phy.h:342: warning: 'struct sk_buff' declared inside parameter list include/linux/phy.h:342: warning: its scope is only this definition or declaration, which is probably not what you want include/linux/phy.h:343: warning: 'struct sk_buff' declared inside parameter list

(tested with linux kernel for openwrt / ar7, gcc-4.1.2)

Cc David S. Miller <[email protected]>
Cc Anton Vorontsov <[email protected]>
Cc Ben Hutchings <[email protected]>
Cc Jason Gunthorpe <[email protected]>
---
 include/linux/phy.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/phy.h +2 -0
index 987e111..65e8d72 100644
@@ -51,6 +51,8 @@
 #define PHY_HAS_INTERRUPT	0x00000001
 #define PHY_HAS_MAGICANEG	0x00000002
 
+struct sk_buff;
+
 /* Interface Mode definitions */
 typedef enum {
 	PHY_INTERFACE_MODE_MII,
Signature · 1 line
1.5.6.5
#1 lore raw

From: Stefan Weil <[email protected]>
Date: Tue, 3 Aug 2010 19:04:01 +0200

Quoted 2 lines

Without forward declaration for struct sk_buff, compilation of drivers/net/phy/fixed.c results in a warning:

linux/phy.h has had the appropriate forward declaration since July 16th

In fact the forward declaration was added by the only patch that added references to sk_buff in that header file:

--------------------
commit c1f19b51d1d87f3e3bb7e6648f43f7d57ed2da6b

Author: Richard Cochran <[email protected]>
Date:   Sat Jul 17 08:49:36 2010 +0000

net: support time stamping in phy devices.

...
--------------------

As per your warning:

--------------------
CC drivers/net/phy/fixed.o
In file included from drivers/net/phy/fixed.c:20:
include/linux/phy.h:342: warning: 'struct sk_buff' declared inside parameter list include/linux/phy.h:342: warning: its scope is only this definition or declaration, which is probably not what you want include/linux/phy.h:343: warning: 'struct sk_buff' declared inside parameter list

(tested with linux kernel for openwrt / ar7, gcc-4.1.2)
--------------------

Line 342 in the current tree lands on a comment. Please don't post patches against external trees, or you'll always run into problems like this. Who knows what patches happen to be applied to the openwrt tree you happen to have.

Always spin and test patches against upstream.