All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/18] use ARRAY_SIZE macro
@ 2017-10-01 19:30 ` Jérémy Lefaure
  0 siblings, 0 replies; 114+ messages in thread
From: Jérémy Lefaure @ 2017-10-01 19:30 UTC (permalink / raw)
  Cc: alsa-devel, amd-gfx, brcm80211-dev-list, brcm80211-dev-list.pdl,
	devel, devel, dm-devel, dri-devel, ecryptfs, intel-gfx,
	intel-gvt-dev, intel-wired-lan, Jason Gunthorpe, linux-acpi,
	linux-integrity, linux-kernel, linux-media, linux-nfs, linux-raid,
	linux-rdma, linux-scsi, linux-usb, linux-video, linux-wireless,
	netdev, nouveau

Hi everyone,
Using ARRAY_SIZE improves the code readability. I used coccinelle (I
made a change to the array_size.cocci file [1]) to find several places
where ARRAY_SIZE could be used instead of other macros or sizeof
division.

I tried to divide the changes into a patch per subsystem (excepted for
staging). If one of the patch should be split into several patches, let
me know.

In order to reduce the size of the To: and Cc: lines, each patch of the
series is sent only to the maintainers and lists concerned by the patch.
This cover letter is sent to every list concerned by this series.

This series is based on linux-next next-20170929. Each patch has been
tested by building the relevant files with W=1.

This series contains the following patches:
[PATCH 01/18] sound: use ARRAY_SIZE
[PATCH 02/18] tracing/filter: use ARRAY_SIZE
[PATCH 03/18] media: use ARRAY_SIZE
[PATCH 04/18] IB/mlx5: Use ARRAY_SIZE
[PATCH 05/18] net: use ARRAY_SIZE
[PATCH 06/18] drm: use ARRAY_SIZE
[PATCH 07/18] scsi: bfa: use ARRAY_SIZE
[PATCH 08/18] ecryptfs: use ARRAY_SIZE
[PATCH 09/18] nfsd: use ARRAY_SIZE
[PATCH 10/18] orangefs: use ARRAY_SIZE
[PATCH 11/18] dm space map metadata: use ARRAY_SIZE
[PATCH 12/18] x86: use ARRAY_SIZE
[PATCH 13/18] tpm: use ARRAY_SIZE
[PATCH 14/18] ipmi: use ARRAY_SIZE
[PATCH 15/18] acpi: use ARRAY_SIZE
[PATCH 16/18] media: staging: atomisp: use ARRAY_SIZE
[PATCH 17/18] staging: rtl8723bs: use ARRAY_SIZE
[PATCH 18/18] staging: rtlwifi: use ARRAY_SIZE


[1]: https://lkml.org/lkml/2017/9/13/689

^ permalink raw reply	[flat|nested] 114+ messages in thread
* Re: [Devel] [PATCH 15/18] acpi: use ARRAY_SIZE
  2017-10-03  1:16     ` Jérémy Lefaure
@ 2017-10-03 11:39 ` Rafael J. Wysocki
  -1 siblings, 0 replies; 114+ messages in thread
From: Rafael J. Wysocki @ 2017-10-03 11:39 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 962 bytes --]

On Tuesday, October 3, 2017 3:16:22 AM CEST Jérémy Lefaure wrote:
> On Mon, 02 Oct 2017 14:27:52 +0200
> "Rafael J. Wysocki" <rjw(a)rjwysocki.net> wrote:
> 
> > ACPICA is soewhat special code, though and I'm not taking or ACKing patches
> > for it directly as a rule.
> > 
> > For one, I'm not sure if ACPICA can use ARRAY_SIZE at all.
> Why is it special code that can't use ARRAY_SIZE ? Is it because this
> macro is defined in linux/kernel.h ?

Basically, yes.

ACPICA is a separate project and the kernel acquires its source code from
the upstream (which is used by other OSes too).  That is not the case for
any other code in the kernel I know about.


We strive to keep the ACPICA code in the kernel as close to the upstream as
reasonably possible for maintenance reasons, so we avoid doing Linux-specific
things in it.

As a rule of thumb, if you do cleanups like this one, better avoid the ACPICA
code. :-)

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 114+ messages in thread
* Re: [Devel] [PATCH 15/18] acpi: use ARRAY_SIZE
  2017-10-03 11:39 ` Rafael J. Wysocki
