diff mbox series

[-next] gpio: pca953x: Make symbol 'pca953x_i2c_regmap' static

Message ID 1547129262-102929-1-git-send-email-weiyongjun1@huawei.com
State New
Headers show
Series [-next] gpio: pca953x: Make symbol 'pca953x_i2c_regmap' static | expand

Commit Message

Wei Yongjun Jan. 10, 2019, 2:07 p.m. UTC
Fixes the following sparse warning:

drivers/gpio/gpio-pca953x.c:292:28: warning:
 symbol 'pca953x_i2c_regmap' was not declared. Should it be static?

Fixes: 49427232764d ("gpio: pca953x: Perform basic regmap conversion")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/gpio/gpio-pca953x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marek Vasut Jan. 10, 2019, 2:07 p.m. UTC | #1
On 1/10/19 3:07 PM, Wei Yongjun wrote:
> Fixes the following sparse warning:
> 
> drivers/gpio/gpio-pca953x.c:292:28: warning:
>  symbol 'pca953x_i2c_regmap' was not declared. Should it be static?
> 
> Fixes: 49427232764d ("gpio: pca953x: Perform basic regmap conversion")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Nice, thanks.
Reviewed-by: Marek Vasut <marex@denx.de>

For future reference, how did you run sparse to detect this ?

