power: supply: Use named initializers for arrays of i2c_device_data

While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

The mentioned robustness is relevant for a planned change to struct
i2c_device_id that replaces .driver_data by an anonymous union.

While touching all these arrays, unify usage of whitespace and commas.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits. The former was confirmed with x86 and arm64
builds.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # max77976_charger.c
Link: https://patch.msgid.link/20260515101629.4132270-2-u.kleine-koenig@baylibre.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Uwe Kleine-König (The Capable Hub)
2026-05-15 12:16:28 +02:00
committed by Sebastian Reichel
parent 0549c4c013
commit 347fcfcc07
29 changed files with 131 additions and 131 deletions

View File

@@ -727,7 +727,7 @@ static int adp5061_probe(struct i2c_client *client)
}
static const struct i2c_device_id adp5061_id[] = {
{ "adp5061" },
{ .name = "adp5061" },
{ }
};
MODULE_DEVICE_TABLE(i2c, adp5061_id);

View File

@@ -1738,20 +1738,20 @@ static void bq2415x_remove(struct i2c_client *client)
}
static const struct i2c_device_id bq2415x_i2c_id_table[] = {
{ "bq2415x", BQUNKNOWN },
{ "bq24150", BQ24150 },
{ "bq24150a", BQ24150A },
{ "bq24151", BQ24151 },
{ "bq24151a", BQ24151A },
{ "bq24152", BQ24152 },
{ "bq24153", BQ24153 },
{ "bq24153a", BQ24153A },
{ "bq24155", BQ24155 },
{ "bq24156", BQ24156 },
{ "bq24156a", BQ24156A },
{ "bq24157s", BQ24157S },
{ "bq24158", BQ24158 },
{},
{ .name = "bq2415x", .driver_data = BQUNKNOWN },
{ .name = "bq24150", .driver_data = BQ24150 },
{ .name = "bq24150a", .driver_data = BQ24150A },
{ .name = "bq24151", .driver_data = BQ24151 },
{ .name = "bq24151a", .driver_data = BQ24151A },
{ .name = "bq24152", .driver_data = BQ24152 },
{ .name = "bq24153", .driver_data = BQ24153 },
{ .name = "bq24153a", .driver_data = BQ24153A },
{ .name = "bq24155", .driver_data = BQ24155 },
{ .name = "bq24156", .driver_data = BQ24156 },
{ .name = "bq24156a", .driver_data = BQ24156A },
{ .name = "bq24157s", .driver_data = BQ24157S },
{ .name = "bq24158", .driver_data = BQ24158 },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq2415x_i2c_id_table);

View File

@@ -2308,14 +2308,14 @@ static const struct dev_pm_ops bq24190_pm_ops = {
};
static const struct i2c_device_id bq24190_i2c_ids[] = {
{ "bq24190", (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24190] },
{ "bq24192", (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24192] },
{ "bq24192i", (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24192i] },
{ "bq24193", (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24193] },
{ "bq24196", (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24196] },
{ "bq24296", (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24296] },
{ "bq24297", (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24297] },
{ },
{ .name = "bq24190", .driver_data = (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24190] },
{ .name = "bq24192", .driver_data = (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24192] },
{ .name = "bq24192i", .driver_data = (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24192i] },
{ .name = "bq24193", .driver_data = (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24193] },
{ .name = "bq24196", .driver_data = (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24196] },
{ .name = "bq24296", .driver_data = (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24296] },
{ .name = "bq24297", .driver_data = (kernel_ulong_t)&bq24190_chip_info_tbl[BQ24297] },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq24190_i2c_ids);

View File

@@ -1133,10 +1133,10 @@ static const struct bq2425x_chip_info bq24257_info = {
};
static const struct i2c_device_id bq24257_i2c_ids[] = {
{ "bq24250", (kernel_ulong_t)&bq24250_info },
{ "bq24251", (kernel_ulong_t)&bq24251_info },
{ "bq24257", (kernel_ulong_t)&bq24257_info },
{}
{ .name = "bq24250", .driver_data = (kernel_ulong_t)&bq24250_info },
{ .name = "bq24251", .driver_data = (kernel_ulong_t)&bq24251_info },
{ .name = "bq24257", .driver_data = (kernel_ulong_t)&bq24257_info },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq24257_i2c_ids);