@ 2017-10-03 12:34 ` Colin Ian King
  -1 siblings, 0 replies; 114+ messages in thread
From: Colin Ian King @ 2017-10-03 12:34 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1282 bytes --]

On 03/10/17 12:39, Rafael J. Wysocki wrote:
> On Tuesday, October 3, 2017 3:16:22 AM CEST Jérémy Lefaure wrote:
>> On Mon, 02 Oct 2017 14:27:52 +0200
>> "Rafael J. Wysocki" <rjw(a)rjwysocki.net> wrote:
>>
>>> ACPICA is soewhat special code, though and I'm not taking or ACKing patches
>>> for it directly as a rule.
>>>
>>> For one, I'm not sure if ACPICA can use ARRAY_SIZE at all.
>> Why is it special code that can't use ARRAY_SIZE ? Is it because this
>> macro is defined in linux/kernel.h ?

However, ACPICA does have ACPI_ARRAY_LENGTH(x), see source/include/actypes.h

> 
> Basically, yes.
> 
> ACPICA is a separate project and the kernel acquires its source code from
> the upstream (which is used by other OSes too).  That is not the case for
> any other code in the kernel I know about.
> 
> 
> We strive to keep the ACPICA code in the kernel as close to the upstream as
> reasonably possible for maintenance reasons, so we avoid doing Linux-specific
> things in it.
> 
> As a rule of thumb, if you do cleanups like this one, better avoid the ACPICA
> code. :-)
> 
> Thanks,
> Rafael
> 
> _______________________________________________
> Devel mailing list
> Devel(a)acpica.org
> https://lists.acpica.org/mailman/listinfo/devel
> 


^ permalink raw reply	[flat|nested] 114+ messages in thread
* Re: [Devel] [PATCH 15/18] acpi: use ARRAY_SIZE
  2017-10-03 12:34 ` Colin Ian King
@ 2017-10-03 16:04 ` Rafael J. Wysocki
  -1 siblings, 0 replies; 114+ messages in thread
From: Rafael J. Wysocki @ 2017-10-03 16:04 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]

On Tue, Oct 3, 2017 at 2:34 PM, Colin Ian King <colin.king(a)canonical.com> wrote:
> On 03/10/17 12:39, Rafael J. Wysocki wrote:
>> On Tuesday, October 3, 2017 3:16:22 AM CEST Jérémy Lefaure wrote:
>>> On Mon, 02 Oct 2017 14:27:52 +0200
>>> "Rafael J. Wysocki" <rjw(a)rjwysocki.net> wrote:
>>>
>>>> ACPICA is soewhat special code, though and I'm not taking or ACKing patches
>>>> for it directly as a rule.
>>>>
>>>> For one, I'm not sure if ACPICA can use ARRAY_SIZE at all.
>>> Why is it special code that can't use ARRAY_SIZE ? Is it because this
>>> macro is defined in linux/kernel.h ?
>
> However, ACPICA does have ACPI_ARRAY_LENGTH(x), see source/include/actypes.h

Fair enough, but that cleanup should go in via ACPICA upstream anyway.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 114+ messages in thread
* Re: [Devel] [PATCH 15/18] acpi: use ARRAY_SIZE
  2017-10-03 16:04 ` Rafael J. Wysocki
