* [PATCH 00/18] use ARRAY_SIZE macro
@ 2017-10-01 19:30 Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 15/18] acpi: use ARRAY_SIZE Jérémy Lefaure
` (2 more replies)
0 siblings, 3 replies; 16+ 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] 16+ messages in thread
* [PATCH 15/18] acpi: use ARRAY_SIZE
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-02 12:27 ` Rafael J. Wysocki
2017-10-01 22:01 ` [PATCH 00/18] use ARRAY_SIZE macro Tobin C. Harding
2017-10-02 17:05 ` Zhi Wang
2 siblings, 1 reply; 16+ messages in thread
From: Jérémy Lefaure @ 2017-10-01 19:30 UTC (permalink / raw)
To: Robert Moore, Lv Zheng, Rafael J. Wysocki, Len Brown
Cc: Jérémy Lefaure, linux-acpi, devel, linux-kernel
Using the ARRAY_SIZE macro improves the readability of the code. It is
useless to re-invent the ARRAY_SIZE macro so let's use it.
It is useless to re-invent the ARRAY_SIZE macro so let's use it.
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 <jeremy.lefaure@lse.epita.fr>
---
drivers/acpi/acpica/rsdumpinfo.c | 66 ++++++++++++++++++++--------------------
drivers/acpi/acpica/tbfadt.c | 13 +++-----
2 files changed, 37 insertions(+), 42 deletions(-)
diff --git a/drivers/acpi/acpica/rsdumpinfo.c b/drivers/acpi/acpica/rsdumpinfo.c
index da150e17795b..2cc52720b705 100644
--- a/drivers/acpi/acpica/rsdumpinfo.c
+++ b/drivers/acpi/acpica/rsdumpinfo.c
@@ -41,6 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
+#include <linux/kernel.h>
#include <acpi/acpi.h>
#include "accommon.h"
#include "acresrc.h"
@@ -51,7 +52,6 @@ ACPI_MODULE_NAME("rsdumpinfo")
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER)
#define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f)
#define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f)
-#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info))
/*******************************************************************************
*
* Resource Descriptor info tables
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("rsdumpinfo")
*
******************************************************************************/
struct acpi_rsdump_info acpi_rs_dump_irq[7] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length),
"Descriptor Length", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering",
@@ -77,7 +77,7 @@ struct acpi_rsdump_info acpi_rs_dump_irq[7] = {
};
struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL},
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_dma), "DMA", NULL},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed",
acpi_gbl_typ_decode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering",
@@ -91,7 +91,7 @@ struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
};
struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_start_dpf),
"Start-Dependent-Functions", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length),
"Descriptor Length", NULL},
@@ -102,12 +102,12 @@ struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = {
};
struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_end_dpf),
"End-Dependent-Functions", NULL}
};
struct acpi_rsdump_info acpi_rs_dump_io[6] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL},
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_io), "I/O", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding",
acpi_gbl_io_decode},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL},
@@ -118,7 +118,7 @@ struct acpi_rsdump_info acpi_rs_dump_io[6] = {
};
struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_fixed_io),
"Fixed I/O", NULL},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length),
@@ -126,7 +126,7 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = {
};
struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_vendor),
"Vendor Specific", NULL},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL},
{ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data",
@@ -134,12 +134,12 @@ struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
};
struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag",
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_end_tag), "EndTag",
NULL}
};
struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_memory24),
"24-Bit Memory Range", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect),
"Write Protect", acpi_gbl_rw_decode},
@@ -154,7 +154,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
};
struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_memory32),
"32-Bit Memory Range", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect),
"Write Protect", acpi_gbl_rw_decode},
@@ -169,7 +169,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
};
struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_fixed_memory32),
"32-Bit Fixed Memory Range", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect),
"Write Protect", acpi_gbl_rw_decode},
@@ -180,7 +180,7 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
};
struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_address16),
"16-Bit WORD Address Space", NULL},
{ACPI_RSD_ADDRESS, 0, NULL, NULL},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address.granularity),
@@ -197,7 +197,7 @@ struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
};
struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_address32),
"32-Bit DWORD Address Space", NULL},
{ACPI_RSD_ADDRESS, 0, NULL, NULL},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address.granularity),
@@ -214,7 +214,7 @@ struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
};
struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_address64),
"64-Bit QWORD Address Space", NULL},
{ACPI_RSD_ADDRESS, 0, NULL, NULL},
{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address.granularity),
@@ -231,7 +231,7 @@ struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
};
struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_ext_address64),
"64-Bit Extended Address Space", NULL},
{ACPI_RSD_ADDRESS, 0, NULL, NULL},
{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address.granularity),
@@ -250,7 +250,7 @@ struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
};
struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_ext_irq),
"Extended IRQ", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer),
"Type", acpi_gbl_consume_decode},
@@ -269,7 +269,7 @@ struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
};
struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_generic_reg),
"Generic Register", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID",
NULL},
@@ -283,7 +283,7 @@ struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
};
struct acpi_rsdump_info acpi_rs_dump_gpio[16] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio), "GPIO", NULL},
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_gpio), "GPIO", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.revision_id), "RevisionId", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.connection_type),
"ConnectionType", acpi_gbl_ct_decode},
@@ -315,7 +315,7 @@ struct acpi_rsdump_info acpi_rs_dump_gpio[16] = {
};
struct acpi_rsdump_info acpi_rs_dump_pin_function[10] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_pin_function),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_pin_function),
"PinFunction", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(pin_function.revision_id),
"RevisionId", NULL},
@@ -338,7 +338,7 @@ struct acpi_rsdump_info acpi_rs_dump_pin_function[10] = {
};
struct acpi_rsdump_info acpi_rs_dump_pin_config[11] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_pin_config),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_pin_config),
"PinConfig", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(pin_config.revision_id), "RevisionId",
NULL},
@@ -363,7 +363,7 @@ struct acpi_rsdump_info acpi_rs_dump_pin_config[11] = {
};
struct acpi_rsdump_info acpi_rs_dump_pin_group[8] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_pin_group),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_pin_group),
"PinGroup", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(pin_group.revision_id), "RevisionId",
NULL},
@@ -382,7 +382,7 @@ struct acpi_rsdump_info acpi_rs_dump_pin_group[8] = {
};
struct acpi_rsdump_info acpi_rs_dump_pin_group_function[9] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_pin_group_function),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_pin_group_function),
"PinGroupFunction", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(pin_group_function.revision_id),
"RevisionId", NULL},
@@ -405,7 +405,7 @@ struct acpi_rsdump_info acpi_rs_dump_pin_group_function[9] = {
};
struct acpi_rsdump_info acpi_rs_dump_pin_group_config[10] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_pin_group_config),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_pin_group_config),
"PinGroupConfig", NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(pin_group_config.revision_id),
"RevisionId", NULL},
@@ -429,7 +429,7 @@ struct acpi_rsdump_info acpi_rs_dump_pin_group_config[10] = {
};
struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_fixed_dma),
"FixedDma", NULL},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.request_lines),
"RequestLines", NULL},
@@ -452,13 +452,13 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = {
{ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL},
struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[11] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_common_serial_bus),
"Common Serial Bus", NULL},
ACPI_RS_DUMP_COMMON_SERIAL_BUS
};
struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[14] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_i2c_serial_bus),
"I2C Serial Bus", NULL},
ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
ACPI_RSD_OFFSET(i2c_serial_bus.
@@ -471,7 +471,7 @@ struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[14] = {
};
struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[18] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_spi_serial_bus),
"Spi Serial Bus", NULL},
ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
ACPI_RSD_OFFSET(spi_serial_bus.
@@ -492,7 +492,7 @@ struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[18] = {
};
struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[20] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus),
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_uart_serial_bus),
"Uart Serial Bus", NULL},
ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG,
ACPI_RSD_OFFSET(uart_serial_bus.
@@ -520,7 +520,7 @@ struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[20] = {
* Tables used for common address descriptor flag fields
*/
struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL,
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_general_flags), NULL,
NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer),
"Consumer/Producer", acpi_gbl_consume_decode},
@@ -533,7 +533,7 @@ struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
};
struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
- {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
+ {ACPI_RSD_LITERAL, ARRAY_SIZE(acpi_rs_dump_memory_flags),
"Resource Type", (void *)"Memory Range"},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
"Write Protect", acpi_gbl_rw_decode},
@@ -546,7 +546,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
};
struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
- {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
+ {ACPI_RSD_LITERAL, ARRAY_SIZE(acpi_rs_dump_io_flags),
"Resource Type", (void *)"I/O Range"},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
"Range Type", acpi_gbl_rng_decode},
@@ -560,7 +560,7 @@ struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
* Table used to dump _PRT contents
*/
struct acpi_rsdump_info acpi_rs_dump_prt[5] = {
- {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL},
+ {ACPI_RSD_TITLE, ARRAY_SIZE(acpi_rs_dump_prt), NULL, NULL},
{ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL},
{ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL},
{ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL},
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 5f051d82188d..d8322e62bb22 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -44,6 +44,7 @@
#include <acpi/acpi.h>
#include "accommon.h"
#include "actables.h"
+#include <linux/kernel.h>
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME("tbfadt")
@@ -137,9 +138,6 @@ static struct acpi_fadt_info fadt_info_table[] = {
ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER}
};
-#define ACPI_FADT_INFO_ENTRIES \
- (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info))
-
/* Table used to split Event Blocks into separate status/enable registers */
typedef struct acpi_fadt_pm_info {
@@ -167,9 +165,6 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
1}
};
-#define ACPI_FADT_PM_INFO_ENTRIES \
- (sizeof (fadt_pm_info_table) / sizeof (struct acpi_fadt_pm_info))
-
/*******************************************************************************
*
* FUNCTION: acpi_tb_init_generic_address
@@ -520,7 +515,7 @@ static void acpi_tb_convert_fadt(void)
/* Examine all of the 64-bit extended address fields (X fields) */
- for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) {
+ for (i = 0; i < ARRAY_SIZE(fadt_info_table); i++) {
/*
* Get the 32-bit and 64-bit addresses, as well as the register
* length and register name.
@@ -686,7 +681,7 @@ static void acpi_tb_setup_fadt_registers(void)
* update them if they are incorrect.
*/
if (acpi_gbl_use_default_register_widths) {
- for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) {
+ for (i = 0; i < ARRAY_SIZE(fadt_info_table); i++) {
target64 =
ACPI_ADD_PTR(struct acpi_generic_address,
&acpi_gbl_FADT,
@@ -737,7 +732,7 @@ static void acpi_tb_setup_fadt_registers(void)
* used.
*/
- for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++) {
+ for (i = 0; i < ARRAY_SIZE(fadt_pm_info_table); i++) {
source64 =
ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT,
fadt_pm_info_table[i].source);
--
2.14.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 00/18] use ARRAY_SIZE macro
2017-10-01 19:30 [PATCH 00/18] use ARRAY_SIZE macro Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 15/18] acpi: use ARRAY_SIZE Jérémy Lefaure
@ 2017-10-01 22:01 ` Tobin C. Harding
2017-10-02 0:52 ` Jérémy Lefaure
2017-10-02 17:05 ` Zhi Wang
2 siblings, 1 reply; 16+ messages in thread
From: Tobin C. Harding @ 2017-10-01 22:01 UTC (permalink / raw)
To: Jérémy Lefaure
Cc: alsa-devel, nouveau, dri-devel, dm-devel, brcm80211-dev-list,
devel, linux-scsi, linux-rdma, amd-gfx, Jason Gunthorpe,
linux-acpi, linux-video, intel-wired-lan, linux-media, intel-gfx,
ecryptfs, linux-nfs, linux-raid, openipmi-developer,
intel-gvt-dev, devel, brcm80211-dev-list.pdl, netdev, linux-usb,
linux-wireless, linux-kernel
On Sun, Oct 01, 2017 at 03:30:38PM -0400, Jérémy Lefaure wrote:
> 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.
Why don't you just send individual patches for each subsystem? I'm not a maintainer but I don't see
how any one person is going to be able to apply this whole series, it is making it hard for
maintainers if they have to pick patches out from among the series (if indeed any will bother
doing that).
I get that this will be more work for you but AFAIK we are optimizing for maintainers.
Good luck,
Tobin.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/18] use ARRAY_SIZE macro
2017-10-01 22:01 ` [PATCH 00/18] use ARRAY_SIZE macro Tobin C. Harding
@ 2017-10-02 0:52 ` Jérémy Lefaure
2017-10-02 5:35 ` Greg KH
2017-10-02 16:37 ` Mauro Carvalho Chehab
0 siblings, 2 replies; 16+ messages in thread
From: Jérémy Lefaure @ 2017-10-02 0:52 UTC (permalink / raw)
To: Tobin C. Harding
Cc: alsa-devel, nouveau, dri-devel, dm-devel, brcm80211-dev-list,
devel, linux-scsi, linux-rdma, amd-gfx, Jason Gunthorpe,
linux-acpi, linux-video, intel-wired-lan, linux-media, intel-gfx,
ecryptfs, linux-nfs, linux-raid, openipmi-developer,
intel-gvt-dev, devel, brcm80211-dev-list.pdl, netdev, linux-usb,
linux-wireless, linux-kernel, linux-integrity
On Mon, 2 Oct 2017 09:01:31 +1100
"Tobin C. Harding" <me@tobin.cc> wrote:
> > 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.
>
> Why don't you just send individual patches for each subsystem? I'm not a maintainer but I don't see
> how any one person is going to be able to apply this whole series, it is making it hard for
> maintainers if they have to pick patches out from among the series (if indeed any will bother
> doing that).
Yeah, maybe it would have been better to send individual patches.
From my point of view it's a series because the patches are related (I
did a git format-patch from my local branch). But for the maintainers
point of view, they are individual patches.
As each patch in this series is standalone, the maintainers can pick
the patches they want and apply them individually. So yeah, maybe I
should have sent individual patches. But I also wanted to tie all
patches together as it's the same change.
Anyway, I can tell to each maintainer that they can apply the patches
they're concerned about and next time I may send individual patches.
Thank you for your answer,
Jérémy
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/18] use ARRAY_SIZE macro
2017-10-02 0:52 ` Jérémy Lefaure
@ 2017-10-02 5:35 ` Greg KH
2017-10-02 19:22 ` J. Bruce Fields
2017-10-02 16:37 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 16+ messages in thread
From: Greg KH @ 2017-10-02 5:35 UTC (permalink / raw)
To: Jérémy Lefaure
Cc: alsa-devel, nouveau, dri-devel, dm-devel, brcm80211-dev-list,
devel, linux-scsi, linux-rdma, amd-gfx, Jason Gunthorpe,
linux-acpi, linux-video, intel-wired-lan, linux-media, intel-gfx,
ecryptfs, brcm80211-dev-list.pdl, linux-raid, openipmi-developer,
intel-gvt-dev, devel, linux-nfs, netdev, linux-usb,
linux-wireless, linux-kernel, linux-integrity, Tobin C. Harding
On Sun, Oct 01, 2017 at 08:52:20PM -0400, Jérémy Lefaure wrote:
> On Mon, 2 Oct 2017 09:01:31 +1100
> "Tobin C. Harding" <me@tobin.cc> wrote:
>
> > > 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.
> >
> > Why don't you just send individual patches for each subsystem? I'm not a maintainer but I don't see
> > how any one person is going to be able to apply this whole series, it is making it hard for
> > maintainers if they have to pick patches out from among the series (if indeed any will bother
> > doing that).
> Yeah, maybe it would have been better to send individual patches.
>
> From my point of view it's a series because the patches are related (I
> did a git format-patch from my local branch). But for the maintainers
> point of view, they are individual patches.
And the maintainers view is what matters here, if you wish to get your
patches reviewed and accepted...
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 15/18] acpi: use ARRAY_SIZE
2017-10-01 19:30 ` [PATCH 15/18] acpi: use ARRAY_SIZE Jérémy Lefaure
@ 2017-10-02 12:27 ` Rafael J. Wysocki
2017-10-03 1:16 ` Jérémy Lefaure
0 siblings, 1 reply; 16+ messages in thread
From: Rafael J. Wysocki @ 2017-10-02 12:27 UTC (permalink / raw)
To: Jérémy Lefaure
Cc: Robert Moore, Lv Zheng, Rafael J. Wysocki, Len Brown, linux-acpi,
devel, linux-kernel
On Sunday, October 1, 2017 9:30:53 PM CEST Jérémy Lefaure wrote:
> Using the ARRAY_SIZE macro improves the readability of the code. It is
> useless to re-invent the ARRAY_SIZE macro so let's use it.
>
> It is useless to re-invent the ARRAY_SIZE macro so let's use it.
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.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/18] use ARRAY_SIZE macro
2017-10-02 0:52 ` Jérémy Lefaure
2017-10-02 5:35 ` Greg KH
@ 2017-10-02 16:37 ` Mauro Carvalho Chehab
1 sibling, 0 replies; 16+ messages in thread
From: Mauro Carvalho Chehab @ 2017-10-02 16:37 UTC (permalink / raw)
To: Jérémy Lefaure
Cc: Tobin C. Harding, alsa-devel, nouveau, dri-devel, dm-devel,
brcm80211-dev-list, devel, linux-scsi, linux-rdma, amd-gfx,
Jason Gunthorpe, linux-acpi, linux-video, intel-wired-lan,
linux-media, intel-gfx, ecryptfs, linux-nfs, linux-raid,
openipmi-developer, intel-gvt-dev, devel, brcm80211-dev-list.pdl,
netdev, linux-usb, linux-wireless
Em Sun, 1 Oct 2017 20:52:20 -0400
Jérémy Lefaure <jeremy.lefaure@lse.epita.fr> escreveu:
> Anyway, I can tell to each maintainer that they can apply the patches
> they're concerned about and next time I may send individual patches.
In the case of media, we'll handle it as if they were individual ones.
Thanks,
Mauro
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/18] use ARRAY_SIZE macro
2017-10-01 19:30 [PATCH 00/18] use ARRAY_SIZE macro Jérémy Lefaure
2017-10-01 19:30 ` [PATCH 15/18] acpi: use ARRAY_SIZE Jérémy Lefaure
2017-10-01 22:01 ` [PATCH 00/18] use ARRAY_SIZE macro Tobin C. Harding
@ 2017-10-02 17:05 ` Zhi Wang
2 siblings, 0 replies; 16+ messages in thread
From: Zhi Wang @ 2017-10-02 17:05 UTC (permalink / raw)
To: Jérémy Lefaure
Cc: alsa-devel, nouveau, dri-devel, dm-devel, brcm80211-dev-list,
devel, linux-scsi, linux-rdma, amd-gfx, Jason Gunthorpe,
linux-acpi, linux-video, intel-wired-lan, linux-media, intel-gfx,
ecryptfs, linux-nfs, linux-raid, openipmi-developer,
intel-gvt-dev, devel, brcm80211-dev-list.pdl, netdev, linux-usb,
linux-wireless, linux-kernel, linux-integrity
[-- Attachment #1.1: Type: text/plain, Size: 1908 bytes --]
Thanks for the patch! :)
2017-10-01 22:30 GMT+03:00 Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>:
> 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
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
[-- Attachment #1.2: Type: text/html, Size: 2555 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/18] use ARRAY_SIZE macro
2017-10-02 5:35 ` Greg KH
@ 2017-10-02 19:22 ` J. Bruce Fields
2017-10-03 1:33 ` Jérémy Lefaure
0 siblings, 1 reply; 16+ messages in thread
From: J. Bruce Fields @ 2017-10-02 19:22 UTC (permalink / raw)
To: Greg KH
Cc: Jérémy Lefaure, Tobin C. Harding, alsa-devel, nouveau,
dri-devel, dm-devel, brcm80211-dev-list, devel, linux-scsi,
linux-rdma, amd-gfx, Jason Gunthorpe, linux-acpi, linux-video,
intel-wired-lan, linux-media, intel-gfx, ecryptfs, linux-nfs,
linux-raid, openipmi-developer, intel-gvt-dev, devel,
brcm80211-dev-list.pdl
On Mon, Oct 02, 2017 at 07:35:54AM +0200, Greg KH wrote:
> On Sun, Oct 01, 2017 at 08:52:20PM -0400, Jérémy Lefaure wrote:
> > On Mon, 2 Oct 2017 09:01:31 +1100
> > "Tobin C. Harding" <me@tobin.cc> wrote:
> >
> > > > 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.
> > >
> > > Why don't you just send individual patches for each subsystem? I'm not a maintainer but I don't see
> > > how any one person is going to be able to apply this whole series, it is making it hard for
> > > maintainers if they have to pick patches out from among the series (if indeed any will bother
> > > doing that).
> > Yeah, maybe it would have been better to send individual patches.
> >
> > From my point of view it's a series because the patches are related (I
> > did a git format-patch from my local branch). But for the maintainers
> > point of view, they are individual patches.
>
> And the maintainers view is what matters here, if you wish to get your
> patches reviewed and accepted...
Mainly I'd just like to know which you're asking for. Do you want me to
apply this, or to ACK it so someone else can? If it's sent as a series
I tend to assume the latter.
But in this case I'm assuming it's the former, so I'll pick up the nfsd
one....
--b.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 15/18] acpi: use ARRAY_SIZE
2017-10-02 12:27 ` Rafael J. Wysocki
@ 2017-10-03 1:16 ` Jérémy Lefaure
2017-10-03 11:39 ` Rafael J. Wysocki
0 siblings, 1 reply; 16+ messages in thread
From: Jérémy Lefaure @ 2017-10-03 1:16 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Robert Moore, Lv Zheng, Rafael J. Wysocki, Len Brown, linux-acpi,
devel, linux-kernel
On Mon, 02 Oct 2017 14:27:52 +0200
"Rafael J. Wysocki" <rjw@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 ?
Thank you,
Jérémy
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/18] use ARRAY_SIZE macro
2017-10-02 19:22 ` J. Bruce Fields
@ 2017-10-03 1:33 ` Jérémy Lefaure
2017-10-05 17:57 ` J. Bruce Fields
0 siblings, 1 reply; 16+ messages in thread
From: Jérémy Lefaure @ 2017-10-03 1:33 UTC (permalink / raw)
To: J. Bruce Fields
Cc: alsa-devel, nouveau, dri-devel, dm-devel, brcm80211-dev-list,
devel, linux-scsi, linux-rdma, amd-gfx, Jason Gunthorpe,
linux-acpi, linux-video, intel-wired-lan, Greg KH, linux-media,
intel-gfx, ecryptfs, brcm80211-dev-list.pdl, linux-raid,
openipmi-developer, intel-gvt-dev, devel, linux-nfs, jlayton,
netdev, linux-usb, linux-wireless, linux-kernel, linux-integrity
On Mon, 2 Oct 2017 15:22:24 -0400
bfields@fieldses.org (J. Bruce Fields) wrote:
> Mainly I'd just like to know which you're asking for. Do you want me to
> apply this, or to ACK it so someone else can? If it's sent as a series
> I tend to assume the latter.
>
> But in this case I'm assuming it's the former, so I'll pick up the nfsd
> one....
Could you to apply the NFSD patch ("nfsd: use ARRAY_SIZE") with the
Reviewed-by: Jeff Layton <jlayton@redhat.com>) tag please ?
This patch is an individual patch and it should not have been sent in a
series (sorry about that).
Thank you,
Jérémy
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 15/18] acpi: use ARRAY_SIZE
2017-10-03 1:16 ` Jérémy Lefaure
@ 2017-10-03 11:39 ` Rafael J. Wysocki
2017-10-03 12:34 ` [Devel] " Colin Ian King
0 siblings, 1 reply; 16+ messages in thread
From: Rafael J. Wysocki @ 2017-10-03 11:39 UTC (permalink / raw)
To: Jérémy Lefaure
Cc: Robert Moore, Lv Zheng, Rafael J. Wysocki, Len Brown, linux-acpi,
devel, linux-kernel
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@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] 16+ 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
2017-10-03 16:04 ` Rafael J. Wysocki
0 siblings, 1 reply; 16+ messages in thread
From: Colin Ian King @ 2017-10-03 12:34 UTC (permalink / raw)
To: Rafael J. Wysocki, Jérémy Lefaure
Cc: Rafael J. Wysocki, linux-kernel, linux-acpi, devel
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@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@acpica.org
> https://lists.acpica.org/mailman/listinfo/devel
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH 15/18] acpi: use ARRAY_SIZE
2017-10-03 12:34 ` [Devel] " Colin Ian King
@ 2017-10-03 16:04 ` Rafael J. Wysocki
2017-10-03 16:38 ` Moore, Robert
0 siblings, 1 reply; 16+ messages in thread
From: Rafael J. Wysocki @ 2017-10-03 16:04 UTC (permalink / raw)
To: Colin Ian King
Cc: Rafael J. Wysocki, Jérémy Lefaure, Rafael J. Wysocki,
Linux Kernel Mailing List, ACPI Devel Maling List,
devel@acpica.org
On Tue, Oct 3, 2017 at 2:34 PM, Colin Ian King <colin.king@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@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] 16+ 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
0 siblings, 0 replies; 16+ messages in thread
From: Moore, Robert @ 2017-10-03 16:38 UTC (permalink / raw)
To: Rafael J. Wysocki, Colin Ian King
Cc: Wysocki, Rafael J, Rafael J. Wysocki, Linux Kernel Mailing List,
ACPI Devel Maling List, Jérémy Lefaure,
devel@acpica.org
> -----Original Message-----
> From: Devel [mailto:devel-bounces@acpica.org] On Behalf Of Rafael J.
> Wysocki
> Sent: Tuesday, October 3, 2017 9:05 AM
> To: Colin Ian King <colin.king@canonical.com>
> Cc: Wysocki, Rafael J <rafael.j.wysocki@intel.com>; Rafael J. Wysocki
> <rjw@rjwysocki.net>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>; ACPI Devel Maling List <linux-
> acpi@vger.kernel.org>; Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>;
> devel@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@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@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@acpica.org
> https://lists.acpica.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/18] use ARRAY_SIZE macro
2017-10-03 1:33 ` Jérémy Lefaure
@ 2017-10-05 17:57 ` J. Bruce Fields
0 siblings, 0 replies; 16+ messages in thread
From: J. Bruce Fields @ 2017-10-05 17:57 UTC (permalink / raw)
To: Jérémy Lefaure
Cc: Greg KH, Tobin C. Harding, alsa-devel, nouveau, dri-devel,
dm-devel, brcm80211-dev-list, devel, linux-scsi, linux-rdma,
amd-gfx, Jason Gunthorpe, linux-acpi, linux-video,
intel-wired-lan, linux-media, intel-gfx, ecryptfs, linux-nfs,
linux-raid, openipmi-developer, intel-gvt-dev, devel,
brcm80211-dev-list.pdl, netdev, linux-usb
On Mon, Oct 02, 2017 at 09:33:12PM -0400, Jérémy Lefaure wrote:
> On Mon, 2 Oct 2017 15:22:24 -0400
> bfields@fieldses.org (J. Bruce Fields) wrote:
>
> > Mainly I'd just like to know which you're asking for. Do you want me to
> > apply this, or to ACK it so someone else can? If it's sent as a series
> > I tend to assume the latter.
> >
> > But in this case I'm assuming it's the former, so I'll pick up the nfsd
> > one....
> Could you to apply the NFSD patch ("nfsd: use ARRAY_SIZE") with the
> Reviewed-by: Jeff Layton <jlayton@redhat.com>) tag please ?
>
> This patch is an individual patch and it should not have been sent in a
> series (sorry about that).
Applying for 4.15, thanks.--b.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2017-10-05 17:57 UTC | newest]
Thread overview: 16+ 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 ` [PATCH 15/18] acpi: use ARRAY_SIZE Jérémy Lefaure
2017-10-02 12:27 ` Rafael J. Wysocki
2017-10-03 1:16 ` Jérémy Lefaure
2017-10-03 11:39 ` Rafael J. Wysocki
2017-10-03 12:34 ` [Devel] " Colin Ian King
2017-10-03 16:04 ` Rafael J. Wysocki
2017-10-03 16:38 ` Moore, Robert
2017-10-01 22:01 ` [PATCH 00/18] use ARRAY_SIZE macro Tobin C. Harding
2017-10-02 0:52 ` Jérémy Lefaure
2017-10-02 5:35 ` Greg KH
2017-10-02 19:22 ` J. Bruce Fields
2017-10-03 1:33 ` Jérémy Lefaure
2017-10-05 17:57 ` J. Bruce Fields
2017-10-02 16:37 ` Mauro Carvalho Chehab
2017-10-02 17:05 ` Zhi Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).