View File

@@ -489,8 +489,8 @@ static int bq24735_charger_probe(struct i2c_client *client)
}
static const struct i2c_device_id bq24735_charger_id[] = {
{ "bq24735-charger" },
{}
{ .name = "bq24735-charger" },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq24735_charger_id);

View File

@@ -1137,9 +1137,9 @@ static const struct bq2515x_info bq25155 = {
};
static const struct i2c_device_id bq2515x_i2c_ids[] = {
{ "bq25150", (kernel_ulong_t)&bq25150 },
{ "bq25155", (kernel_ulong_t)&bq25155 },
{}
{ .name = "bq25150", .driver_data = (kernel_ulong_t)&bq25150 },
{ .name = "bq25155", .driver_data = (kernel_ulong_t)&bq25155 },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq2515x_i2c_ids);

View File

@@ -1768,14 +1768,14 @@ static int bq256xx_probe(struct i2c_client *client)
}
static const struct i2c_device_id bq256xx_i2c_ids[] = {
{ "bq25600", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25600] },
{ "bq25600d", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25600D] },
{ "bq25601", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25601] },
{ "bq25601d", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25601D] },
{ "bq25611d", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25611D] },
{ "bq25618", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25618] },
{ "bq25619", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25619] },
{}
{ .name = "bq25600", .driver_data = (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25600] },
{ .name = "bq25600d", .driver_data = (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25600D] },
{ .name = "bq25601", .driver_data = (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25601] },
{ .name = "bq25601d", .driver_data = (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25601D] },
{ .name = "bq25611d", .driver_data = (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25611D] },
{ .name = "bq25618", .driver_data = (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25618] },
{ .name = "bq25619", .driver_data = (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25619] },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq256xx_i2c_ids);

View File

@@ -1617,11 +1617,11 @@ static const struct dev_pm_ops bq25890_pm = {
};
static const struct i2c_device_id bq25890_i2c_ids[] = {
{ "bq25890" },
{ "bq25892" },
{ "bq25895" },
{ "bq25896" },
{}
{ .name = "bq25890" },
{ .name = "bq25892" },
{ .name = "bq25895" },
{ .name = "bq25896" },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq25890_i2c_ids);

View File

@@ -1266,10 +1266,10 @@ static int bq25980_probe(struct i2c_client *client)
}
static const struct i2c_device_id bq25980_i2c_ids[] = {
{ "bq25980", BQ25980 },
{ "bq25975", BQ25975 },
{ "bq25960", BQ25960 },
{},
{ .name = "bq25980", .driver_data = BQ25980 },
{ .name = "bq25975", .driver_data = BQ25975 },
{ .name = "bq25960", .driver_data = BQ25960 },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq25980_i2c_ids);

View File