> ---
>  drivers/gpio/gpio-pca953x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 83617fd..0dc9641 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -289,7 +289,7 @@ static bool pca953x_volatile_register(struct device *dev, unsigned int reg)
>  	return pca953x_check_register(chip, reg, bank);
>  }
>  
> -const struct regmap_config pca953x_i2c_regmap = {
> +static const struct regmap_config pca953x_i2c_regmap = {
>  	.reg_bits = 8,
>  	.val_bits = 8,
> 
> 
>
Wei Yongjun Jan. 11, 2019, 1:50 a.m. UTC | #2
> From: Marek Vasut [mailto:marek.vasut@gmail.com]
> Sent: Thursday, January 10, 2019 10:07 PM
> To: weiyongjun (A) <weiyongjun1@huawei.com>; Linus Walleij
> <linus.walleij@linaro.org>; Bartosz Golaszewski
> <bgolaszewski@baylibre.com>
> Cc: linux-gpio@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: Re: [PATCH -next] gpio: pca953x: Make symbol
> 'pca953x_i2c_regmap' static
> 
> On 1/10/19 3:07 PM, Wei Yongjun wrote:
> > Fixes the following sparse warning:
> >
> > drivers/gpio/gpio-pca953x.c:292:28: warning:
> >  symbol 'pca953x_i2c_regmap' was not declared. Should it be static?
> >
> > Fixes: 49427232764d ("gpio: pca953x: Perform basic regmap conversion")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Nice, thanks.
> Reviewed-by: Marek Vasut <marex@denx.de>
> 
> For future reference, how did you run sparse to detect this ?


I have a script which run sparse everyday on each changed file
of linux-next.git tree. So most of this issues can be detected.

> 
> > ---
> >  drivers/gpio/gpio-pca953x.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> > index 83617fd..0dc9641 100644
> > --- a/drivers/gpio/gpio-pca953x.c
> > +++ b/drivers/gpio/gpio-pca953x.c
> > @@ -289,7 +289,7 @@ static bool pca953x_volatile_register(struct device
> *dev, unsigned int reg)
> >  	return pca953x_check_register(chip, reg, bank);
> >  }
> >
> > -const struct regmap_config pca953x_i2c_regmap = {
> > +static const struct regmap_config pca953x_i2c_regmap = {
> >  	.reg_bits = 8,
> >  	.val_bits = 8,
> >
> >
> >
> 
> 
> --
> Best regards,
> Marek Vasut
Marek Vasut Jan. 11, 2019, 2:33 a.m. UTC | #3
On 1/11/19 2:50 AM, weiyongjun (A) wrote:
>> From: Marek Vasut [mailto:marek.vasut@gmail.com]
>> Sent: Thursday, January 10, 2019 10:07 PM
>> To: weiyongjun (A) <weiyongjun1@huawei.com>; Linus Walleij
>> <linus.walleij@linaro.org>; Bartosz Golaszewski
>> <bgolaszewski@baylibre.com>
>> Cc: linux-gpio@vger.kernel.org; kernel-janitors@vger.kernel.org
>> Subject: Re: [PATCH -next] gpio: pca953x: Make symbol
>> 'pca953x_i2c_regmap' static
>>
>> On 1/10/19 3:07 PM, Wei Yongjun wrote:
>>> Fixes the following sparse warning:
>>>
>>> drivers/gpio/gpio-pca953x.c:292:28: warning:
>>>  symbol 'pca953x_i2c_regmap' was not declared. Should it be static?
>>>
>>> Fixes: 49427232764d ("gpio: pca953x: Perform basic regmap conversion")
>>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>>
>> Nice, thanks.
>> Reviewed-by: Marek Vasut <marex@denx.de>
>>
>> For future reference, how did you run sparse to detect this ?
> 
> 
> I have a script which run sparse everyday on each changed file
> of linux-next.git tree. So most of this issues can be detected.

Can you share that script ? I'm sure others can benefit from that too.
Wei Yongjun Jan. 11, 2019, 5:45 a.m. UTC | #4
> >>
> >> On 1/10/19 3:07 PM, Wei Yongjun wrote:
> >>> Fixes the following sparse warning:
> >>>
> >>> drivers/gpio/gpio-pca953x.c:292:28: warning:
> >>>  symbol 'pca953x_i2c_regmap' was not declared. Should it be static?
> >>>
> >>> Fixes: 49427232764d ("gpio: pca953x: Perform basic regmap conversion")
> >>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> >>
> >> Nice, thanks.
> >> Reviewed-by: Marek Vasut <marex@denx.de>
> >>
> >> For future reference, how did you run sparse to detect this ?
> >
> >
> > I have a script which run sparse everyday on each changed file
> > of linux-next.git tree. So most of this issues can be detected.
> 
> Can you share that script ? I'm sure others can benefit from that too.

Sure, the script exists in my github, as a part of our automated patch system.
https://github.com/weiyj/dpatch-devel/blob/master/dpatch/core/checksparse.py

We are considering making it as a public system, but still not ready.

> 
> --
> Best regards,
> Marek Vasut
Linus Walleij Jan. 11, 2019, 8:17 a.m. UTC | #5
On Thu, Jan 10, 2019 at 3:01 PM Wei Yongjun <weiyongjun1@huawei.com> wrote:

> Fixes the following sparse warning:
>
> drivers/gpio/gpio-pca953x.c:292:28: warning:
>  symbol 'pca953x_i2c_regmap' was not declared. Should it be static?
>
> Fixes: 49427232764d ("gpio: pca953x: Perform basic regmap conversion")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Patch applied for fixes with Marek's ACK, awesome sparsing!

Yours,
Linus Walleij
Marek Vasut Jan. 11, 2019, 11:31 a.m. UTC | #6
On 1/11/19 6:45 AM, weiyongjun (A) wrote:
>>>>
>>>> On 1/10/19 3:07 PM, Wei Yongjun wrote:
>>>>> Fixes the following sparse warning:
>>>>>
>>>>> drivers/gpio/gpio-pca953x.c:292:28: warning:
>>>>>  symbol 'pca953x_i2c_regmap' was not declared. Should it be static?
>>>>>
>>>>> Fixes: 49427232764d ("gpio: pca953x: Perform basic regmap conversion")
>>>>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>>>>
>>>> Nice, thanks.
>>>> Reviewed-by: Marek Vasut <marex@denx.de>
>>>>
>>>> For future reference, how did you run sparse to detect this ?
>>>
>>>
>>> I have a script which run sparse everyday on each changed file
>>> of linux-next.git tree. So most of this issues can be detected.
>>
>> Can you share that script ? I'm sure others can benefit from that too.
> 
> Sure, the script exists in my github, as a part of our automated patch system.
> https://github.com/weiyj/dpatch-devel/blob/master/dpatch/core/checksparse.py
> 
> We are considering making it as a public system, but still not ready.

Fantastic, thanks!
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 83617fd..0dc9641 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -289,7 +289,7 @@  static bool pca953x_volatile_register(struct device *dev, unsigned int reg)
 	return pca953x_check_register(chip, reg, bank);
 }
 
-const struct regmap_config pca953x_i2c_regmap = {
+static const struct regmap_config pca953x_i2c_regmap = {
 	.reg_bits = 8,
 	.val_bits = 8,