linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drivers/base/node.c: make CACHE_ATTR define static DEVICE_ATTR_RO
@ 2021-05-13 11:07 Ruiqi Gong
  2021-05-13 11:26 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Ruiqi Gong @ 2021-05-13 11:07 UTC (permalink / raw)
  To: gongruiqi1, Greg Kroah-Hartman
  Cc: Wang Weiyang, linux-kernel, kernel-janitors

The Sparse tool reports as follows:

drivers/base/node.c:239:1: warning:
 symbol 'dev_attr_line_size' was not declared. Should it be static?
drivers/base/node.c:240:1: warning:
 symbol 'dev_attr_indexing' was not declared. Should it be static?

These symbols (and several others) are defined by DEVICE_ATTR_RO(name) in
CACHE_ATTR(name, fmt), and all of them are not used outside of node.c. So let's
mark DEVICE_ATTR_RO(name) static to solve these complains from Sparse.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ruiqi Gong <gongruiqi1@huawei.com>
---
 drivers/base/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index f449dbb2c746..27f251c2742a 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -233,7 +233,7 @@ static ssize_t name##_show(struct device *dev,				\
 	return sysfs_emit(buf, fmt "\n",				\
 			  to_cache_info(dev)->cache_attrs.name);	\
 }									\
-DEVICE_ATTR_RO(name);
+static DEVICE_ATTR_RO(name);
 
 CACHE_ATTR(size, "%llu")
 CACHE_ATTR(line_size, "%u")


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] drivers/base/node.c: make CACHE_ATTR define static DEVICE_ATTR_RO
  2021-05-13 11:07 [PATCH -next] drivers/base/node.c: make CACHE_ATTR define static DEVICE_ATTR_RO Ruiqi Gong
@ 2021-05-13 11:26 ` Greg Kroah-Hartman
  2021-05-13 13:22   ` Gong Ruiqi
  2021-05-13 13:49   ` Gong Ruiqi
  0 siblings, 2 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-13 11:26 UTC (permalink / raw)
  To: Ruiqi Gong; +Cc: Wang Weiyang, linux-kernel, kernel-janitors

On Thu, May 13, 2021 at 07:07:16PM +0800, Ruiqi Gong wrote:
> The Sparse tool reports as follows:
> 
> drivers/base/node.c:239:1: warning:
>  symbol 'dev_attr_line_size' was not declared. Should it be static?
> drivers/base/node.c:240:1: warning:
>  symbol 'dev_attr_indexing' was not declared. Should it be static?
> 
> These symbols (and several others) are defined by DEVICE_ATTR_RO(name) in
> CACHE_ATTR(name, fmt), and all of them are not used outside of node.c. So let's
> mark DEVICE_ATTR_RO(name) static to solve these complains from Sparse.

Why not fix them all at once?  Why only one here?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] drivers/base/node.c: make CACHE_ATTR define static DEVICE_ATTR_RO
  2021-05-13 11:26 ` Greg Kroah-Hartman
@ 2021-05-13 13:22   ` Gong Ruiqi
  2021-05-13 13:50     ` Greg Kroah-Hartman
  2021-05-13 13:49   ` Gong Ruiqi
  1 sibling, 1 reply; 5+ messages in thread
From: Gong Ruiqi @ 2021-05-13 13:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Wang Weiyang, linux-kernel, kernel-janitors



On 2021/05/13 19:26, Greg Kroah-Hartman wrote:
> On Thu, May 13, 2021 at 07:07:16PM +0800, Ruiqi Gong wrote:
>> The Sparse tool reports as follows:
>>
>> drivers/base/node.c:239:1: warning:
>>   symbol 'dev_attr_line_size' was not declared. Should it be static?
>> drivers/base/node.c:240:1: warning:
>>   symbol 'dev_attr_indexing' was not declared. Should it be static?
>>
>> These symbols (and several others) are defined by DEVICE_ATTR_RO(name) in
>> CACHE_ATTR(name, fmt), and all of them are not used outside of node.c. So let's
>> mark DEVICE_ATTR_RO(name) static to solve these complains from Sparse.
> 
> Why not fix them all at once?  Why only one here?

Sorry for not making it clear enough. Actually the patch does fix them 
all. Those symbols reported by Sparse are generated when two of the 
following macros are expanded:

     CACHE_ATTR(size, "%llu")
     CACHE_ATTR(line_size, "%u")
     CACHE_ATTR(indexing, "%u")
     CACHE_ATTR(write_policy, "%u")

So one fix of the CACHE_ATTR's definition fixs them all.

> 
> thanks,
> 
> greg k-h
> .
> 

.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] drivers/base/node.c: make CACHE_ATTR define static DEVICE_ATTR_RO
  2021-05-13 11:26 ` Greg Kroah-Hartman
  2021-05-13 13:22   ` Gong Ruiqi
@ 2021-05-13 13:49   ` Gong Ruiqi
  1 sibling, 0 replies; 5+ messages in thread