@@ -225,38 +225,38 @@ static void bq27xxx_battery_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
{ "bq27200", BQ27000 },
{ "bq27210", BQ27010 },
{ "bq27500", BQ2750X },
{ "bq27510", BQ2751X },
{ "bq27520", BQ2752X },
{ "bq27500-1", BQ27500 },
{ "bq27510g1", BQ27510G1 },
{ "bq27510g2", BQ27510G2 },
{ "bq27510g3", BQ27510G3 },
{ "bq27520g1", BQ27520G1 },
{ "bq27520g2", BQ27520G2 },
{ "bq27520g3", BQ27520G3 },
{ "bq27520g4", BQ27520G4 },
{ "bq27521", BQ27521 },
{ "bq27530", BQ27530 },
{ "bq27531", BQ27531 },
{ "bq27541", BQ27541 },
{ "bq27542", BQ27542 },
{ "bq27546", BQ27546 },
{ "bq27742", BQ27742 },
{ "bq27545", BQ27545 },
{ "bq27411", BQ27411 },
{ "bq27421", BQ27421 },
{ "bq27425", BQ27425 },
{ "bq27426", BQ27426 },
{ "bq27441", BQ27441 },
{ "bq27621", BQ27621 },
{ "bq27z561", BQ27Z561 },
{ "bq28z610", BQ28Z610 },
{ "bq34z100", BQ34Z100 },
{ "bq78z100", BQ78Z100 },
{},
{ .name = "bq27200", .driver_data = BQ27000 },
{ .name = "bq27210", .driver_data = BQ27010 },
{ .name = "bq27500", .driver_data = BQ2750X },
{ .name = "bq27510", .driver_data = BQ2751X },
{ .name = "bq27520", .driver_data = BQ2752X },
{ .name = "bq27500-1", .driver_data = BQ27500 },
{ .name = "bq27510g1", .driver_data = BQ27510G1 },
{ .name = "bq27510g2", .driver_data = BQ27510G2 },
{ .name = "bq27510g3", .driver_data = BQ27510G3 },
{ .name = "bq27520g1", .driver_data = BQ27520G1 },
{ .name = "bq27520g2", .driver_data = BQ27520G2 },
{ .name = "bq27520g3", .driver_data = BQ27520G3 },
{ .name = "bq27520g4", .driver_data = BQ27520G4 },
{ .name = "bq27521", .driver_data = BQ27521 },
{ .name = "bq27530", .driver_data = BQ27530 },
{ .name = "bq27531", .driver_data = BQ27531 },
{ .name = "bq27541", .driver_data = BQ27541 },
{ .name = "bq27542", .driver_data = BQ27542 },
{ .name = "bq27546", .driver_data = BQ27546 },
{ .name = "bq27742", .driver_data = BQ27742 },
{ .name = "bq27545", .driver_data = BQ27545 },
{ .name = "bq27411", .driver_data = BQ27411 },
{ .name = "bq27421", .driver_data = BQ27421 },
{ .name = "bq27425", .driver_data = BQ27425 },
{ .name = "bq27426", .driver_data = BQ27426 },
{ .name = "bq27441", .driver_data = BQ27441 },
{ .name = "bq27621", .driver_data = BQ27621 },
{ .name = "bq27z561", .driver_data = BQ27Z561 },
{ .name = "bq28z610", .driver_data = BQ28Z610 },
{ .name = "bq34z100", .driver_data = BQ34Z100 },
{ .name = "bq78z100", .driver_data = BQ78Z100 },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq27xxx_i2c_id_table);

View File

@@ -733,7 +733,7 @@ static int __maybe_unused cw_bat_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cw_bat_pm_ops, cw_bat_suspend, cw_bat_resume);
static const struct i2c_device_id cw_bat_id_table[] = {
{ "cw2015" },
{ .name = "cw2015" },
{ }
};

View File

@@ -423,9 +423,9 @@ static int ds278x_battery_probe(struct i2c_client *client)
}
static const struct i2c_device_id ds278x_id[] = {
{"ds2782", DS2782},
{"ds2786", DS2786},
{},
{ .name = "ds2782", .driver_data = DS2782 },
{ .name = "ds2786", .driver_data = DS2786 },
{ }
};
MODULE_DEVICE_TABLE(i2c, ds278x_id);

View File

