* Re: [PATCH] net: ns83820: drop pointless static qualifier in ns83820_probe_phy()
2019-02-19 8:06 [PATCH] net: ns83820: drop pointless static qualifier in ns83820_probe_phy() Mao Wenan
@ 2019-02-19 8:01 ` Julia Lawall
2019-02-19 8:09 ` maowenan
2019-02-19 14:21 ` Dan Carpenter
1 sibling, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-02-19 8:01 UTC (permalink / raw)
To: Mao Wenan
Cc: kernel-janitors, netdev, john.fastabend, hawk, jakub.kicinski,
daniel, ast
On Tue, 19 Feb 2019, Mao Wenan wrote:
> There is no need to have the 'int first' static
> since new value always be assigned before use it.
> The old codes of first dereferencing this variable have
> been commented out. So it is useless with 'static int first'.
> /*
> if (!first) {
> ...
> }
> */
> first = 1;
Do you need the variable at all?
In the code, the commenting out is actually done with #if 0. It could be
good for the commit log to reflect the code more accurately.
Can the #if 0 and code be removed? Apparently it predates git.
A commented out printk below also predates git.
julia
>
> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> ---
> drivers/net/ethernet/natsemi/ns83820.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c
> index 958fced4dacf..fb064df3a1a6 100644
> --- a/drivers/net/ethernet/natsemi/ns83820.c
> +++ b/drivers/net/ethernet/natsemi/ns83820.c
> @@ -1869,7 +1869,7 @@ static unsigned ns83820_mii_write_reg(struct ns83820 *dev, unsigned phy, unsigne
> static void ns83820_probe_phy(struct net_device *ndev)
> {
> struct ns83820 *dev = PRIV(ndev);
> - static int first;
> + int first;
> int i;
> #define MII_PHYIDR1 0x02
> #define MII_PHYIDR2 0x03
> --
> 2.20.1
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] net: ns83820: drop pointless static qualifier in ns83820_probe_phy()
@ 2019-02-19 8:06 Mao Wenan
2019-02-19 8:01 ` Julia Lawall
2019-02-19 14:21 ` Dan Carpenter
0 siblings, 2 replies; 5+ messages in thread
From: Mao Wenan @ 2019-02-19 8:06 UTC (permalink / raw)
To: kernel-janitors, netdev, john.fastabend, hawk, jakub.kicinski,
daniel, ast
There is no need to have the 'int first' static
since new value always be assigned before use it.
The old codes of first dereferencing this variable have
been commented out. So it is useless with 'static int first'.
/*
if (!first) {
...
}
*/
first = 1;
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
drivers/net/ethernet/natsemi/ns83820.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c
index 958fced4dacf..fb064df3a1a6 100644
--- a/drivers/net/ethernet/natsemi/ns83820.c
+++ b/drivers/net/ethernet/natsemi/ns83820.c
@@ -1869,7 +1869,7 @@ static unsigned ns83820_mii_write_reg(struct ns83820 *dev, unsigned phy, unsigne
static void ns83820_probe_phy(struct net_device *ndev)
{
struct ns83820 *dev = PRIV(ndev);
- static int first;
+ int first;
int i;
#define MII_PHYIDR1 0x02
#define MII_PHYIDR2 0x03
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ns83820: drop pointless static qualifier in ns83820_probe_phy()
2019-02-19 8:01 ` Julia Lawall
@ 2019-02-19 8:09 ` maowenan
2019-02-19 8:15 ` Julia Lawall
0 siblings, 1 reply; 5+ messages in thread
From: maowenan @ 2019-02-19 8:09 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors, netdev, john.fastabend, hawk, jakub.kicinski,
daniel, ast
On 2019/2/19 16:01, Julia Lawall wrote:
>
>
> On Tue, 19 Feb 2019, Mao Wenan wrote:
>
>> There is no need to have the 'int first' static
>> since new value always be assigned before use it.
>> The old codes of first dereferencing this variable have
>> been commented out. So it is useless with 'static int first'.
>> /*
>> if (!first) {
>> ...
>> }
>> */
>> first = 1;
>
> Do you need the variable at all?
>
> In the code, the commenting out is actually done with #if 0. It could be
> good for the commit log to reflect the code more accurately.
>
OK, the original codes are using #if 0 to comment out, but when I generate patch
the "#if 0" has been removed, so I use "/*...*/" to reflect that.
> Can the #if 0 and code be removed? Apparently it predates git.
>
> A commented out printk below also predates git.
>
I think all the "#if 0" comment out codes and printk codes can be removed, shall I send
v2 to do this?
> julia
>
>>
>> Signed-off-by: Mao Wenan <maowenan@huawei.com>
>> ---
>> drivers/net/ethernet/natsemi/ns83820.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c
>> index 958fced4dacf..fb064df3a1a6 100644
>> --- a/drivers/net/ethernet/natsemi/ns83820.c
>> +++ b/drivers/net/ethernet/natsemi/ns83820.c
>> @@ -1869,7 +1869,7 @@ static unsigned ns83820_mii_write_reg(struct ns83820 *dev, unsigned phy, unsigne
>> static void ns83820_probe_phy(struct net_device *ndev)
>> {
>> struct ns83820 *dev = PRIV(ndev);
>> - static int first;
>> + int first;
>> int i;
>> #define MII_PHYIDR1 0x02
>> #define MII_PHYIDR2 0x03
>> --
>> 2.20.1
>>
>>
>
> .
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ns83820: drop pointless static qualifier in ns83820_probe_phy()
2019-02-19 8:09 ` maowenan
@ 2019-02-19 8:15 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2019-02-19 8:15 UTC (permalink / raw)
To: maowenan
Cc: kernel-janitors, netdev, john.fastabend, hawk, jakub.kicinski,
daniel, ast
On Tue, 19 Feb 2019, maowenan wrote:
>
>
> On 2019/2/19 16:01, Julia Lawall wrote:
> >
> >
> > On Tue, 19 Feb 2019, Mao Wenan wrote:
> >
> >> There is no need to have the 'int first' static
> >> since new value always be assigned before use it.
> >> The old codes of first dereferencing this variable have
> >> been commented out. So it is useless with 'static int first'.
> >> /*
> >> if (!first) {
> >> ...
> >> }
> >> */
> >> first = 1;
> >
> > Do you need the variable at all?
> >
> > In the code, the commenting out is actually done with #if 0. It could be
> > good for the commit log to reflect the code more accurately.
> >
> OK, the original codes are using #if 0 to comment out, but when I generate patch
> the "#if 0" has been removed, so I use "/*...*/" to reflect that.
I don't understand the above comment. The proposed patch doesn't have any
impact on the #if 0 lines.
>
> > Can the #if 0 and code be removed? Apparently it predates git.
> >
> > A commented out printk below also predates git.
> >
> I think all the "#if 0" comment out codes and printk codes can be removed, shall I send
> v2 to do this?
It seems reasonable to me.
julia
> > julia
> >
> >>
> >> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> >> ---
> >> drivers/net/ethernet/natsemi/ns83820.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c
> >> index 958fced4dacf..fb064df3a1a6 100644
> >> --- a/drivers/net/ethernet/natsemi/ns83820.c
> >> +++ b/drivers/net/ethernet/natsemi/ns83820.c
> >> @@ -1869,7 +1869,7 @@ static unsigned ns83820_mii_write_reg(struct ns83820 *dev, unsigned phy, unsigne
> >> static void ns83820_probe_phy(struct net_device *ndev)
> >> {
> >> struct ns83820 *dev = PRIV(ndev);
> >> - static int first;
> >> + int first;
> >> int i;
> >> #define MII_PHYIDR1 0x02
> >> #define MII_PHYIDR2 0x03
> >> --
> >> 2.20.1
> >>
> >>
> >
> > .
> >
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ns83820: drop pointless static qualifier in ns83820_probe_phy()
2019-02-19 8:06 [PATCH] net: ns83820: drop pointless static qualifier in ns83820_probe_phy() Mao Wenan
2019-02-19 8:01 ` Julia Lawall
@ 2019-02-19 14:21 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-02-19 14:21 UTC (permalink / raw)
To: Mao Wenan
Cc: kernel-janitors, netdev, john.fastabend, hawk, jakub.kicinski,
daniel, ast
Just delete it instead.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-02-19 14:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-19 8:06 [PATCH] net: ns83820: drop pointless static qualifier in ns83820_probe_phy() Mao Wenan
2019-02-19 8:01 ` Julia Lawall
2019-02-19 8:09 ` maowenan
2019-02-19 8:15 ` Julia Lawall
2019-02-19 14:21 ` Dan Carpenter
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).