mfd: Use named initializers for acpi_device_id
Subsystems (11)
PATCH 1/1 mfd: Use named initializers for acpi_device_id
Use a designated initializer for the acpi_device_id fields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Also drop explicitly setting fields to 0 where it is redundant.
Unify the list terminator to have a single space between the brackets and no trailing comma.
---
This series is converting lists that contain the acpi_device_id struct, which is defined in the include/linux/device-id/acpi.h to make use of named initializers (which they do not use currently). This work is part of the on going effort in the kernel associated with device-ids [1]
The plan is to convert acpi_device_id::driver_data to have an anonymous union, similarly to what was introduced for PCI and I2C device ID tables. The goal is to increase type-safety (most of the existing casts are gone), to improve readability and to make use intent a bit more clear:
```
union {
kernel_ulong_t driver_data;
const void *driver_data_ptr;
}
```But for that to work all lists containing the structs need to use named initializers first to avoid triggering -Wmissing-braces. I already have patches that implement this and touching a lot of kernel subsystmes that use the acpi_device_id struct and that list keeps on growing. Therefore, I have decided to split the series per every subsystem into:
- pre-clean-ups that convert the lists to use named initializers (which is this series)
- actual implementations that make some of the modules use the new driver_data_ptr member
That way the task can be fragmented into manageable and independent chunks of work and makes this effort easier to review.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/mfd/axp20x-i2c.c | 2 +- drivers/mfd/cs42l43-i2c.c | 8 ++--- drivers/mfd/intel-lpss-acpi.c | 58 +++++++++++++++++------------------ drivers/mfd/intel_pmc_bxt.c | 2 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 2 +- drivers/mfd/intel_soc_pmic_chtdc_ti.c | 4 +-- drivers/mfd/intel_soc_pmic_chtwc.c | 2 +- drivers/mfd/intel_soc_pmic_crc.c | 4 +-- drivers/mfd/intel_soc_pmic_mrfld.c | 4 +-- drivers/mfd/kempld-core.c | 6 ++-- drivers/mfd/loongson-se.c | 2 +- drivers/mfd/upboard-fpga.c | 6 ++-- 12 files changed, 50 insertions(+), 50 deletions(-)
drivers/mfd/axp20x-i2c.c +1 -1
@@ -97,7 +97,7 @@ static const struct acpi_device_id axp20x_i2c_acpi_match[] = { .id = "INT33F4", .driver_data = AXP288_ID, }, - { }, + { } };MODULE_DEVICE_TABLE (acpi, axp20x_i2c_acpi_match);#endif
drivers/mfd/cs42l43-i2c.c +4 -4
@@ -73,10 +73,10 @@ MODULE_DEVICE_TABLE(of, cs42l43_of_match);#if IS_ENABLED (CONFIG_ACPI )static const struct acpi_device_id cs42l43_acpi_match[] = { - {"CSC4243" ,CS42L43_DEVID_VAL }, - {"CSC2A3B" ,CS42L43B_DEVID_VAL }, - {"CSC4244" ,CS42L43B_DEVID_VAL }, - {} + { .id ="CSC4243" , .driver_data =CS42L43_DEVID_VAL }, + { .id ="CSC2A3B" , .driver_data =CS42L43B_DEVID_VAL }, + { .id ="CSC4244" , .driver_data =CS42L43B_DEVID_VAL }, + { } };MODULE_DEVICE_TABLE (acpi, cs42l43_acpi_match);#endif
drivers/mfd/intel-lpss-acpi.c +29 -29
67 lines not on this page · raw message
drivers/mfd/intel_pmc_bxt.c +1 -1
@@ -414,7 +414,7 @@ static int intel_pmc_create_devices(struct intel_pmc_dev *pmc) }static const struct acpi_device_id intel_pmc_acpi_ids[] = { - {"INT34D2" }, + { .id ="INT34D2" }, { } };MODULE_DEVICE_TABLE (acpi, intel_pmc_acpi_ids);
drivers/mfd/intel_soc_pmic_bxtwc.c +1 -1
@@ -606,7 +606,7 @@ static int bxtwc_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(bxtwc_pm_ops, bxtwc_suspend, bxtwc_resume);static const struct acpi_device_id bxtwc_acpi_ids[] = { - {"INT34D3" , }, + { .id ="INT34D3" }, { } };MODULE_DEVICE_TABLE (acpi, bxtwc_acpi_ids);
drivers/mfd/intel_soc_pmic_chtdc_ti.c +2 -2
@@ -162,8 +162,8 @@ static int chtdc_ti_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(chtdc_ti_pm_ops, chtdc_ti_suspend, chtdc_ti_resume);static const struct acpi_device_id chtdc_ti_acpi_ids[] = { - {"INT33F5" }, - { }, + { .id ="INT33F5" }, + { } };MODULE_DEVICE_TABLE (acpi, chtdc_ti_acpi_ids);
drivers/mfd/intel_soc_pmic_chtwc.c +1 -1
@@ -261,7 +261,7 @@ static const struct i2c_device_id cht_wc_i2c_id[] = { };static const struct acpi_device_id cht_wc_acpi_ids[] = { - {"INT34D3" , }, + { .id ="INT34D3" }, { } };
drivers/mfd/intel_soc_pmic_crc.c +2 -2
@@ -252,8 +252,8 @@ static int crystal_cove_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(crystal_cove_pm_ops, crystal_cove_suspend, crystal_cove_resume);static const struct acpi_device_id crystal_cove_acpi_match[] = { - {"INT33FD" }, - { }, + { .id ="INT33FD" }, + { } };MODULE_DEVICE_TABLE (acpi, crystal_cove_acpi_match);
drivers/mfd/intel_soc_pmic_mrfld.c +2 -2
@@ -139,8 +139,8 @@ static int bcove_probe(struct platform_device *pdev) }static const struct acpi_device_id bcove_acpi_ids[] = { - {"INTC100E" }, - {} + { .id ="INTC100E" }, + { } };MODULE_DEVICE_TABLE (acpi, bcove_acpi_ids);
drivers/mfd/kempld-core.c +3 -3
@@ -470,9 +470,9 @@ static void kempld_remove(struct platform_device *pdev) }static const struct acpi_device_id kempld_acpi_table[] = { - {"KEM0000" , (kernel_ulong_t)&kempld_platform_data_generic }, - {"KEM0001" , (kernel_ulong_t)&kempld_platform_data_generic }, - {} + { .id ="KEM0000" , .driver_data = (kernel_ulong_t)&kempld_platform_data_generic }, + { .id ="KEM0001" , .driver_data = (kernel_ulong_t)&kempld_platform_data_generic }, + { } };MODULE_DEVICE_TABLE (acpi, kempld_acpi_table);
drivers/mfd/loongson-se.c +1 -1
@@ -233,7 +233,7 @@ static int loongson_se_probe(struct platform_device *pdev) }static const struct acpi_device_id loongson_se_acpi_match[] = { - {"LOON0011" ,0 }, + { .id ="LOON0011" }, { } };MODULE_DEVICE_TABLE (acpi, loongson_se_acpi_match);
drivers/mfd/upboard-fpga.c +3 -3
@@ -300,9 +300,9 @@ static int upboard_fpga_probe(struct platform_device *pdev) }static const struct acpi_device_id upboard_fpga_acpi_match[] = { - {"AANT0F01" , (kernel_ulong_t)&upboard_up2_fpga_data }, - {"AANT0F04" , (kernel_ulong_t)&upboard_up_fpga_data }, - {} + { .id ="AANT0F01" , .driver_data = (kernel_ulong_t)&upboard_up2_fpga_data }, + { .id ="AANT0F04" , .driver_data = (kernel_ulong_t)&upboard_up_fpga_data }, + { } };MODULE_DEVICE_TABLE (acpi, upboard_fpga_acpi_match);
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261030-acpi-mfd-a6ac9d16671b
Best regards,
Signature · 1 line
Pawel Zalewski <[email protected]>
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 9 lines
Use a designated initializer for the
acpi_device_idfields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Also drop explicitly setting fields to 0 where it is redundant.Unify the list terminator to have a single space between the brackets and no trailing comma.
Signed-off-by Pawel Zalewski <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 11 lines · Pawel Zalewski
Use a designated initializer for the
acpi_device_idfields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Also drop explicitly setting fields to 0 where it is redundant.Unify the list terminator to have a single space between the brackets and no trailing comma.
Signed-off-by Pawel Zalewski <[email protected]>--- drivers/mfd/cs42l43-i2c.c | 8 ++---
Thanks,
Charles
Andy Shevchenko
reviewerQuoted 7 lines · Pawel Zalewski
Use a designated initializer for the
acpi_device_idfields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Also drop explicitly setting fields to 0 where it is redundant.Unify the list terminator to have a single space between the brackets and no trailing comma.
Can you split Intel LPSS to a separate patch? It will help reviewing both parts.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 1 line
Can you split Intel LPSS to a separate patch? It will help reviewing both parts.
Sure I can - will do in v2.