@ 2017-10-03 16:38 ` Moore, Robert
  -1 siblings, 0 replies; 114+ messages in thread
From: Moore, Robert @ 2017-10-03 16:38 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]



> -----Original Message-----
> From: Devel [mailto:devel-bounces(a)acpica.org] On Behalf Of Rafael J.
> Wysocki
> Sent: Tuesday, October 3, 2017 9:05 AM
> To: Colin Ian King <colin.king(a)canonical.com>
> Cc: Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; Rafael J. Wysocki
> <rjw(a)rjwysocki.net>; Linux Kernel Mailing List <linux-
> kernel(a)vger.kernel.org>; ACPI Devel Maling List <linux-
> acpi(a)vger.kernel.org>; Jérémy Lefaure <jeremy.lefaure(a)lse.epita.fr>;
> devel(a)acpica.org
> Subject: Re: [Devel] [PATCH 15/18] acpi: use ARRAY_SIZE
> 
> On Tue, Oct 3, 2017 at 2:34 PM, Colin Ian King
> <colin.king(a)canonical.com> wrote:
> > On 03/10/17 12:39, Rafael J. Wysocki wrote:
> >> On Tuesday, October 3, 2017 3:16:22 AM CEST Jérémy Lefaure wrote:
> >>> On Mon, 02 Oct 2017 14:27:52 +0200
> >>> "Rafael J. Wysocki" <rjw(a)rjwysocki.net> wrote:
> >>>
> >>>> ACPICA is soewhat special code, though and I'm not taking or ACKing
> >>>> patches for it directly as a rule.
> >>>>
> >>>> For one, I'm not sure if ACPICA can use ARRAY_SIZE at all.
> >>> Why is it special code that can't use ARRAY_SIZE ? Is it because
> >>> this macro is defined in linux/kernel.h ?
> >
> > However, ACPICA does have ACPI_ARRAY_LENGTH(x), see
> > source/include/actypes.h
> 
> Fair enough, but that cleanup should go in via ACPICA upstream anyway.
[Moore, Robert] 

This would be acceptable, as long as it will work properly in the cases that were presented earlier (using ARRAY_SIZE).


> 
> Thanks,
> Rafael
> _______________________________________________
> Devel mailing list
> Devel(a)acpica.org
> https://lists.acpica.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 114+ messages in thread

end of thread, other threads:[~2017-12-08 13:20 UTC | newest]

Thread overview: 114+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-01 19:30 [PATCH 00/18] use ARRAY_SIZE macro Jérémy Lefaure
2017-10-01 19:30 ` Jérémy Lefaure
2017-10-01 19:30 ` Jérémy Lefaure
2017-10-01 19:30 ` Jérémy Lefaure
2017-10-01 19:30 ` Jérémy Lefaure
2017-10-01 19:30 ` [Intel-wired-lan] " =?unknown-8bit?q?J=C3=A9r=C3=A9my?= Lefaure
2017-10-01 19:30 ` Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 01/18] sound: use ARRAY_SIZE Jérémy Lefaure
2017-10-02  4:16   ` Joe Perches
2017-10-03  1:12     ` Jérémy Lefaure
2017-10-03  1:12       ` Jérémy Lefaure
2017-10-03  7:03   ` Takashi Iwai
2017-10-03  7:03     ` Takashi Iwai
2017-10-01 19:30 ` [PATCH 02/18] tracing/filter: " Jérémy Lefaure
2017-10-04  1:05   ` Steven Rostedt
2017-10-01 19:30 ` [PATCH 03/18] media: " Jérémy Lefaure
2017-10-02 10:34   ` Michael Ira Krufky
2017-10-01 19:30 ` [PATCH 04/18] IB/mlx5: Use ARRAY_SIZE Jérémy Lefaure
     [not found]   ` <20171001193101.8898-5-jeremy.lefaure-tU7rkvAWjlwhT4uAktR2oQ@public.gmane.org>
2017-10-02  4:38     ` Leon Romanovsky
2017-10-02  4:38       ` Leon Romanovsky
2017-10-01 19:30 ` [Intel-wired-lan] [PATCH 05/18] net: use ARRAY_SIZE =?unknown-8bit?q?J=C3=A9r=C3=A9my?= Lefaure
2017-10-01 19:30   ` Jérémy Lefaure
2017-10-02 13:07   ` [Intel-wired-lan] " Andy Shevchenko
2017-10-02 13:07     ` Andy Shevchenko
2017-10-02 13:07     ` Andy Shevchenko
2017-10-02 13:07     ` Andy Shevchenko
2017-10-03  1:22     ` [Intel-wired-lan] " =?unknown-8bit?q?J=C3=A9r=C3=A9my?= Lefaure
2017-10-03  1:22       ` Jérémy Lefaure
2017-10-03  1:22       ` Jérémy Lefaure
2017-10-03  8:09       ` [Intel-wired-lan] " Andy Shevchenko
2017-10-03  8:09         ` Andy Shevchenko
2017-10-03  8:09         ` Andy Shevchenko
2017-10-03  8:09         ` Andy Shevchenko
2017-10-02 13:46   ` [Intel-wired-lan] " Kalle Valo
2017-10-02 13:46     ` Kalle Valo
2017-10-02 13:46     ` Kalle Valo
2017-10-02 13:46     ` Kalle Valo
2017-10-03  1:23     ` [Intel-wired-lan] " =?unknown-8bit?q?J=C3=A9r=C3=A9my?= Lefaure
2017-10-03  1:23       ` Jérémy Lefaure
2017-10-03  1:23       ` Jérémy Lefaure
2017-11-14  3:19   ` [PATCH v2] wireless: " Jérémy Lefaure
2017-12-08 13:20     ` [v2] " Kalle Valo
2017-11-14  3:24   ` [PATCH v2] net: " Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 06/18] drm: " Jérémy Lefaure
     [not found]   ` <20171001193101.8898-7-jeremy.lefaure-tU7rkvAWjlwhT4uAktR2oQ@public.gmane.org>
