[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <af60dfb1-9e7d-e9ce-3ee9-ce3ef8efae9c@microchip.com>
Date: Tue, 12 Oct 2021 11:24:50 +0200
From: Nicolas Ferre <nicolas.ferre@...rochip.com>
To: Antoine Tenart <atenart@...nel.org>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Sean Anderson <sean.anderson@...o.com>,
<netdev@...r.kernel.org>
CC: Russell King <linux@...linux.org.uk>,
Claudiu Beznea <claudiu.beznea@...rochip.com>
Subject: Re: [PATCH v2 1/2] net: macb: Clean up macb_validate
On 12/10/2021 at 10:33, Antoine Tenart wrote:
> Hello Sean,
>
> Quoting Sean Anderson (2021-10-11 18:55:16)
>> As the number of interfaces grows, the number of if statements grows
>> ever more unweildy. Clean everything up a bit by using a switch
>> statement. No functional change intended.
>
> I'm not 100% convinced this makes macb_validate more readable: there are
> lots of conditions, and jumps, in the switch.
I agree with Antoine that the result is not much more readable.
Regards,
Nicolas
> Maybe you could try a mixed approach; keeping the invalid modes checks
> (bitmap_zero) at the beginning and once we know the mode is valid using
> a switch statement. That might make it easier to read as this should
> remove lots of conditionals. (We'll still have the one/_NA checks
> though).
>
> (Also having patch 1 first will improve things).
>
> Thanks,
> Antoine
>
--
Nicolas Ferre
Powered by blists - more mailing lists