@@ -584,7 +584,7 @@ static const struct of_device_id lp8727_dt_ids[] __maybe_unused = {
MODULE_DEVICE_TABLE(of, lp8727_dt_ids);
static const struct i2c_device_id lp8727_ids[] = {
{ "lp8727" },
{ .name = "lp8727" },
{ }
};
MODULE_DEVICE_TABLE(i2c, lp8727_ids);

View File

@@ -600,11 +600,11 @@ static SIMPLE_DEV_PM_OPS(ltc294x_pm_ops, ltc294x_suspend, ltc294x_resume);
static const struct i2c_device_id ltc294x_i2c_id[] = {
{ "ltc2941", LTC2941_ID, },
{ "ltc2942", LTC2942_ID, },
{ "ltc2943", LTC2943_ID, },
{ "ltc2944", LTC2944_ID, },
{ },
{ .name = "ltc2941", .driver_data = LTC2941_ID },
{ .name = "ltc2942", .driver_data = LTC2942_ID },
{ .name = "ltc2943", .driver_data = LTC2943_ID },
{ .name = "ltc2944", .driver_data = LTC2944_ID },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc294x_i2c_id);

View File

@@ -1229,10 +1229,10 @@ static void ltc4162l_alert(struct i2c_client *client,
}
static const struct i2c_device_id ltc4162l_i2c_id_table[] = {
{ "ltc4015", (kernel_ulong_t)&ltc4015_chip_info },
{ "ltc4162-f", (kernel_ulong_t)&ltc4162f_chip_info },
{ "ltc4162-l", (kernel_ulong_t)&ltc4162l_chip_info },
{ "ltc4162-s", (kernel_ulong_t)&ltc4162s_chip_info },
{ .name = "ltc4015", .driver_data = (kernel_ulong_t)&ltc4015_chip_info },
{ .name = "ltc4162-f", .driver_data = (kernel_ulong_t)&ltc4162f_chip_info },
{ .name = "ltc4162-l", .driver_data = (kernel_ulong_t)&ltc4162l_chip_info },
{ .name = "ltc4162-s", .driver_data = (kernel_ulong_t)&ltc4162s_chip_info },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc4162l_i2c_id_table);

View File

@@ -300,8 +300,8 @@ static int max14656_probe(struct i2c_client *client)
}
static const struct i2c_device_id max14656_id[] = {
{ "max14656" },
{}
{ .name = "max14656" },
{ }
};
MODULE_DEVICE_TABLE(i2c, max14656_id);

View File

@@ -598,15 +598,15 @@ static SIMPLE_DEV_PM_OPS(max17040_pm_ops, max17040_suspend, max17040_resume);
#endif /* CONFIG_PM_SLEEP */
static const struct i2c_device_id max17040_id[] = {
{ "max17040", ID_MAX17040 },
{ "max17041", ID_MAX17041 },
{ "max17043", ID_MAX17043 },
{ "max77836-battery", ID_MAX17043 },
{ "max17044", ID_MAX17044 },
{ "max17048", ID_MAX17048 },
{ "max17049", ID_MAX17049 },
{ "max17058", ID_MAX17058 },
{ "max17059", ID_MAX17059 },
{ .name = "max17040", .driver_data = ID_MAX17040 },
{ .name = "max17041", .driver_data = ID_MAX17041 },
{ .name = "max17043", .driver_data = ID_MAX17043 },
{ .name = "max77836-battery", .driver_data = ID_MAX17043 },
{ .name = "max17044", .driver_data = ID_MAX17044 },
{ .name = "max17048", .driver_data = ID_MAX17048 },
{ .name = "max17049", .driver_data = ID_MAX17049 },
{ .name = "max17058", .driver_data = ID_MAX17058 },
{ .name = "max17059", .driver_data = ID_MAX17059 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(i2c, max17040_id);

View File

@@ -1371,12 +1371,12 @@ MODULE_DEVICE_TABLE(of, max17042_dt_match);
#endif
static const struct i2c_device_id max17042_id[] = {
{ "max17042", MAXIM_DEVICE_TYPE_MAX17042 },
{ "max17047", MAXIM_DEVICE_TYPE_MAX17047 },
{ "max17050", MAXIM_DEVICE_TYPE_MAX17050 },
{ "max17055", MAXIM_DEVICE_TYPE_MAX17055 },
{ "max77759-fg", MAXIM_DEVICE_TYPE_MAX77759 },
{ "max77849-battery", MAXIM_DEVICE_TYPE_MAX17047 },
{ .name = "max17042", .driver_data = MAXIM_DEVICE_TYPE_MAX17042 },
{ .name = "max17047", .driver_data = MAXIM_DEVICE_TYPE_MAX17047 },
{ .name = "max17050", .driver_data = MAXIM_DEVICE_TYPE_MAX17050 },
{ .name = "max17055", .driver_data = MAXIM_DEVICE_TYPE_MAX17055 },
{ .name = "max77759-fg", .driver_data = MAXIM_DEVICE_TYPE_MAX77759 },
{ .name = "max77849-battery", .driver_data = MAXIM_DEVICE_TYPE_MAX17047 },
{ }
};
MODULE_DEVICE_TABLE(i2c, max17042_id);

View File

@@ -484,7 +484,7 @@ static int max77976_probe(struct i2c_client *client)
}
static const struct i2c_device_id max77976_i2c_id[] = {
{ MAX77976_DRIVER_NAME },
{ .name = MAX77976_DRIVER_NAME },
{ }
};
MODULE_DEVICE_TABLE(i2c, max77976_i2c_id);

View File

@@ -731,7 +731,7 @@ static const struct of_device_id max8971_match_ids[] = {
MODULE_DEVICE_TABLE(of, max8971_match_ids);
static const struct i2c_device_id max8971_i2c_id[] = {
{ "max8971" },
{ .name = "max8971" },
{ }
};
MODULE_DEVICE_TABLE(i2c, max8971_i2c_id);

View File

@@ -284,8 +284,8 @@ static int mm8013_probe(struct i2c_client *client)
}
static const struct i2c_device_id mm8013_id_table[] = {
{ "mm8013" },
{}
{ .name = "mm8013" },
{ }
};
MODULE_DEVICE_TABLE(i2c, mm8013_id_table);

View File

@@ -174,7 +174,7 @@ static int rt5033_battery_probe(struct i2c_client *client)
}
static const struct i2c_device_id rt5033_battery_id[] = {
{ "rt5033-battery", },
{ .name = "rt5033-battery" },
{ }
};
MODULE_DEVICE_TABLE(i2c, rt5033_battery_id);