From: Gong Ruiqi @ 2021-05-13 13:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Wang Weiyang, linux-kernel, kernel-janitors

(Resend for the correct format. Apology from a TB amateur.)


On 2021/05/13 19:26, Greg Kroah-Hartman wrote:
> On Thu, May 13, 2021 at 07:07:16PM +0800, Ruiqi Gong wrote:
>> The Sparse tool reports as follows:
>>
>> drivers/base/node.c:239:1: warning:
>>  symbol 'dev_attr_line_size' was not declared. Should it be static?
>> drivers/base/node.c:240:1: warning:
>>  symbol 'dev_attr_indexing' was not declared. Should it be static?
>>
>> These symbols (and several others) are defined by DEVICE_ATTR_RO(name) in
>> CACHE_ATTR(name, fmt), and all of them are not used outside of node.c. So let's
>> mark DEVICE_ATTR_RO(name) static to solve these complains from Sparse.
> 
> Why not fix them all at once?  Why only one here?

Sorry for not making it clear enough. Actually the patch does fix them
all. Those symbols reported by Sparse are generated when two of the
following macros are expanded:

    CACHE_ATTR(size, "%llu")
    CACHE_ATTR(line_size, "%u")
    CACHE_ATTR(indexing, "%u")
    CACHE_ATTR(write_policy, "%u")

So one fix of the CACHE_ATTR's definition fixs them all.

> 
> thanks,
> 
> greg k-h
> .
> 

.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] drivers/base/node.c: make CACHE_ATTR define static DEVICE_ATTR_RO
  2021-05-13 13:22   ` Gong Ruiqi
@ 2021-05-13 13:50     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-13 13:50 UTC (permalink / raw)
  To: Gong Ruiqi; +Cc: Wang Weiyang, linux-kernel, kernel-janitors

On Thu, May 13, 2021 at 09:22:44PM +0800, Gong Ruiqi wrote:
> 
> 
> On 2021/05/13 19:26, Greg Kroah-Hartman wrote:
> > On Thu, May 13, 2021 at 07:07:16PM +0800, Ruiqi Gong wrote:
> > > The Sparse tool reports as follows:
> > > 
> > > drivers/base/node.c:239:1: warning:
> > >   symbol 'dev_attr_line_size' was not declared. Should it be static?
> > > drivers/base/node.c:240:1: warning:
> > >   symbol 'dev_attr_indexing' was not declared. Should it be static?
> > > 
> > > These symbols (and several others) are defined by DEVICE_ATTR_RO(name) in
> > > CACHE_ATTR(name, fmt), and all of them are not used outside of node.c. So let's
> > > mark DEVICE_ATTR_RO(name) static to solve these complains from Sparse.
> > 
> > Why not fix them all at once?  Why only one here?
> 
> Sorry for not making it clear enough. Actually the patch does fix them all.
> Those symbols reported by Sparse are generated when two of the following
> macros are expanded:
> 
>     CACHE_ATTR(size, "%llu")
>     CACHE_ATTR(line_size, "%u")
>     CACHE_ATTR(indexing, "%u")
>     CACHE_ATTR(write_policy, "%u")
> 
> So one fix of the CACHE_ATTR's definition fixs them all.

Ok, can you please rewrite the changelog text to make it more clear?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-13 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 11:07 [PATCH -next] drivers/base/node.c: make CACHE_ATTR define static DEVICE_ATTR_RO Ruiqi Gong
2021-05-13 11:26 ` Greg Kroah-Hartman
2021-05-13 13:22   ` Gong Ruiqi
2021-05-13 13:50     ` Greg Kroah-Hartman
2021-05-13 13:49   ` Gong Ruiqi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).