[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+6hz4rpSNn-X+T4V_ZVeWjDRMz4Bfw=vH430XqOHe0-_+V-rw@mail.gmail.com>
Date: Fri, 10 Mar 2017 09:36:19 +0800
From: Feng Gao <gfree.wind@...il.com>
To: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc: "David S. Miller" <davem@...emloft.net>, kuznet@....inr.ac.ru,
jmorris@...ei.org, Patrick McHardy <kaber@...sh.net>,
Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 2/2] net: Eliminate duplicated codes by creating
one new function in_dev_select_addr
Hi Sergei,
On Tue, Mar 7, 2017 at 11:46 PM, Sergei Shtylyov
<sergei.shtylyov@...entembedded.com> wrote:
> Hello!
>
> On 03/07/2017 05:51 PM, fgao@...ai8.com wrote:
>
>> From: Gao Feng <fgao@...ai8.com>
>>
>> There are two duplicated loop codes which used to select right
>
>
> Just "loops".
>
>> address in current codes. Now eliminate these codes by creating
>> one new function in_dev_select_addr.
>>
>> Signed-off-by: Gao Feng <fgao@...ai8.com>
>> ---
>> net/ipv4/devinet.c | 34 +++++++++++++++++++---------------
>> 1 file changed, 19 insertions(+), 15 deletions(-)
>>
>> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
>> index 1a9e550..d0964c5 100644
>> --- a/net/ipv4/devinet.c
>> +++ b/net/ipv4/devinet.c
>> @@ -1191,6 +1191,19 @@ static int inet_gifconf(struct net_device *dev,
>> char __user *buf, int len)
>> return done;
>> }
>>
>> +static __be32 in_dev_select_addr(const struct in_device *in_dev,
>> + int scope)
>> +{
>> + for_primary_ifa(in_dev) {
>> + if (ifa->ifa_scope != RT_SCOPE_LINK &&
>> + ifa->ifa_scope <= scope) {
>> + return ifa->ifa_local;
>> + }
>
>
> Could drop the useless {} here, while at it.
Thanks, I would correct it in v2 patch.
The checkpatch.pl ignores this issue when I checked this patch.
It seems one bug of checkpatch.pl
Regards
Feng
>
>> + } endfor_ifa(in_dev);
>> +
>> + return 0;
>> +}
>> +
>> __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int
>> scope)
>> {
>> __be32 addr = 0;
>
> [...]
>
> MBR, Sergei
>
Powered by blists - more mailing lists