View File

@@ -1719,7 +1719,7 @@ static void rt9455_remove(struct i2c_client *client)
}
static const struct i2c_device_id rt9455_i2c_id_table[] = {
{ RT9455_DRIVER_NAME },
{ .name = RT9455_DRIVER_NAME },
{ }
};
MODULE_DEVICE_TABLE(i2c, rt9455_i2c_id_table);

View File

@@ -1254,10 +1254,10 @@ static SIMPLE_DEV_PM_OPS(sbs_pm_ops, sbs_suspend, NULL);
#endif
static const struct i2c_device_id sbs_id[] = {
{ "bq20z65", SBS_FLAGS_TI_BQ20ZX5 },
{ "bq20z75", SBS_FLAGS_TI_BQ20ZX5 },
{ "sbs-battery", 0 },
{}
{ .name = "bq20z65", .driver_data = SBS_FLAGS_TI_BQ20ZX5 },
{ .name = "bq20z75", .driver_data = SBS_FLAGS_TI_BQ20ZX5 },
{ .name = "sbs-battery", .driver_data = 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, sbs_id);

View File

@@ -244,7 +244,7 @@ MODULE_DEVICE_TABLE(of, sbs_dt_ids);
#endif
static const struct i2c_device_id sbs_id[] = {
{ "sbs-charger" },
{ .name = "sbs-charger" },
{ }
};
MODULE_DEVICE_TABLE(i2c, sbs_id);

View File

@@ -389,8 +389,8 @@ static int sbsm_probe(struct i2c_client *client)
}
static const struct i2c_device_id sbsm_ids[] = {
{ "sbs-manager" },
{ "ltc1760" },
{ .name = "sbs-manager" },
{ .name = "ltc1760" },
{ }
};
MODULE_DEVICE_TABLE(i2c, sbsm_ids);

View File

@@ -1609,10 +1609,10 @@ static void smb347_shutdown(struct i2c_client *client)
}
static const struct i2c_device_id smb347_id[] = {
{ "smb345", SMB345 },
{ "smb347", SMB347 },
{ "smb358", SMB358 },
{ },
{ .name = "smb345", .driver_data = SMB345 },
{ .name = "smb347", .driver_data = SMB347 },
{ .name = "smb358", .driver_data = SMB358 },
{ }
};
MODULE_DEVICE_TABLE(i2c, smb347_id);

View File

@@ -584,7 +584,7 @@ static int stc3117_probe(struct i2c_client *client)
}
static const struct i2c_device_id stc3117_id[] = {
{ "stc3117", 0 },
{ .name = "stc3117", .driver_data = 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, stc3117_id);

View File

@@ -195,7 +195,7 @@ static SIMPLE_DEV_PM_OPS(ug3105_pm_ops, ug3105_suspend,
ug3105_resume);
static const struct i2c_device_id ug3105_id[] = {
{ "ug3105" },
{ .name = "ug3105" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ug3105_id);