All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 8/10] ath9k: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
                   ` (4 preceding siblings ...)
  2017-09-03 12:19 ` [PATCH 10/10] staging/atomisp: " Thomas Meyer
@ 2017-09-03 12:19 ` Thomas Meyer
  2017-09-25  7:15   ` [8/10] " Kalle Valo
  2017-09-03 12:19 ` [PATCH 5/10] [media] lgdt3306a: " Thomas Meyer
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: kvalo, linux-wireless, netdev, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 3dbfd86ebe36..c2e210c0a770 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -15,6 +15,7 @@
  */
 
 #include <asm/unaligned.h>
+#include <linux/kernel.h>
 #include "hw.h"
 #include "ar9003_phy.h"
 #include "ar9003_eeprom.h"
@@ -2946,14 +2947,12 @@ static const struct ar9300_eeprom *ar9300_eep_templates[] = {
 
 static const struct ar9300_eeprom *ar9003_eeprom_struct_find_by_id(int id)
 {
-#define N_LOOP (sizeof(ar9300_eep_templates) / sizeof(ar9300_eep_templates[0]))
 	int it;
 
-	for (it = 0; it < N_LOOP; it++)
+	for (it = 0; it < ARRAY_SIZE(ar9300_eep_templates); it++)
 		if (ar9300_eep_templates[it]->templateVersion == id)
 			return ar9300_eep_templates[it];
 	return NULL;
-#undef N_LOOP
 }
 
 static int ath9k_hw_ar9300_check_eeprom(struct ath_hw *ah)

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

* [PATCH 7/10] net/mlx4_core: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
  2017-09-03 12:19 ` [PATCH 9/10] [SCSI] bfa: Use ARRAY_SIZE macro Thomas Meyer
  2017-09-03 12:19   ` Thomas Meyer
@ 2017-09-03 12:19 ` Thomas Meyer
  2017-09-03 13:14   ` Tariq Toukan
       [not found]   ` <1504439110050-1961876957-7-diffsplit-thomas-VsYtu1Qij5c@public.gmane.org>
  2017-09-03 12:19 ` [PATCH 2/10] drm/amdgpu: " Thomas Meyer
                   ` (7 subsequent siblings)
  10 siblings, 2 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: netdev, linux-rdma, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 041c0ed65929..8eca12927be0 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -36,6 +36,7 @@
 #include <linux/mlx4/cmd.h>
 #include <linux/module.h>
 #include <linux/cache.h>
+#include <linux/kernel.h>
 
 #include "fw.h"
 #include "icm.h"
@@ -2450,14 +2451,14 @@ int mlx4_config_dev_retrieval(struct mlx4_dev *dev,
 	csum_mask = (config_dev.rx_checksum_val >> CONFIG_DEV_RX_CSUM_MODE_PORT1_BIT_OFFSET) &
 			CONFIG_DEV_RX_CSUM_MODE_MASK;
 
-	if (csum_mask >= sizeof(config_dev_csum_flags)/sizeof(config_dev_csum_flags[0]))
+	if (csum_mask >= ARRAY_SIZE(config_dev_csum_flags))
 		return -EINVAL;
 	params->rx_csum_flags_port_1 = config_dev_csum_flags[csum_mask];
 
 	csum_mask = (config_dev.rx_checksum_val >> CONFIG_DEV_RX_CSUM_MODE_PORT2_BIT_OFFSET) &
 			CONFIG_DEV_RX_CSUM_MODE_MASK;
 
-	if (csum_mask >= sizeof(config_dev_csum_flags)/sizeof(config_dev_csum_flags[0]))
+	if (csum_mask >= ARRAY_SIZE(config_dev_csum_flags))
 		return -EINVAL;
 	params->rx_csum_flags_port_2 = config_dev_csum_flags[csum_mask];
 
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 5fe5cdc51357..fe18650c9342 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -34,6 +34,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/pci.h>
@@ -3658,7 +3659,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
 	 * per port, we must limit the number of VFs to 63 (since their are
 	 * 128 MACs)
 	 */
-	for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]) && i < num_vfs_argc;
+	for (i = 0; i < ARRAY_SIZE(nvfs) && i < num_vfs_argc;
 	     total_vfs += nvfs[param_map[num_vfs_argc - 1][i]], i++) {
 		nvfs[param_map[num_vfs_argc - 1][i]] = num_vfs[i];
 		if (nvfs[i] < 0) {
@@ -3667,7 +3668,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
 			goto err_disable_pdev;
 		}
 	}
