* [PATCH] net/sunrpc/svc.c: fix sparse warning
@ 2009-04-15 19:46 H Hartley Sweeten
2009-04-15 20:49 ` Jesper Juhl
2009-04-16 19:06 ` J. Bruce Fields
0 siblings, 2 replies; 10+ messages in thread
From: H Hartley Sweeten @ 2009-04-15 19:46 UTC (permalink / raw)
To: linux-kernel
Fix sparse warning in net/sunrpc/svc.c.
warning: symbol 'node' shadows an earlier one
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
---
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 8847add..e781135 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -122,7 +122,7 @@ module_param_call(pool_mode, param_set_pool_mode,
param_get_pool_mode,
static int
svc_pool_map_choose_mode(void)
{
- unsigned int node;
+ unsigned int nid;
if (num_online_nodes() > 1) {
/*
@@ -132,8 +132,8 @@ svc_pool_map_choose_mode(void)
return SVC_POOL_PERNODE;
}
- node = any_online_node(node_online_map);
- if (nr_cpus_node(node) > 2) {
+ nid = any_online_node(node_online_map);
+ if (nr_cpus_node(nid) > 2) {
/*
* Non-trivial SMP, or CONFIG_NUMA on
* non-NUMA hardware, e.g. with a generic
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] net/sunrpc/svc.c: fix sparse warning
2009-04-15 19:46 [PATCH] net/sunrpc/svc.c: fix sparse warning H Hartley Sweeten
@ 2009-04-15 20:49 ` Jesper Juhl
2009-04-15 22:27 ` H Hartley Sweeten
2009-04-16 19:06 ` J. Bruce Fields
1 sibling, 1 reply; 10+ messages in thread
From: Jesper Juhl @ 2009-04-15 20:49 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: linux-kernel
On Wed, 15 Apr 2009, H Hartley Sweeten wrote:
> Fix sparse warning in net/sunrpc/svc.c.
>
> warning: symbol 'node' shadows an earlier one
>
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
>
> ---
>
> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> index 8847add..e781135 100644
> --- a/net/sunrpc/svc.c
> +++ b/net/sunrpc/svc.c
> @@ -122,7 +122,7 @@ module_param_call(pool_mode, param_set_pool_mode,
> param_get_pool_mode,
> static int
> svc_pool_map_choose_mode(void)
> {
> - unsigned int node;
> + unsigned int nid;
>
> if (num_online_nodes() > 1) {
> /*
> @@ -132,8 +132,8 @@ svc_pool_map_choose_mode(void)
> return SVC_POOL_PERNODE;
> }
>
> - node = any_online_node(node_online_map);
> - if (nr_cpus_node(node) > 2) {
> + nid = any_online_node(node_online_map);
> + if (nr_cpus_node(nid) > 2) {
> /*
> * Non-trivial SMP, or CONFIG_NUMA on
> * non-NUMA hardware, e.g. with a generic
Looks sane to me.
Probably doesn't matter much, but feel free to add
Acked-by: Jesper Juhl <jj@chaosbits.net>
if you like...
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Plain text mails only, please http://www.expita.com/nomime.html
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
^ permalink raw reply [flat|nested] 10+ messages in thread* RE: [PATCH] net/sunrpc/svc.c: fix sparse warning
2009-04-15 20:49 ` Jesper Juhl
@ 2009-04-15 22:27 ` H Hartley Sweeten
0 siblings, 0 replies; 10+ messages in thread
From: H Hartley Sweeten @ 2009-04-15 22:27 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel
Fix sparse warning in net/sunrpc/svc.c.
warning: symbol 'node' shadows an earlier one
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Jesper Juhl <jj@chaosbits.net>
---
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 8847add..e781135 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -122,7 +122,7 @@ module_param_call(pool_mode, param_set_pool_mode,
param_get_pool_mode,
static int
svc_pool_map_choose_mode(void)
{
- unsigned int node;
+ unsigned int nid;
if (num_online_nodes() > 1) {
/*
@@ -132,8 +132,8 @@ svc_pool_map_choose_mode(void)
return SVC_POOL_PERNODE;
}
- node = any_online_node(node_online_map);
- if (nr_cpus_node(node) > 2) {
+ nid = any_online_node(node_online_map);
+ if (nr_cpus_node(nid) > 2) {
/*
* Non-trivial SMP, or CONFIG_NUMA on
* non-NUMA hardware, e.g. with a generic
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] net/sunrpc/svc.c: fix sparse warning
2009-04-15 19:46 [PATCH] net/sunrpc/svc.c: fix sparse warning H Hartley Sweeten
2009-04-15 20:49 ` Jesper Juhl
@ 2009-04-16 19:06 ` J. Bruce Fields
2009-04-16 19:15 ` H Hartley Sweeten
1 sibling, 1 reply; 10+ messages in thread
From: J. Bruce Fields @ 2009-04-16 19:06 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: linux-kernel
On Wed, Apr 15, 2009 at 03:46:13PM -0400, H Hartley Sweeten wrote:
> Fix sparse warning in net/sunrpc/svc.c.
>
> warning: symbol 'node' shadows an earlier one
What's the other symbol?
>
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
>
> ---
>
> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> index 8847add..e781135 100644
> --- a/net/sunrpc/svc.c
> +++ b/net/sunrpc/svc.c
> @@ -122,7 +122,7 @@ module_param_call(pool_mode, param_set_pool_mode,
> param_get_pool_mode,
> static int
> svc_pool_map_choose_mode(void)
> {
> - unsigned int node;
> + unsigned int nid;
>
> if (num_online_nodes() > 1) {
> /*
> @@ -132,8 +132,8 @@ svc_pool_map_choose_mode(void)
> return SVC_POOL_PERNODE;
> }
>
> - node = any_online_node(node_online_map);
> - if (nr_cpus_node(node) > 2) {
> + nid = any_online_node(node_online_map);
> + if (nr_cpus_node(nid) > 2) {
> /*
> * Non-trivial SMP, or CONFIG_NUMA on
> * non-NUMA hardware, e.g. with a generic
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread* RE: [PATCH] net/sunrpc/svc.c: fix sparse warning
2009-04-16 19:06 ` J. Bruce Fields
@ 2009-04-16 19:15 ` H Hartley Sweeten
2009-05-11 23:05 ` J. Bruce Fields
0 siblings, 1 reply; 10+ messages in thread
From: H Hartley Sweeten @ 2009-04-16 19:15 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: linux-kernel
On Thursday, April 16, 2009 12:06 PM, J. Bruce Fields wrote:
> On Wed, Apr 15, 2009 at 03:46:13PM -0400, H Hartley Sweeten wrote:
>> Fix sparse warning in net/sunrpc/svc.c.
>>
>> warning: symbol 'node' shadows an earlier one
>
> What's the other symbol?
Sorry. Left that out...
include/linux/nodemask.h
#define any_online_node(mask) \
({ \
int node; \
for_each_node_mask(node, (mask)) \
if (node_online(node)) \
break; \
node; \
})
arch/powerpc/mm/numa.c is the only other user of that macro. In that
file the local variable is called nid, hence the name change in this
patch.
Regards,
Hartley
>>
>> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
>>
>> ---
>>
>> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
>> index 8847add..e781135 100644
>> --- a/net/sunrpc/svc.c
>> +++ b/net/sunrpc/svc.c
>> @@ -122,7 +122,7 @@ module_param_call(pool_mode, param_set_pool_mode,
>> param_get_pool_mode,
>> static int
>> svc_pool_map_choose_mode(void)
>> {
>> - unsigned int node;
>> + unsigned int nid;
>>
>> if (num_online_nodes() > 1) {
>> /*
>> @@ -132,8 +132,8 @@ svc_pool_map_choose_mode(void)
>> return SVC_POOL_PERNODE;
>> }
>>
>> - node = any_online_node(node_online_map);
>> - if (nr_cpus_node(node) > 2) {
>> + nid = any_online_node(node_online_map);
>> + if (nr_cpus_node(nid) > 2) {
>> /*
>> * Non-trivial SMP, or CONFIG_NUMA on
>> * non-NUMA hardware, e.g. with a generic
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] net/sunrpc/svc.c: fix sparse warning
2009-04-16 19:15 ` H Hartley Sweeten
@ 2009-05-11 23:05 ` J. Bruce Fields
2009-05-14 15:58 ` H Hartley Sweeten
0 siblings, 1 reply; 10+ messages in thread
From: J. Bruce Fields @ 2009-05-11 23:05 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: linux-kernel
On Thu, Apr 16, 2009 at 03:15:17PM -0400, H Hartley Sweeten wrote:
> On Thursday, April 16, 2009 12:06 PM, J. Bruce Fields wrote:
> > On Wed, Apr 15, 2009 at 03:46:13PM -0400, H Hartley Sweeten wrote:
> >> Fix sparse warning in net/sunrpc/svc.c.
> >>
> >> warning: symbol 'node' shadows an earlier one
> >
> > What's the other symbol?
>
> Sorry. Left that out...
>
> include/linux/nodemask.h
>
> #define any_online_node(mask) \
> ({ \
> int node; \
> for_each_node_mask(node, (mask)) \
> if (node_online(node)) \
> break; \
> node; \
> })
>
> arch/powerpc/mm/numa.c is the only other user of that macro. In that
> file the local variable is called nid, hence the name change in this
> patch.
Stupid question (and sorry for the delay): any reason that macro
couldn't just be a static inline function?
I'm sort of resistant to the idea that the caller should have to care
what local variable names the implementation uses.
--b.
>
> Regards,
> Hartley
>
> >>
> >> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> >>
> >> ---
> >>
> >> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> >> index 8847add..e781135 100644
> >> --- a/net/sunrpc/svc.c
> >> +++ b/net/sunrpc/svc.c
> >> @@ -122,7 +122,7 @@ module_param_call(pool_mode, param_set_pool_mode,
> >> param_get_pool_mode,
> >> static int
> >> svc_pool_map_choose_mode(void)
> >> {
> >> - unsigned int node;
> >> + unsigned int nid;
> >>
> >> if (num_online_nodes() > 1) {
> >> /*
> >> @@ -132,8 +132,8 @@ svc_pool_map_choose_mode(void)
> >> return SVC_POOL_PERNODE;
> >> }
> >>
> >> - node = any_online_node(node_online_map);
> >> - if (nr_cpus_node(node) > 2) {
> >> + nid = any_online_node(node_online_map);
> >> + if (nr_cpus_node(nid) > 2) {
> >> /*
> >> * Non-trivial SMP, or CONFIG_NUMA on
> >> * non-NUMA hardware, e.g. with a generic
^ permalink raw reply [flat|nested] 10+ messages in thread* RE: [PATCH] net/sunrpc/svc.c: fix sparse warning
2009-05-11 23:05 ` J. Bruce Fields
@ 2009-05-14 15:58 ` H Hartley Sweeten
2009-05-14 16:00 ` J. Bruce Fields
0 siblings, 1 reply; 10+ messages in thread
From: H Hartley Sweeten @ 2009-05-14 15:58 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: linux-kernel
On Monday, May 11, 2009 4:06 PM, J. Bruce Fields wrote:
> On Thu, Apr 16, 2009 at 03:15:17PM -0400, H Hartley Sweeten wrote:
>> On Thursday, April 16, 2009 12:06 PM, J. Bruce Fields wrote:
>>> On Wed, Apr 15, 2009 at 03:46:13PM -0400, H Hartley Sweeten wrote:
>>>> Fix sparse warning in net/sunrpc/svc.c.
>>>>
>>>> warning: symbol 'node' shadows an earlier one
>>>
>>> What's the other symbol?
>>
>> Sorry. Left that out...
>>
>> include/linux/nodemask.h
>>
>> #define any_online_node(mask) \
>> ({ \
>> int node; \
>> for_each_node_mask(node, (mask)) \
>> if (node_online(node)) \
>> break; \
>> node; \
>> })
>>
>> arch/powerpc/mm/numa.c is the only other user of that macro. In that
>> file the local variable is called nid, hence the name change in this
>> patch.
>
> Stupid question (and sorry for the delay): any reason that macro
> couldn't just be a static inline function?
>
> I'm sort of resistant to the idea that the caller should have to care
> what local variable names the implementation uses.
That would probably be cleaner and it would prevent the same warning
from possibly occurring in the future. I just assumed it was originally
made a macro for a good reason.
Should I submit an updated patch changing the macro into an static
inline function?
Thanks,
Hartley
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] net/sunrpc/svc.c: fix sparse warning
2009-05-14 15:58 ` H Hartley Sweeten
@ 2009-05-14 16:00 ` J. Bruce Fields
2009-05-14 17:25 ` H Hartley Sweeten
0 siblings, 1 reply; 10+ messages in thread
From: J. Bruce Fields @ 2009-05-14 16:00 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: linux-kernel
On Thu, May 14, 2009 at 11:58:37AM -0400, H Hartley Sweeten wrote:
> On Monday, May 11, 2009 4:06 PM, J. Bruce Fields wrote:
> > On Thu, Apr 16, 2009 at 03:15:17PM -0400, H Hartley Sweeten wrote:
> >> On Thursday, April 16, 2009 12:06 PM, J. Bruce Fields wrote:
> >>> On Wed, Apr 15, 2009 at 03:46:13PM -0400, H Hartley Sweeten wrote:
> >>>> Fix sparse warning in net/sunrpc/svc.c.
> >>>>
> >>>> warning: symbol 'node' shadows an earlier one
> >>>
> >>> What's the other symbol?
> >>
> >> Sorry. Left that out...
> >>
> >> include/linux/nodemask.h
> >>
> >> #define any_online_node(mask) \
> >> ({ \
> >> int node; \
> >> for_each_node_mask(node, (mask)) \
> >> if (node_online(node)) \
> >> break; \
> >> node; \
> >> })
> >>
> >> arch/powerpc/mm/numa.c is the only other user of that macro. In that
> >> file the local variable is called nid, hence the name change in this
> >> patch.
> >
> > Stupid question (and sorry for the delay): any reason that macro
> > couldn't just be a static inline function?
> >
> > I'm sort of resistant to the idea that the caller should have to care
> > what local variable names the implementation uses.
>
> That would probably be cleaner and it would prevent the same warning
> from possibly occurring in the future. I just assumed it was originally
> made a macro for a good reason.
>
> Should I submit an updated patch changing the macro into an static
> inline function?
I'd be for it. If nothing else that'll probably be the fastest way to
find out if there was a good reason!
--b.
^ permalink raw reply [flat|nested] 10+ messages in thread* RE: [PATCH] net/sunrpc/svc.c: fix sparse warning
2009-05-14 16:00 ` J. Bruce Fields
@ 2009-05-14 17:25 ` H Hartley Sweeten
2009-05-14 19:02 ` J. Bruce Fields
0 siblings, 1 reply; 10+ messages in thread
From: H Hartley Sweeten @ 2009-05-14 17:25 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: linux-kernel
Change any_online_node() from a macro to a static inline function.
any_online_node() uses the symbol 'node', this causes a sparse
warning in net/sunrpc/svc.c. Changing the macro to a static
inline function removes the sparse warning and will prevent the
same warning from possibly occurring in the future.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
---
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 848025c..16df302 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -440,15 +440,6 @@ static inline int num_node_state(enum node_states state)
#define node_online_map node_states[N_ONLINE]
#define node_possible_map node_states[N_POSSIBLE]
-#define any_online_node(mask) \
-({ \
- int node; \
- for_each_node_mask(node, (mask)) \
- if (node_online(node)) \
- break; \
- node; \
-})
-
#define num_online_nodes() num_node_state(N_ONLINE)
#define num_possible_nodes() num_node_state(N_POSSIBLE)
#define node_online(node) node_state((node), N_ONLINE)
@@ -460,4 +451,15 @@ static inline int num_node_state(enum node_states state)
#define for_each_node(node) for_each_node_state(node, N_POSSIBLE)
#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
+static inline int any_online_node(nodemask_t mask)
+{
+ int node;
+
+ for_each_node_mask(node, mask) {
+ if (node_online(node))
+ break;
+ }
+ return node;
+}
+
#endif /* __LINUX_NODEMASK_H */
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] net/sunrpc/svc.c: fix sparse warning
2009-05-14 17:25 ` H Hartley Sweeten
@ 2009-05-14 19:02 ` J. Bruce Fields
0 siblings, 0 replies; 10+ messages in thread
From: J. Bruce Fields @ 2009-05-14 19:02 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: linux-kernel, akpm
On Thu, May 14, 2009 at 01:25:45PM -0400, H Hartley Sweeten wrote:
> Change any_online_node() from a macro to a static inline function.
>
> any_online_node() uses the symbol 'node', this causes a sparse
> warning in net/sunrpc/svc.c. Changing the macro to a static
> inline function removes the sparse warning and will prevent the
> same warning from possibly occurring in the future.
>
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
I'm not sure where this goes--so maybe Andrew should take it?
--b.
>
> ---
>
> diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
> index 848025c..16df302 100644
> --- a/include/linux/nodemask.h
> +++ b/include/linux/nodemask.h
> @@ -440,15 +440,6 @@ static inline int num_node_state(enum node_states state)
> #define node_online_map node_states[N_ONLINE]
> #define node_possible_map node_states[N_POSSIBLE]
>
> -#define any_online_node(mask) \
> -({ \
> - int node; \
> - for_each_node_mask(node, (mask)) \
> - if (node_online(node)) \
> - break; \
> - node; \
> -})
> -
> #define num_online_nodes() num_node_state(N_ONLINE)
> #define num_possible_nodes() num_node_state(N_POSSIBLE)
> #define node_online(node) node_state((node), N_ONLINE)
> @@ -460,4 +451,15 @@ static inline int num_node_state(enum node_states state)
> #define for_each_node(node) for_each_node_state(node, N_POSSIBLE)
> #define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
>
> +static inline int any_online_node(nodemask_t mask)
> +{
> + int node;
> +
> + for_each_node_mask(node, mask) {
> + if (node_online(node))
> + break;
> + }
> + return node;
> +}
> +
> #endif /* __LINUX_NODEMASK_H */
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-05-14 19:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-15 19:46 [PATCH] net/sunrpc/svc.c: fix sparse warning H Hartley Sweeten
2009-04-15 20:49 ` Jesper Juhl
2009-04-15 22:27 ` H Hartley Sweeten
2009-04-16 19:06 ` J. Bruce Fields
2009-04-16 19:15 ` H Hartley Sweeten
2009-05-11 23:05 ` J. Bruce Fields
2009-05-14 15:58 ` H Hartley Sweeten
2009-05-14 16:00 ` J. Bruce Fields
2009-05-14 17:25 ` H Hartley Sweeten
2009-05-14 19:02 ` J. Bruce Fields
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox