All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: linux-can@vger.kernel.org
Subject: Re: [PATCH 3/3] can: af_can: fix sparse warning for can_rx_alldev_list
Date: Wed, 20 Jun 2012 10:00:10 +0200	[thread overview]
Message-ID: <4FE1830A.3020605@pengutronix.de> (raw)
In-Reply-To: <4FE1460F.8040409@hartkopp.net>

[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]

On 06/20/2012 05:39 AM, Oliver Hartkopp wrote:
> On 19.06.2012 22:05, Marc Kleine-Budde wrote:
> 
>> 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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2012-06-20  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-19 20:05 [PATCH 0/3] sparse fixes Marc Kleine-Budde
2012-06-19 20:05 ` [PATCH 1/3] can: cc770: fix sparse warning for cc770_interrupt Marc Kleine-Budde
2012-06-19 20:05 ` [PATCH 2/3] can: dev: fix sparse warning for can_restart Marc Kleine-Budde
2012-06-19 20:05 ` [PATCH 3/3] can: af_can: fix sparse warning for can_rx_alldev_list Marc Kleine-Budde
2012-06-20  3:39   ` Oliver Hartkopp
2012-06-20  8:00     ` Marc Kleine-Budde [this message]
2012-06-20 15:46       ` Oliver Hartkopp
2012-06-20 16:05         ` Marc Kleine-Budde
2012-06-20 16:06           ` Oliver Hartkopp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FE1830A.3020605@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.