2017-10-02  7:43     ` Jani Nikula
2017-10-02  7:43       ` Jani Nikula
2017-10-02  8:27   ` Thierry Reding
2017-10-02  8:27     ` Thierry Reding
2017-10-01 19:30 ` [PATCH 07/18] scsi: bfa: " Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 08/18] ecryptfs: " Jérémy Lefaure
2017-10-14  1:31   ` Tyler Hicks
2017-10-01 19:30 ` [PATCH 09/18] nfsd: " Jérémy Lefaure
2017-10-02 11:03   ` Jeff Layton
2017-10-01 19:30 ` [PATCH 10/18] orangefs: " Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 11/18] dm space map metadata: " Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 12/18] x86: " Jérémy Lefaure
2017-10-19 14:18   ` [tip:x86/cleanups] x86: Use ARRAY_SIZE tip-bot for Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 13/18] tpm: use ARRAY_SIZE Jérémy Lefaure
2017-10-01 19:30   ` Jérémy Lefaure
2017-10-04 12:14   ` Jarkko Sakkinen
2017-10-04 12:14     ` Jarkko Sakkinen
2017-10-10 20:30     ` Jérémy Lefaure
2017-10-10 20:30       ` Jérémy Lefaure
2017-10-11 11:48       ` Jarkko Sakkinen
2017-10-11 11:48         ` Jarkko Sakkinen
2017-10-01 19:30 ` [PATCH 14/18] ipmi: " Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 15/18] acpi: " Jérémy Lefaure
2017-10-02 12:27   ` [Devel] " Rafael J. Wysocki
2017-10-02 12:27     ` Rafael J. Wysocki
2017-10-03  1:16     ` Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 16/18] media: staging: atomisp: " Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 17/18] staging: rtl8723bs: " Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 18/18] staging: rtlwifi: " Jérémy Lefaure
2017-10-01 22:01 ` [PATCH 00/18] use ARRAY_SIZE macro Tobin C. Harding
2017-10-01 22:01   ` Tobin C. Harding
2017-10-01 22:01   ` Tobin C. Harding
2017-10-01 22:01   ` [Intel-wired-lan] " Tobin C. Harding
2017-10-02  0:52   ` Jérémy Lefaure
2017-10-02  0:52     ` Jérémy Lefaure
2017-10-02  0:52     ` Jérémy Lefaure
2017-10-02  0:52     ` Jérémy Lefaure
2017-10-02  0:52     ` [Intel-wired-lan] " =?unknown-8bit?q?J=C3=A9r=C3=A9my?= Lefaure
2017-10-02  5:35     ` Greg KH
2017-10-02  5:35       ` Greg KH
2017-10-02  5:35       ` Greg KH
2017-10-02  5:35       ` [Intel-wired-lan] " Greg KH
2017-10-02 19:22       ` J. Bruce Fields
2017-10-02 19:22         ` J. Bruce Fields
2017-10-02 19:22         ` J. Bruce Fields
2017-10-02 19:22         ` [Intel-wired-lan] " J. Bruce Fields
2017-10-03  1:33         ` Jérémy Lefaure
2017-10-03  1:33           ` Jérémy Lefaure
2017-10-03  1:33           ` Jérémy Lefaure
2017-10-03  1:33           ` Jérémy Lefaure
2017-10-03  1:33           ` [Intel-wired-lan] " =?unknown-8bit?q?J=C3=A9r=C3=A9my?= Lefaure
2017-10-03  1:33           ` Jérémy Lefaure
2017-10-05 17:57           ` J. Bruce Fields
2017-10-05 17:57             ` J. Bruce Fields
2017-10-05 17:57             ` J. Bruce Fields
2017-10-05 17:57             ` [Intel-wired-lan] " J. Bruce Fields
2017-10-02 16:37     ` Mauro Carvalho Chehab
2017-10-02 16:37       ` Mauro Carvalho Chehab
2017-10-02 16:37       ` Mauro Carvalho Chehab
2017-10-02 16:37       ` [Intel-wired-lan] " Mauro Carvalho Chehab
2017-10-02 17:05 ` Zhi Wang
2017-10-02 17:05   ` [Intel-wired-lan] [Intel-gfx] " Zhi Wang
  -- strict thread matches above, loose matches on Subject: below --
2017-10-03 11:39 [Devel] [PATCH 15/18] acpi: use ARRAY_SIZE Rafael J. Wysocki
2017-10-03 11:39 ` Rafael J. Wysocki
2017-10-03 12:34 [Devel] " Colin Ian King
2017-10-03 12:34 ` Colin Ian King
2017-10-03 16:04 Rafael J. Wysocki
2017-10-03 16:04 ` Rafael J. Wysocki
2017-10-03 16:38 Moore, Robert
2017-10-03 16:38 ` Moore, Robert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.