-	for (i = 0; i < sizeof(prb_vf)/sizeof(prb_vf[0]) && i < probe_vfs_argc;
+	for (i = 0; i < ARRAY_SIZE(prb_vf) && i < probe_vfs_argc;
 	     i++) {
 		prb_vf[param_map[probe_vfs_argc - 1][i]] = probe_vf[i];
 		if (prb_vf[i] < 0 || prb_vf[i] > nvfs[i]) {
@@ -3746,11 +3747,11 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
 		if (total_vfs) {
 			unsigned vfs_offset = 0;
 
-			for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]) &&
+			for (i = 0; i < ARRAY_SIZE(nvfs) &&
 			     vfs_offset + nvfs[i] < extended_func_num(pdev);
 			     vfs_offset += nvfs[i], i++)
 				;
-			if (i == sizeof(nvfs)/sizeof(nvfs[0])) {
+			if (i == ARRAY_SIZE(nvfs)) {
 				err = -ENODEV;
 				goto err_release_regions;
 			}

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

* [PATCH 5/10] [media] lgdt3306a: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
                   ` (5 preceding siblings ...)
  2017-09-03 12:19 ` [PATCH 8/10] ath9k: " Thomas Meyer
@ 2017-09-03 12:19 ` Thomas Meyer
  2017-09-03 12:19 ` [PATCH 3/10] drm/i915/gvt: " Thomas Meyer
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: mchehab, linux-media, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c
index c9b1eb38444e..724e9aac0f11 100644
--- a/drivers/media/dvb-frontends/lgdt3306a.c
+++ b/drivers/media/dvb-frontends/lgdt3306a.c
@@ -19,6 +19,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <asm/div64.h>
+#include <linux/kernel.h>
 #include <linux/dvb/frontend.h>
 #include "dvb_math.h"
 #include "lgdt3306a.h"
@@ -2072,7 +2073,7 @@ static const short regtab[] = {
 	0x30aa, /* MPEGLOCK */
 };
 
-#define numDumpRegs (sizeof(regtab)/sizeof(regtab[0]))
+#define numDumpRegs (ARRAY_SIZE(regtab))
 static u8 regval1[numDumpRegs] = {0, };
 static u8 regval2[numDumpRegs] = {0, };
 

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

* [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7
@ 2017-09-03 12:19 Thomas Meyer
  2017-09-03 12:19 ` [PATCH 9/10] [SCSI] bfa: Use ARRAY_SIZE macro Thomas Meyer
                   ` (10 more replies)
  0 siblings, 11 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.

Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Run against version v4.13-rc7

Let me know when you as a maintainer are not interested in these kind of patches.
I can exclude you by path; e.g. all findings in "drivers/scsi" will never
be reported again by this semi-automatic program runs.

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

* [PATCH 2/10] drm/amdgpu: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
                   ` (2 preceding siblings ...)
  2017-09-03 12:19 ` [PATCH 7/10] net/mlx4_core: " Thomas Meyer
@ 2017-09-03 12:19 ` Thomas Meyer
  2017-09-03 12:19 ` [PATCH 10/10] staging/atomisp: " Thomas Meyer
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: airlied, amd-gfx, dri-devel, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
index 9804318f3488..7ef84d884714 100644
--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
@@ -20,6 +20,8 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  *
  */
+#include <linux/kernel.h>
+
 #include "amdgpu.h"
 #include "mmhub_v1_0.h"
 
@@ -268,7 +270,7 @@ const struct pctl_data pctl0_data[] = {
     {0x135, 0x12a810},
     {0x149, 0x7a82c}
 };
-#define PCTL0_DATA_LEN (sizeof(pctl0_data)/sizeof(pctl0_data[0]))
+#define PCTL0_DATA_LEN (ARRAY_SIZE(pctl0_data))
 
 #define PCTL0_RENG_EXEC_END_PTR 0x151
 #define PCTL0_STCTRL_REG_SAVE_RANGE0_BASE  0xa640
@@ -297,7 +299,7 @@ const struct pctl_data pctl1_data[] = {
     {0x1be, 0x17a7dd},
     {0x1d7, 0x12a810}
 };
-#define PCTL1_DATA_LEN (sizeof(pctl1_data)/sizeof(pctl1_data[0]))
+#define PCTL1_DATA_LEN (ARRAY_SIZE(pctl1_data))
 
 #define PCTL1_RENG_EXEC_END_PTR 0x1ea
 #define PCTL1_STCTRL_REG_SAVE_RANGE0_BASE  0xa000

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

* [PATCH 10/10] staging/atomisp: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
                   ` (3 preceding siblings ...)
  2017-09-03 12:19 ` [PATCH 2/10] drm/amdgpu: " Thomas Meyer
@ 2017-09-03 12:19 ` Thomas Meyer
  2017-09-03 12:19 ` [PATCH 8/10] ath9k: " Thomas Meyer
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: mchehab, linux-media, devel, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c
index a7c6bba7e094..11d3995ba0db 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c
@@ -29,6 +29,7 @@ more details.
 #endif
 
 #include "system_global.h"
+#include <linux/kernel.h>
 
 #ifdef USE_INPUT_SYSTEM_VERSION_2
 
@@ -487,7 +488,7 @@ static void ifmtr_set_if_blocking_mode(
 {
 	int i;
 	bool block[] = { false, false, false, false };
-	assert(N_INPUT_FORMATTER_ID <= (sizeof(block) / sizeof(block[0])));
+	assert(N_INPUT_FORMATTER_ID <= (ARRAY_SIZE(block)));
 
 #if !defined(IS_ISP_2400_SYSTEM)
 #error "ifmtr_set_if_blocking_mode: ISP_SYSTEM must be one of {IS_ISP_2400_SYSTEM}"

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

* [PATCH 4/10] drm/nouveau/bios/init: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
                   ` (8 preceding siblings ...)
  2017-09-03 12:19 ` [PATCH 6/10] ixgbe: " Thomas Meyer
@ 2017-09-03 12:19 ` Thomas Meyer
  2017-09-03 15:36 ` [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Joe Perches
  10 siblings, 0 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: airlied, dri-devel, nouveau, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
index b58ee99f7bfc..440efa333d6c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
@@ -21,6 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
+#include <linux/kernel.h>
 #include <subdev/bios.h>
 #include <subdev/bios/bit.h>
 #include <subdev/bios/bmp.h>
@@ -2271,7 +2272,7 @@ static struct nvbios_init_opcode {
 	[0xaa] = { init_reserved },
 };
 
-#define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0]))
+#define init_opcode_nr (ARRAY_SIZE(init_opcode))
 
 int
 nvbios_exec(struct nvbios_init *init)

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

* [PATCH 9/10] [SCSI] bfa: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
@ 2017-09-03 12:19 ` Thomas Meyer
  2017-09-03 12:19   ` Thomas Meyer
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: jejb, martin.petersen, linux-scsi, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index 3e1caec82554..4a03cd9fa63f 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -16,6 +16,7 @@
  * General Public License for more details.
  */
 
+#include <linux/kernel.h>
 #include "bfad_drv.h"
 #include "bfa_modules.h"
 #include "bfi_reg.h"
@@ -1957,7 +1958,7 @@ bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids)
 		{BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT_FC},
 	};
 
-	*npciids = sizeof(__pciids) / sizeof(__pciids[0]);
+	*npciids = ARRAY_SIZE(__pciids);
 	*pciids = __pciids;
 }
 

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

* [PATCH 3/10] drm/i915/gvt: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
                   ` (6 preceding siblings ...)
  2017-09-03 12:19 ` [PATCH 5/10] [media] lgdt3306a: " Thomas Meyer
@ 2017-09-03 12:19 ` Thomas Meyer
  2017-09-03 12:19 ` [PATCH 6/10] ixgbe: " Thomas Meyer
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: airlied, intel-gvt-dev, intel-gfx, dri-devel, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index 3deadcbd5a24..7d8035093a1e 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -30,6 +30,7 @@
  *    Bing Niu <bing.niu@intel.com>
  *
  */
+#include <linux/kernel.h>
 
 #include "i915_drv.h"
 #include "gvt.h"
@@ -115,7 +116,7 @@ int intel_gvt_init_vgpu_types(struct intel_gvt *gvt)
 	 */
 	low_avail = gvt_aperture_sz(gvt) - HOST_LOW_GM_SIZE;
 	high_avail = gvt_hidden_sz(gvt) - HOST_HIGH_GM_SIZE;
-	num_types = sizeof(vgpu_types) / sizeof(vgpu_types[0]);
+	num_types = ARRAY_SIZE(vgpu_types);
 
 	gvt->types = kzalloc(num_types * sizeof(struct intel_vgpu_type),
 			     GFP_KERNEL);

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

* [PATCH 6/10] ixgbe: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
                   ` (7 preceding siblings ...)
  2017-09-03 12:19 ` [PATCH 3/10] drm/i915/gvt: " Thomas Meyer
@ 2017-09-03 12:19 ` Thomas Meyer
  2017-09-05 18:50   ` David Miller
  2017-09-03 12:19 ` [PATCH 4/10] drm/nouveau/bios/init: " Thomas Meyer
  2017-09-03 15:36 ` [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Joe Perches
  10 siblings, 1 reply; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: netdev, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index 72d84a065e34..fabb11475fb4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -21,6 +21,7 @@
  *  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  *
  ******************************************************************************/
+#include <linux/kernel.h>
 #include "ixgbe_x540.h"
 #include "ixgbe_type.h"
 #include "ixgbe_common.h"
@@ -947,7 +948,7 @@ static s32 ixgbe_checksum_ptr_x550(struct ixgbe_hw *hw, u16 ptr,
 	u16 length, bufsz, i, start;
 	u16 *local_buffer;
 
-	bufsz = sizeof(buf) / sizeof(buf[0]);
+	bufsz = ARRAY_SIZE(buf);
 
 	/* Read a chunk at the pointer location */
 	if (!buffer) {

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

* [PATCH 1/10] KVM: PPC: Book3S HV: Use ARRAY_SIZE macro
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
@ 2017-09-03 12:19   ` Thomas Meyer
  2017-09-03 12:19   ` Thomas Meyer
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: kvm-ppc, kvm, linuxppc-dev, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 359c79cdf0cc..ae80181c4e1f 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -19,6 +19,7 @@
  */
 
 #include <linux/kvm_host.h>
+#include <linux/kernel.h>
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/preempt.h>
@@ -1766,7 +1767,7 @@ static struct debugfs_timings_element {
 	{"cede",	offsetof(struct kvm_vcpu, arch.cede_time)},
 };
 
-#define N_TIMINGS	(sizeof(timings) / sizeof(timings[0]))
+#define N_TIMINGS	(ARRAY_SIZE(timings))
 
 struct debugfs_timings_state {
 	struct kvm_vcpu	*vcpu;

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

* [PATCH 1/10] KVM: PPC: Book3S HV: Use ARRAY_SIZE macro
@ 2017-09-03 12:19   ` Thomas Meyer
  0 siblings, 0 replies; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 12:19 UTC (permalink / raw)
  To: kvm-ppc, kvm, linuxppc-dev, linux-kernel

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 359c79cdf0cc..ae80181c4e1f 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -19,6 +19,7 @@
  */
 
 #include <linux/kvm_host.h>
+#include <linux/kernel.h>
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/preempt.h>
@@ -1766,7 +1767,7 @@ static struct debugfs_timings_element {
 	{"cede",	offsetof(struct kvm_vcpu, arch.cede_time)},
 };
 
-#define N_TIMINGS	(sizeof(timings) / sizeof(timings[0]))
+#define N_TIMINGS	(ARRAY_SIZE(timings))
 
 struct debugfs_timings_state {
 	struct kvm_vcpu	*vcpu;

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

* Re: [PATCH 7/10] net/mlx4_core: Use ARRAY_SIZE macro
  2017-09-03 12:19 ` [PATCH 7/10] net/mlx4_core: " Thomas Meyer
@ 2017-09-03 13:14   ` Tariq Toukan
       [not found]   ` <1504439110050-1961876957-7-diffsplit-thomas-VsYtu1Qij5c@public.gmane.org>
  1 sibling, 0 replies; 27+ messages in thread
From: Tariq Toukan @ 2017-09-03 13:14 UTC (permalink / raw)
  To: Thomas Meyer, netdev, linux-rdma, linux-kernel



On 03/09/2017 3:19 PM, Thomas Meyer wrote:
> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---


Reviewed-by: Tariq Toukan <tariqt@mellanox.com>

Thanks Thomas!

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

* Re: [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7
  2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
                   ` (9 preceding siblings ...)
  2017-09-03 12:19 ` [PATCH 4/10] drm/nouveau/bios/init: " Thomas Meyer
@ 2017-09-03 15:36 ` Joe Perches
  2017-09-03 19:59   ` Thomas Meyer
  10 siblings, 1 reply; 27+ messages in thread
From: Joe Perches @ 2017-09-03 15:36 UTC (permalink / raw)
  To: Thomas Meyer, linux-kernel

On Sun, 2017-09-03 at 14:19 +0200, Thomas Meyer wrote:
> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> 
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.

Hey Thomas.

There are some instances that span multiple lines that
the regex above misses.

For instance:

diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index 3d701c7a4c91..26a825bd7581 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -929,8 +929,7 @@ static int mlx5_ib_mr_initiator_pfault_handler(
                return -EFAULT;
        }
 
-       if (unlikely(opcode >= sizeof(mlx5_ib_odp_opcode_cap) /
-           sizeof(mlx5_ib_odp_opcode_cap[0]) ||
+       if (unlikely(opcode >= ARRAY_SIZE(mlx5_ib_odp_opcode_cap) ||

Here is another perl command regex that fixes a few more:

$ perl -i -e 'local $/; while (<>) { s/\bsizeof\s*\(\s*(\w+)\s*\)\s*\/\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)/ARRAY_SIZE(\1)/g; print; }' $file

This regex could still miss variants that
have a comment or that don't use parentheses
around the sizeof.

It seems none of those styles exist though.

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

* Re: [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7
  2017-09-03 15:36 ` [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Joe Perches
@ 2017-09-03 19:59   ` Thomas Meyer
  2017-09-03 20:20     ` Joe Perches
  0 siblings, 1 reply; 27+ messages in thread
From: Thomas Meyer @ 2017-09-03 19:59 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel

On Sun, Sep 03, 2017 at 08:36:02AM -0700, Joe Perches wrote:
> On Sun, 2017-09-03 at 14:19 +0200, Thomas Meyer wrote:
> > Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> > yourself.
> > 
> > Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> > 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> > /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Hey Thomas.

Hi Joe,
> 
> There are some instances that span multiple lines that
> the regex above misses.
> 
> For instance:
> 
> diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
> index 3d701c7a4c91..26a825bd7581 100644
> --- a/drivers/infiniband/hw/mlx5/odp.c
> +++ b/drivers/infiniband/hw/mlx5/odp.c
> @@ -929,8 +929,7 @@ static int mlx5_ib_mr_initiator_pfault_handler(
>                 return -EFAULT;
>         }
>  
> -       if (unlikely(opcode >= sizeof(mlx5_ib_odp_opcode_cap) /
> -           sizeof(mlx5_ib_odp_opcode_cap[0]) ||
> +       if (unlikely(opcode >= ARRAY_SIZE(mlx5_ib_odp_opcode_cap) ||
> 
> Here is another perl command regex that fixes a few more:
> 
> $ perl -i -e 'local $/; while (<>) { s/\bsizeof\s*\(\s*(\w+)\s*\)\s*\/\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)/ARRAY_SIZE(\1)/g; print; }' $file
> 
> This regex could still miss variants that
> have a comment or that don't use parentheses
> around the sizeof.

Okay, fine, but I think this patch series is okay to go in anyway. I will
re-run with above regex after the next rcX tag. Would that be fine for you?
What do you think?

> 
> It seems none of those styles exist though.
> 

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

* Re: [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7
  2017-09-03 19:59   ` Thomas Meyer
@ 2017-09-03 20:20     ` Joe Perches
  0 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2017-09-03 20:20 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: linux-kernel

On Sun, 2017-09-03 at 21:59 +0200, Thomas Meyer wrote:
> On Sun, Sep 03, 2017 at 08:36:02AM -0700, Joe Perches wrote:
> > On Sun, 2017-09-03 at 14:19 +0200, Thomas Meyer wrote:
> > > Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> > > yourself.
> > > 
> > > Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> > > 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> > > /ARRAY_SIZE(\1)/g' and manual check/verification.
> > 
> > Hey Thomas.
> 
> Hi Joe,
> > 
> > There are some instances that span multiple lines that
> > the regex above misses.
> > 
> > For instance:
> > 
> > diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
> > index 3d701c7a4c91..26a825bd7581 100644
> > --- a/drivers/infiniband/hw/mlx5/odp.c
> > +++ b/drivers/infiniband/hw/mlx5/odp.c
> > @@ -929,8 +929,7 @@ static int mlx5_ib_mr_initiator_pfault_handler(
> >                 return -EFAULT;
> >         }
> >  
> > -       if (unlikely(opcode >= sizeof(mlx5_ib_odp_opcode_cap) /
> > -           sizeof(mlx5_ib_odp_opcode_cap[0]) ||
> > +       if (unlikely(opcode >= ARRAY_SIZE(mlx5_ib_odp_opcode_cap) ||
> > 
> > Here is another perl command regex that fixes a few more:
> > 
> > $ perl -i -e 'local $/; while (<>) { s/\bsizeof\s*\(\s*(\w+)\s*\)\s*\/\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)/ARRAY_SIZE(\1)/g; print; }' $file
> > 
> > This regex could still miss variants that
> > have a comment or that don't use parentheses
> > around the sizeof.
> 
> Okay, fine, but I think this patch series is okay to go in anyway. I will
> re-run with above regex after the next rcX tag. Would that be fine for you?
> What do you think?

I think whatever you want to do is fine with me.

If you want, you could use the simple cocci script below
which is _much_ better than the perl regex as it can
find all the appropriate cases not just
	sizeof(var)/sizeof(var[0])

$ cat array_size.cocci
@@
type T;
T[] E;
@@

(
- sizeof(E) /sizeof(*E)
+ ARRAY_SIZE(E)
|
- sizeof(E) /sizeof(E[...])
+ ARRAY_SIZE(E)
|
- sizeof(E) /sizeof(T)
+ ARRAY_SIZE(E)
)
$ 

and maybe this

$ spatch --in-place --all-includes --sp-file array_size.cocci .

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

* Re: [PATCH 6/10] ixgbe: Use ARRAY_SIZE macro
  2017-09-03 12:19 ` [PATCH 6/10] ixgbe: " Thomas Meyer
@ 2017-09-05 18:50   ` David Miller
  2017-09-05 19:45     ` Thomas Meyer
  0 siblings, 1 reply; 27+ messages in thread
From: David Miller @ 2017-09-05 18:50 UTC (permalink / raw)
  To: thomas; +Cc: netdev, linux-kernel

From: Thomas Meyer <thomas@m3y3r.de>
Date: Sun, 03 Sep 2017 14:19:31 +0200

> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

This should be submitted to the Intel ethernet driver maintainers.

Thank you.

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

* Re: [PATCH 7/10] net/mlx4_core: Use ARRAY_SIZE macro
  2017-09-03 12:19 ` [PATCH 7/10] net/mlx4_core: " Thomas Meyer
@ 2017-09-05 18:50       ` David Miller
       [not found]   ` <1504439110050-1961876957-7-diffsplit-thomas-VsYtu1Qij5c@public.gmane.org>
  1 sibling, 0 replies; 27+ messages in thread
From: David Miller @ 2017-09-05 18:50 UTC (permalink / raw)
  To: thomas-VsYtu1Qij5c
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Thomas Meyer <thomas-VsYtu1Qij5c@public.gmane.org>
Date: Sun, 03 Sep 2017 14:19:31 +0200

> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Signed-off-by: Thomas Meyer <thomas-VsYtu1Qij5c@public.gmane.org>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 7/10] net/mlx4_core: Use ARRAY_SIZE macro
@ 2017-09-05 18:50       ` David Miller
  0 siblings, 0 replies; 27+ messages in thread
From: David Miller @ 2017-09-05 18:50 UTC (permalink / raw)
  To: thomas; +Cc: netdev, linux-rdma, linux-kernel

From: Thomas Meyer <thomas@m3y3r.de>
Date: Sun, 03 Sep 2017 14:19:31 +0200

> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

Applied.

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

* Re: [PATCH 6/10] ixgbe: Use ARRAY_SIZE macro
  2017-09-05 18:50   ` David Miller
@ 2017-09-05 19:45     ` Thomas Meyer
  2017-09-05 20:01       ` Joe Perches
  0 siblings, 1 reply; 27+ messages in thread
From: Thomas Meyer @ 2017-09-05 19:45 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-kernel

On Tue, Sep 05, 2017 at 11:50:44AM -0700, David Miller wrote:
> From: Thomas Meyer <thomas@m3y3r.de>
> Date: Sun, 03 Sep 2017 14:19:31 +0200
> 
> > Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> > yourself.
> > Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> > 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> > /ARRAY_SIZE(\1)/g' and manual check/verification.
> > 
> > Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> 
> This should be submitted to the Intel ethernet driver maintainers.
Hi,

my script checks the output of get_maintainer scripts and only sends to "open
list" entries.

The intel-wired-lan@lists.osuosl.org is moderated, so that's why the patch
wasn't send there.

Strangely the lists for nouveau@lists.freedesktop.org and
intel-gvt-dev@lists.freedesktop.org appears as open lists in the MAINTAINERS
file but seems to be also moderated lists... At least I got some reply that my
message awaits approval. Maybe an update to the MAINTAINERS file is missing
here?

I may drop above check in my script and send to all mailing lists that
get_maintainer.pl will return.

> 
> Thank you.

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

* Re: [PATCH 6/10] ixgbe: Use ARRAY_SIZE macro
  2017-09-05 19:45     ` Thomas Meyer
@ 2017-09-05 20:01       ` Joe Perches
  2017-09-05 21:22         ` David Miller
  0 siblings, 1 reply; 27+ messages in thread
From: Joe Perches @ 2017-09-05 20:01 UTC (permalink / raw)
  To: Thomas Meyer, David Miller; +Cc: netdev, linux-kernel

On Tue, 2017-09-05 at 21:45 +0200, Thomas Meyer wrote:
> On Tue, Sep 05, 2017 at 11:50:44AM -0700, David Miller wrote:
> > From: Thomas Meyer <thomas@m3y3r.de>
> > Date: Sun, 03 Sep 2017 14:19:31 +0200
> > 
> > > Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> > > yourself.
> > > Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> > > 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> > > /ARRAY_SIZE(\1)/g' and manual check/verification.
> > > 
> > > Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> > 
> > This should be submitted to the Intel ethernet driver maintainers.
> 
> Hi,
> 
> my script checks the output of get_maintainer scripts and only sends to "open
> list" entries.
> 
> The intel-wired-lan@lists.osuosl.org is moderated, so that's why the patch
> wasn't send there.
> 
> Strangely the lists for nouveau@lists.freedesktop.org and
> intel-gvt-dev@lists.freedesktop.org appears as open lists in the MAINTAINERS
> file but seems to be also moderated lists... At least I got some reply that my
> message awaits approval. Maybe an update to the MAINTAINERS file is missing
> here?
> 
> I may drop above check in my script and send to all mailing lists that
> get_maintainer.pl will return.

There's a difference between moderated and subscriber-only
entries in MAINTAINERS.

get_maintainers will by default list moderated lists and
not show subscriber-only lists unless using the -s switch.

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

* Re: [PATCH 6/10] ixgbe: Use ARRAY_SIZE macro
  2017-09-05 20:01       ` Joe Perches
@ 2017-09-05 21:22         ` David Miller
  2017-09-06  9:08           ` Thomas Meyer
  0 siblings, 1 reply; 27+ messages in thread
From: David Miller @ 2017-09-05 21:22 UTC (permalink / raw)
  To: joe; +Cc: thomas, netdev, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Tue, 05 Sep 2017 13:01:18 -0700

> On Tue, 2017-09-05 at 21:45 +0200, Thomas Meyer wrote:
>> On Tue, Sep 05, 2017 at 11:50:44AM -0700, David Miller wrote:
>> > From: Thomas Meyer <thomas@m3y3r.de>
>> > Date: Sun, 03 Sep 2017 14:19:31 +0200
>> > 
>> > > Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
>> > > yourself.
>> > > Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
>> > > 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
>> > > /ARRAY_SIZE(\1)/g' and manual check/verification.
>> > > 
>> > > Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
>> > 
>> > This should be submitted to the Intel ethernet driver maintainers.
>> 
>> Hi,
>> 
>> my script checks the output of get_maintainer scripts and only sends to "open
>> list" entries.
>> 
>> The intel-wired-lan@lists.osuosl.org is moderated, so that's why the patch
>> wasn't send there.
>> 
>> Strangely the lists for nouveau@lists.freedesktop.org and
>> intel-gvt-dev@lists.freedesktop.org appears as open lists in the MAINTAINERS
>> file but seems to be also moderated lists... At least I got some reply that my
>> message awaits approval. Maybe an update to the MAINTAINERS file is missing
>> here?
>> 
>> I may drop above check in my script and send to all mailing lists that
>> get_maintainer.pl will return.
> 
> There's a difference between moderated and subscriber-only
> entries in MAINTAINERS.
> 
> get_maintainers will by default list moderated lists and
> not show subscriber-only lists unless using the -s switch.

Furthermore, nothing prevented you from CC:'ing the maintainer,
Jeff Kirscher.

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

* Re: [PATCH 6/10] ixgbe: Use ARRAY_SIZE macro
  2017-09-05 21:22         ` David Miller
@ 2017-09-06  9:08           ` Thomas Meyer
  2017-09-06 15:19             ` Joe Perches
  0 siblings, 1 reply; 27+ messages in thread
From: Thomas Meyer @ 2017-09-06  9:08 UTC (permalink / raw)
  To: David Miller; +Cc: joe, netdev, linux-kernel

On Tue, Sep 05, 2017 at 02:22:05PM -0700, David Miller wrote:
> From: Joe Perches <joe@perches.com>
> Date: Tue, 05 Sep 2017 13:01:18 -0700
> 
> > On Tue, 2017-09-05 at 21:45 +0200, Thomas Meyer wrote:
> >> On Tue, Sep 05, 2017 at 11:50:44AM -0700, David Miller wrote:
> >> > From: Thomas Meyer <thomas@m3y3r.de>
> >> > Date: Sun, 03 Sep 2017 14:19:31 +0200
> >> > 
> >> > > Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> >> > > yourself.
> >> > > Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> >> > > 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> >> > > /ARRAY_SIZE(\1)/g' and manual check/verification.
> >> > > 
> >> > > Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> >> > 
> >> > This should be submitted to the Intel ethernet driver maintainers.
> >> 
> >> Hi,
> >> 
> >> my script checks the output of get_maintainer scripts and only sends to "open
> >> list" entries.
> >> 
> >> The intel-wired-lan@lists.osuosl.org is moderated, so that's why the patch
> >> wasn't send there.
> >> 
> >> Strangely the lists for nouveau@lists.freedesktop.org and
> >> intel-gvt-dev@lists.freedesktop.org appears as open lists in the MAINTAINERS
> >> file but seems to be also moderated lists... At least I got some reply that my
> >> message awaits approval. Maybe an update to the MAINTAINERS file is missing
> >> here?
> >> 
> >> I may drop above check in my script and send to all mailing lists that
> >> get_maintainer.pl will return.
> > 
> > There's a difference between moderated and subscriber-only
> > entries in MAINTAINERS.
> > 
> > get_maintainers will by default list moderated lists and
> > not show subscriber-only lists unless using the -s switch.
> 
> Furthermore, nothing prevented you from CC:'ing the maintainer,
> Jeff Kirscher.

Hi,

That's the other condition in my script. I only send to the role
"maintainer" from the output of get_maintainer.pl. But Mr Jeff
Kirscher is only listed as supporter...

Anyway I did bounce the email to him.

with kind regards
thomas

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

* Re: [PATCH 6/10] ixgbe: Use ARRAY_SIZE macro
  2017-09-06  9:08           ` Thomas Meyer
@ 2017-09-06 15:19             ` Joe Perches
  0 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2017-09-06 15:19 UTC (permalink / raw)
  To: Thomas Meyer, David Miller; +Cc: netdev, linux-kernel

On Wed, 2017-09-06 at 11:08 +0200, Thomas Meyer wrote:
> On Tue, Sep 05, 2017 at 02:22:05PM -0700, David Miller wrote:
> > nothing prevented you from CC:'ing the maintainer,
> > Jeff Kirscher.
[]
> That's the other condition in my script. I only send to the role
> "maintainer" from the output of get_maintainer.pl. But Mr Jeff
> Kirscher is only listed as supporter...

Supporter means he gets paid to look after that
subsystem so he is something other than a volunteer.

from MAINTAINERS:
	S: Status, one of the following:
	   Supported:	Someone is actually paid to look after this.
	   Maintained:	Someone actually looks after it.
	   Odd Fixes:	It has a maintainer but they don't have time to do
			much other than throw the odd patch in. See below..
	   Orphan:	No current maintainer [but maybe you could take the
			role as you write your new code].
	   Obsolete:	Old code. Something tagged obsolete generally means
			it has been replaced by a better system and you
			should be using that.

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

* Re: [8/10] ath9k: Use ARRAY_SIZE macro
  2017-09-03 12:19 ` [PATCH 8/10] ath9k: " Thomas Meyer
@ 2017-09-25  7:15   ` Kalle Valo
  0 siblings, 0 replies; 27+ messages in thread
From: Kalle Valo @ 2017-09-25  7:15 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: kvalo, linux-wireless, netdev, linux-kernel

Thomas Meyer <thomas@m3y3r.de> wrote:

> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>

Patch applied to ath-next branch of ath.git, thanks.

896cbefadf62 ath9k: Use ARRAY_SIZE macro

-- 
https://patchwork.kernel.org/patch/9936271/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH 1/10] KVM: PPC: Book3S HV: Use ARRAY_SIZE macro
  2017-09-03 12:19   ` Thomas Meyer
@ 2017-10-19  3:44     ` Paul Mackerras
  -1 siblings, 0 replies; 27+ messages in thread
From: Paul Mackerras @ 2017-10-19  3:44 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: kvm-ppc, kvm, linuxppc-dev, linux-kernel

On Sun, Sep 03, 2017 at 02:19:31PM +0200, Thomas Meyer wrote:
> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

Thanks, applied to my kvm-ppc-next branch.

Paul.

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

* Re: [PATCH 1/10] KVM: PPC: Book3S HV: Use ARRAY_SIZE macro
@ 2017-10-19  3:44     ` Paul Mackerras
  0 siblings, 0 replies; 27+ messages in thread
From: Paul Mackerras @ 2017-10-19  3:44 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: kvm-ppc, kvm, linuxppc-dev, linux-kernel

On Sun, Sep 03, 2017 at 02:19:31PM +0200, Thomas Meyer wrote:
> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

Thanks, applied to my kvm-ppc-next branch.

Paul.

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

end of thread, other threads:[~2017-10-19  3:50 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-03 12:19 [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Thomas Meyer
2017-09-03 12:19 ` [PATCH 9/10] [SCSI] bfa: Use ARRAY_SIZE macro Thomas Meyer
2017-09-03 12:19 ` [PATCH 1/10] KVM: PPC: Book3S HV: " Thomas Meyer
2017-09-03 12:19   ` Thomas Meyer
2017-10-19  3:44   ` Paul Mackerras
2017-10-19  3:44     ` Paul Mackerras
2017-09-03 12:19 ` [PATCH 7/10] net/mlx4_core: " Thomas Meyer
2017-09-03 13:14   ` Tariq Toukan
     [not found]   ` <1504439110050-1961876957-7-diffsplit-thomas-VsYtu1Qij5c@public.gmane.org>
2017-09-05 18:50     ` David Miller
2017-09-05 18:50       ` David Miller
2017-09-03 12:19 ` [PATCH 2/10] drm/amdgpu: " Thomas Meyer
2017-09-03 12:19 ` [PATCH 10/10] staging/atomisp: " Thomas Meyer
2017-09-03 12:19 ` [PATCH 8/10] ath9k: " Thomas Meyer
2017-09-25  7:15   ` [8/10] " Kalle Valo
2017-09-03 12:19 ` [PATCH 5/10] [media] lgdt3306a: " Thomas Meyer
2017-09-03 12:19 ` [PATCH 3/10] drm/i915/gvt: " Thomas Meyer
2017-09-03 12:19 ` [PATCH 6/10] ixgbe: " Thomas Meyer
2017-09-05 18:50   ` David Miller
2017-09-05 19:45     ` Thomas Meyer
2017-09-05 20:01       ` Joe Perches
2017-09-05 21:22         ` David Miller
2017-09-06  9:08           ` Thomas Meyer
2017-09-06 15:19             ` Joe Perches
2017-09-03 12:19 ` [PATCH 4/10] drm/nouveau/bios/init: " Thomas Meyer
2017-09-03 15:36 ` [PATCH 0/10] Use ARRAY_SIZE macro - v4.13-rc7 Joe Perches
2017-09-03 19:59   ` Thomas Meyer
2017-09-03 20:20     ` Joe Perches

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.