Thread (9 messages) 9 messages, 2 authors, 2012-06-20

Re: [PATCH 3/3] can: af_can: fix sparse warning for can_rx_alldev_list

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2012-06-20 08:00:13

On 06/20/2012 05:39 AM, Oliver Hartkopp wrote:
On 19.06.2012 22:05, Marc Kleine-Budde wrote:
quoted
Make can_rx_alldev_list static to fix the following sparse warning:
net/can/af_can.c:80:22: warning: symbol 'can_rx_alldev_list' was not
declared. Should it be static?

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/af_can.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 821022a..ccef846 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -78,7 +78,7 @@ module_param(stats_timer, int, S_IRUGO);
 MODULE_PARM_DESC(stats_timer, "enable timer for statistics (default:on)");
 
 /* receive filters subscribed for 'all' CAN devices */
-struct dev_rcv_lists can_rx_alldev_list;
+static struct dev_rcv_lists can_rx_alldev_list;
 static DEFINE_SPINLOCK(can_rcvlists_lock);
 
 static struct kmem_cache *rcv_cache __read_mostly;

Hello Marc,

did you already compile this?
Compile yes, link no :D
can_rx_alldev_list is used in af_can.c and proc.c :

$ grep can_rx_alldev_list *.c
af_can.c:struct dev_rcv_lists can_rx_alldev_list;
af_can.c:		return &can_rx_alldev_list;
af_can.c:	matches = can_rcv_filter(&can_rx_alldev_list, skb);
af_can.c:	memset(&can_rx_alldev_list, 0, sizeof(can_rx_alldev_list));
proc.c:extern struct dev_rcv_lists can_rx_alldev_list;
         ^^^^^^
proc.c:	d = &can_rx_alldev_list;
proc.c:	d = &can_rx_alldev_list;

So i wonder if making it static inside af_can.c is a good idea.

Is there no way to satisfy the sparse warning in another way?
Yes, don't use extern, put it into af_can.h.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help