Re: [PATCH 05/18] net: use ARRAY_SIZE

2017-10-03 Thread Andy Shevchenko
On Tue, Oct 3, 2017 at 4:22 AM, Jérémy Lefaure
 wrote:
> On Mon, 2 Oct 2017 16:07:36 +0300
> Andy Shevchenko  wrote:
>
>> > +   {_lut_core0_rev0, ARRAY_SIZE(gainctrl_lut_core0_rev0), 
>> > 26, 192,
>> > +32},
>>
>> For all such cases I would rather put on one line disregard checkpatch
>> warning for better readability.
> I agree that it would be better. I didn't know that it was possible to
> not follow this rule for anything else than a string.

IMO, it increases readability quite enough to overrule checkpatch recomendation.

-- 
With Best Regards,
Andy Shevchenko


Re: [PATCH 05/18] net: use ARRAY_SIZE

2017-10-02 Thread Jérémy Lefaure
On Mon, 02 Oct 2017 16:46:29 +0300
Kalle Valo  wrote:

> We have a tree for wireless so usually it's better to submit wireless
> changes on their own but here I assume Dave will apply this to his tree.
> If not, please resubmit the wireless part in a separate patch.
Ok, I note that.

I'll wait Dave's answer and I'll split this patch if needed.

Thank you,
Jérémy


Re: [PATCH 05/18] net: use ARRAY_SIZE

2017-10-02 Thread Jérémy Lefaure
On Mon, 2 Oct 2017 16:07:36 +0300
Andy Shevchenko  wrote:

> > +   {_lut_core0_rev0, ARRAY_SIZE(gainctrl_lut_core0_rev0), 26, 
> > 192,
> > +32},  
> 
> For all such cases I would rather put on one line disregard checkpatch
> warning for better readability.
I agree that it would be better. I didn't know that it was possible to
not follow this rule for anything else than a string.

I am waiting for more comments and I will send a v2.

Thank you,
Jérémy


Re: [PATCH 05/18] net: use ARRAY_SIZE

2017-10-02 Thread Kalle Valo
Jérémy Lefaure  writes:

> Using the ARRAY_SIZE macro improves the readability of the code. Also,
> it is not always useful to use a variable to store this constant
> calculated at compile time.
>
> Found with Coccinelle with the following semantic patch:
> @r depends on (org || report)@
> type T;
> T[] E;
> position p;
> @@
> (
>  (sizeof(E)@p /sizeof(*E))
> |
>  (sizeof(E)@p /sizeof(E[...]))
> |
>  (sizeof(E)@p /sizeof(T))
> )
>
> Signed-off-by: Jérémy Lefaure 
> ---
>  drivers/net/ethernet/emulex/benet/be_cmds.c|   4 +-
>  drivers/net/ethernet/intel/i40e/i40e_adminq.h  |   3 +-
>  drivers/net/ethernet/intel/i40evf/i40e_adminq.h|   3 +-
>  drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c  |   3 +-
>  drivers/net/ethernet/intel/ixgbevf/vf.c|  17 +-
>  drivers/net/usb/kalmia.c   |   9 +-
>  .../broadcom/brcm80211/brcmsmac/phy/phytbl_n.c | 473 
> ++---
>  .../net/wireless/realtek/rtlwifi/rtl8723be/hw.c|   9 +-
>  .../net/wireless/realtek/rtlwifi/rtl8723be/phy.c   |  12 +-
>  .../net/wireless/realtek/rtlwifi/rtl8723be/table.c |  14 +-
>  .../net/wireless/realtek/rtlwifi/rtl8821ae/table.c |  34 +-
>  include/net/bond_3ad.h |   3 +-
>  net/ipv6/seg6_local.c  |   6 +-
>  13 files changed, 177 insertions(+), 413 deletions(-)

We have a tree for wireless so usually it's better to submit wireless
changes on their own but here I assume Dave will apply this to his tree.
If not, please resubmit the wireless part in a separate patch.

-- 
Kalle Valo


Re: [PATCH 05/18] net: use ARRAY_SIZE

2017-10-02 Thread Andy Shevchenko
On Sun, Oct 1, 2017 at 10:30 PM, Jérémy Lefaure
 wrote:
> Using the ARRAY_SIZE macro improves the readability of the code. Also,
> it is not always useful to use a variable to store this constant
> calculated at compile time.
>

> +   {_lut_core0_rev0, ARRAY_SIZE(gainctrl_lut_core0_rev0), 26, 
> 192,
> +32},

For all such cases I would rather put on one line disregard checkpatch
warning for better readability.

-- 
With Best Regards,
Andy Shevchenko