regulator: 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.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/2e83a9747ac2c92db8f91fd0e0eb311c4efe8e73.1782827697.git.u.kleine-koenig@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Uwe Kleine-König (The Capable Hub) 2026-06-30 16:01:08 +02:00 committed by Mark Brown
parent 3ac69e3cb2
commit 8e74b2db58
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
40 changed files with 100 additions and 100 deletions

View File

@ -92,8 +92,8 @@ static const struct of_device_id __maybe_unused pg86x_dt_ids[] = {
MODULE_DEVICE_TABLE(of, pg86x_dt_ids);
static const struct i2c_device_id pg86x_i2c_id[] = {
{ "88pg867", },
{ "88pg868", },
{ .name = "88pg867" },
{ .name = "88pg868" },
{ }
};
MODULE_DEVICE_TABLE(i2c, pg86x_i2c_id);

View File

@ -207,8 +207,8 @@ struct ad5398_current_data_format {
static const struct ad5398_current_data_format df_10_4_120 = {10, 4, 0, 120000};
static const struct i2c_device_id ad5398_id[] = {
{ "ad5398", (kernel_ulong_t)&df_10_4_120 },
{ "ad5821", (kernel_ulong_t)&df_10_4_120 },
{ .name = "ad5398", .driver_data = (kernel_ulong_t)&df_10_4_120 },
{ .name = "ad5821", .driver_data = (kernel_ulong_t)&df_10_4_120 },
{ }
};
MODULE_DEVICE_TABLE(i2c, ad5398_id);

View File

@ -1195,16 +1195,16 @@ static void da9121_i2c_remove(struct i2c_client *i2c)
}
static const struct i2c_device_id da9121_i2c_id[] = {
{"da9121", DA9121_SUBTYPE_DA9121},
{"da9130", DA9121_SUBTYPE_DA9130},
{"da9217", DA9121_SUBTYPE_DA9217},
{"da9122", DA9121_SUBTYPE_DA9122},
{"da9131", DA9121_SUBTYPE_DA9131},
{"da9220", DA9121_SUBTYPE_DA9220},
{"da9132", DA9121_SUBTYPE_DA9132},
{"da9141", DA9121_SUBTYPE_DA9141},
{"da9142", DA9121_SUBTYPE_DA9142},
{},
{ .name = "da9121", .driver_data = DA9121_SUBTYPE_DA9121 },
{ .name = "da9130", .driver_data = DA9121_SUBTYPE_DA9130 },
{ .name = "da9217", .driver_data = DA9121_SUBTYPE_DA9217 },
{ .name = "da9122", .driver_data = DA9121_SUBTYPE_DA9122 },
{ .name = "da9131", .driver_data = DA9121_SUBTYPE_DA9131 },
{ .name = "da9220", .driver_data = DA9121_SUBTYPE_DA9220 },
{ .name = "da9132", .driver_data = DA9121_SUBTYPE_DA9132 },
{ .name = "da9141", .driver_data = DA9121_SUBTYPE_DA9141 },
{ .name = "da9142", .driver_data = DA9121_SUBTYPE_DA9142 },
{ }
};
MODULE_DEVICE_TABLE(i2c, da9121_i2c_id);

View File

@ -202,8 +202,8 @@ static int da9210_i2c_probe(struct i2c_client *i2c)
}
static const struct i2c_device_id da9210_i2c_id[] = {
{ "da9210" },
{}
{ .name = "da9210" },
{ }
};
MODULE_DEVICE_TABLE(i2c, da9210_i2c_id);

View File

@ -522,15 +522,15 @@ static int da9211_i2c_probe(struct i2c_client *i2c)
}
static const struct i2c_device_id da9211_i2c_id[] = {
{"da9211", DA9211},
{"da9212", DA9212},
{"da9213", DA9213},
{"da9223", DA9223},
{"da9214", DA9214},
{"da9224", DA9224},
{"da9215", DA9215},
{"da9225", DA9225},
{},
{ .name = "da9211", .driver_data = DA9211 },
{ .name = "da9212", .driver_data = DA9212 },
{ .name = "da9213", .driver_data = DA9213 },
{ .name = "da9223", .driver_data = DA9223 },
{ .name = "da9214", .driver_data = DA9214 },
{ .name = "da9224", .driver_data = DA9224 },
{ .name = "da9215", .driver_data = DA9215 },
{ .name = "da9225", .driver_data = DA9225 },
{ }
};
MODULE_DEVICE_TABLE(i2c, da9211_i2c_id);

View File

@ -164,8 +164,8 @@ static const struct of_device_id fan53880_dt_ids[] = {
MODULE_DEVICE_TABLE(of, fan53880_dt_ids);
static const struct i2c_device_id fan53880_i2c_id[] = {
{ "fan53880", },
{}
{ .name = "fan53880" },
{ }
};
MODULE_DEVICE_TABLE(i2c, fan53880_i2c_id);

View File

@ -186,8 +186,8 @@ MODULE_DEVICE_TABLE(of, isl9305_dt_ids);
#endif
static const struct i2c_device_id isl9305_i2c_id[] = {
{ "isl9305", },
{ "isl9305h", },
{ .name = "isl9305" },
{ .name = "isl9305h" },
{ }
};
MODULE_DEVICE_TABLE(i2c, isl9305_i2c_id);

View File

@ -439,7 +439,7 @@ static int lp3971_i2c_probe(struct i2c_client *i2c)
}
static const struct i2c_device_id lp3971_i2c_id[] = {
{ "lp3971" },
{ .name = "lp3971" },
{ }
};
MODULE_DEVICE_TABLE(i2c, lp3971_i2c_id);

View File

@ -537,7 +537,7 @@ static int lp3972_i2c_probe(struct i2c_client *i2c)
}
static const struct i2c_device_id lp3972_i2c_id[] = {
{ "lp3972" },
{ .name = "lp3972" },
{ }
};
MODULE_DEVICE_TABLE(i2c, lp3972_i2c_id);

View File

@ -935,8 +935,8 @@ static const struct of_device_id lp872x_dt_ids[] __maybe_unused = {
MODULE_DEVICE_TABLE(of, lp872x_dt_ids);
static const struct i2c_device_id lp872x_ids[] = {
{"lp8720", LP8720},
{"lp8725", LP8725},
{ .name = "lp8720", .driver_data = LP8720 },
{ .name = "lp8725", .driver_data = LP8725 },
{ }
};
MODULE_DEVICE_TABLE(i2c, lp872x_ids);

View File

@ -430,8 +430,8 @@ static void lp8755_remove(struct i2c_client *client)
}
static const struct i2c_device_id lp8755_id[] = {
{ LP8755_NAME },
{}
{ .name = LP8755_NAME },
{ }
};
MODULE_DEVICE_TABLE(i2c, lp8755_id);

View File

@ -445,9 +445,9 @@ static const struct ltc3589_info ltc3589_12_info = {
};
static const struct i2c_device_id ltc3589_i2c_id[] = {
{ "ltc3589", (kernel_ulong_t)&ltc3589_info },
{ "ltc3589-1", (kernel_ulong_t)&ltc3589_12_info },
{ "ltc3589-2", (kernel_ulong_t)&ltc3589_12_info },
{ .name = "ltc3589", .driver_data = (kernel_ulong_t)&ltc3589_info },
{ .name = "ltc3589-1", .driver_data = (kernel_ulong_t)&ltc3589_12_info },
{ .name = "ltc3589-2", .driver_data = (kernel_ulong_t)&ltc3589_12_info },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc3589_i2c_id);

View File

@ -357,7 +357,7 @@ static int ltc3676_regulator_probe(struct i2c_client *client)
}
static const struct i2c_device_id ltc3676_i2c_id[] = {
{ "ltc3676" },
{ .name = "ltc3676" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc3676_i2c_id);

View File

@ -276,7 +276,7 @@ static int max1586_pmic_probe(struct i2c_client *client)
}
static const struct i2c_device_id max1586_id[] = {
{ "max1586" },
{ .name = "max1586" },
{ }
};
MODULE_DEVICE_TABLE(i2c, max1586_id);

View File

@ -301,10 +301,10 @@ static const struct max20086_chip_info max20089_chip_info = {
};
static const struct i2c_device_id max20086_i2c_id[] = {
{ "max20086", (kernel_ulong_t)&max20086_chip_info },
{ "max20087", (kernel_ulong_t)&max20087_chip_info },
{ "max20088", (kernel_ulong_t)&max20088_chip_info },
{ "max20089", (kernel_ulong_t)&max20089_chip_info },
{ .name = "max20086", .driver_data = (kernel_ulong_t)&max20086_chip_info },
{ .name = "max20087", .driver_data = (kernel_ulong_t)&max20087_chip_info },
{ .name = "max20088", .driver_data = (kernel_ulong_t)&max20088_chip_info },
{ .name = "max20089", .driver_data = (kernel_ulong_t)&max20089_chip_info },
{ /* Sentinel */ }
};
MODULE_DEVICE_TABLE(i2c, max20086_i2c_id);

View File

@ -145,7 +145,7 @@ static const struct of_device_id of_max20411_match_tbl[] = {
MODULE_DEVICE_TABLE(of, of_max20411_match_tbl);
static const struct i2c_device_id max20411_id[] = {
{ "max20411" },
{ .name = "max20411" },
{ }
};
MODULE_DEVICE_TABLE(i2c, max20411_id);

View File

@ -107,7 +107,7 @@ static const struct of_device_id of_max77503_match_tbl[] = {
MODULE_DEVICE_TABLE(of, of_max77503_match_tbl);
static const struct i2c_device_id max77503_regulator_id[] = {
{"max77503"},
{ .name = "max77503" },
{ }
};

View File

@ -278,7 +278,7 @@ static const struct of_device_id __maybe_unused max77826_of_match[] = {
MODULE_DEVICE_TABLE(of, max77826_of_match);
static const struct i2c_device_id max77826_id[] = {
{ "max77826-regulator" },
{ .name = "max77826-regulator" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(i2c, max77826_id);

View File

@ -200,7 +200,7 @@ static const struct of_device_id __maybe_unused max77838_of_match[] = {
MODULE_DEVICE_TABLE(of, max77838_of_match);
static const struct i2c_device_id max77838_id[] = {
{ "max77838-regulator" },
{ .name = "max77838-regulator" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(i2c, max77838_id);

View File

@ -428,10 +428,10 @@ static int max77857_probe(struct i2c_client *client)
}
static const struct i2c_device_id max77857_id[] = {
{ "max77831", ID_MAX77831 },
{ "max77857", ID_MAX77857 },
{ "max77859", ID_MAX77859 },
{ "max77859a", ID_MAX77859A },
{ .name = "max77831", .driver_data = ID_MAX77831 },
{ .name = "max77857", .driver_data = ID_MAX77857 },
{ .name = "max77859", .driver_data = ID_MAX77859 },
{ .name = "max77859a", .driver_data = ID_MAX77859A },
{ }
};
MODULE_DEVICE_TABLE(i2c, max77857_id);

View File

@ -240,7 +240,7 @@ static int max8649_regulator_probe(struct i2c_client *client)
}
static const struct i2c_device_id max8649_id[] = {
{ "max8649" },
{ .name = "max8649" },
{ }
};
MODULE_DEVICE_TABLE(i2c, max8649_id);

View File

@ -162,7 +162,7 @@ MODULE_DEVICE_TABLE(of, max8893_dt_match);
#endif
static const struct i2c_device_id max8893_ids[] = {
{ "max8893" },
{ .name = "max8893" },
{ }
};
MODULE_DEVICE_TABLE(i2c, max8893_ids);

View File

@ -307,7 +307,7 @@ static int max8952_pmic_probe(struct i2c_client *client)
}
static const struct i2c_device_id max8952_ids[] = {
{ "max8952" },
{ .name = "max8952" },
{ }
};
MODULE_DEVICE_TABLE(i2c, max8952_ids);

View File

@ -578,7 +578,7 @@ static const struct dev_pm_ops mcp16502_pm_ops = {
};
#endif
static const struct i2c_device_id mcp16502_i2c_id[] = {
{ "mcp16502" },
{ .name = "mcp16502" },
{ }
};
MODULE_DEVICE_TABLE(i2c, mcp16502_i2c_id);

View File

@ -228,9 +228,9 @@ static const struct of_device_id mp5416_of_match[] = {
MODULE_DEVICE_TABLE(of, mp5416_of_match);
static const struct i2c_device_id mp5416_id[] = {
{ "mp5416", (kernel_ulong_t)&mp5416_regulators_desc },
{ "mp5496", (kernel_ulong_t)&mp5496_regulators_desc },
{}
{ .name = "mp5416", .driver_data = (kernel_ulong_t)&mp5416_regulators_desc },
{ .name = "mp5496", .driver_data = (kernel_ulong_t)&mp5496_regulators_desc },
{ }
};
MODULE_DEVICE_TABLE(i2c, mp5416_id);

View File

@ -386,8 +386,8 @@ static const struct of_device_id mp8859_dt_id[] __maybe_unused = {
MODULE_DEVICE_TABLE(of, mp8859_dt_id);
static const struct i2c_device_id mp8859_i2c_id[] = {
{ "mp8859", },
{ },
{ .name = "mp8859" },
{ }
};
MODULE_DEVICE_TABLE(i2c, mp8859_i2c_id);

View File

@ -348,9 +348,9 @@ static const struct of_device_id mp886x_dt_ids[] = {
MODULE_DEVICE_TABLE(of, mp886x_dt_ids);
static const struct i2c_device_id mp886x_id[] = {
{ "mp8867", (kernel_ulong_t)&mp8867_ci },
{ "mp8869", (kernel_ulong_t)&mp8869_ci },
{ },
{ .name = "mp8867", .driver_data = (kernel_ulong_t)&mp8867_ci },
{ .name = "mp8869", .driver_data = (kernel_ulong_t)&mp8869_ci },
{ }
};
MODULE_DEVICE_TABLE(i2c, mp886x_id);

View File

@ -309,8 +309,8 @@ static const struct of_device_id mpq7920_of_match[] = {
MODULE_DEVICE_TABLE(of, mpq7920_of_match);
static const struct i2c_device_id mpq7920_id[] = {
{ "mpq7920", },
{ },
{ .name = "mpq7920" },
{ }
};
MODULE_DEVICE_TABLE(i2c, mpq7920_id);

View File

@ -133,8 +133,8 @@ static int mt6311_i2c_probe(struct i2c_client *i2c)
}
static const struct i2c_device_id mt6311_i2c_id[] = {
{ "mt6311" },
{}
{ .name = "mt6311" },
{ }
};
MODULE_DEVICE_TABLE(i2c, mt6311_i2c_id);

View File

@ -596,10 +596,10 @@ static const struct of_device_id pf8x00_dt_ids[] = {
MODULE_DEVICE_TABLE(of, pf8x00_dt_ids);
static const struct i2c_device_id pf8x00_i2c_id[] = {
{ "pf8100" },
{ "pf8121a" },
{ "pf8200" },
{}
{ .name = "pf8100" },
{ .name = "pf8121a" },
{ .name = "pf8200" },
{ }
};
MODULE_DEVICE_TABLE(i2c, pf8x00_i2c_id);

View File

@ -360,8 +360,8 @@ static int pv88060_i2c_probe(struct i2c_client *i2c)
}
static const struct i2c_device_id pv88060_i2c_id[] = {
{ "pv88060" },
{}
{ .name = "pv88060" },
{ }
};
MODULE_DEVICE_TABLE(i2c, pv88060_i2c_id);

View File

@ -523,10 +523,10 @@ static const struct of_device_id pv88080_dt_ids[] = {
MODULE_DEVICE_TABLE(of, pv88080_dt_ids);
static const struct i2c_device_id pv88080_i2c_id[] = {
{ "pv88080", (kernel_ulong_t)&pv88080_aa_regs },
{ "pv88080-aa", (kernel_ulong_t)&pv88080_aa_regs },
{ "pv88080-ba", (kernel_ulong_t)&pv88080_ba_regs },
{}
{ .name = "pv88080", .driver_data = (kernel_ulong_t)&pv88080_aa_regs },
{ .name = "pv88080-aa", .driver_data = (kernel_ulong_t)&pv88080_aa_regs },
{ .name = "pv88080-ba", .driver_data = (kernel_ulong_t)&pv88080_ba_regs },
{ }
};
MODULE_DEVICE_TABLE(i2c, pv88080_i2c_id);

View File

@ -381,8 +381,8 @@ static int pv88090_i2c_probe(struct i2c_client *i2c)
}
static const struct i2c_device_id pv88090_i2c_id[] = {
{ "pv88090" },
{}
{ .name = "pv88090" },
{ }
};
MODULE_DEVICE_TABLE(i2c, pv88090_i2c_id);

View File

@ -285,7 +285,7 @@ static int sgm3804_probe(struct i2c_client *i2c)
}
static const struct i2c_device_id sgm3804_id[] = {
{ "sgm3804" },
{ .name = "sgm3804" },
{ }
};
MODULE_DEVICE_TABLE(i2c, sgm3804_id);

View File

@ -497,8 +497,8 @@ static int slg51000_i2c_probe(struct i2c_client *client)
}
static const struct i2c_device_id slg51000_i2c_id[] = {
{ "slg51000" },
{}
{ .name = "slg51000" },
{ }
};
MODULE_DEVICE_TABLE(i2c, slg51000_i2c_id);

View File

@ -130,7 +130,7 @@ static const struct of_device_id sy8106a_i2c_of_match[] = {
MODULE_DEVICE_TABLE(of, sy8106a_i2c_of_match);
static const struct i2c_device_id sy8106a_i2c_id[] = {
{ "sy8106a" },
{ .name = "sy8106a" },
{ }
};
MODULE_DEVICE_TABLE(i2c, sy8106a_i2c_id);

View File

@ -213,10 +213,10 @@ static const struct of_device_id sy8824_dt_ids[] = {
MODULE_DEVICE_TABLE(of, sy8824_dt_ids);
static const struct i2c_device_id sy8824_id[] = {
{ "sy8824c", (kernel_ulong_t)&sy8824c_cfg },
{ "sy8824e", (kernel_ulong_t)&sy8824e_cfg },
{ "sy20276", (kernel_ulong_t)&sy20276_cfg },
{ "sy20278", (kernel_ulong_t)&sy20278_cfg },
{ .name = "sy8824c", .driver_data = (kernel_ulong_t)&sy8824c_cfg },
{ .name = "sy8824e", .driver_data = (kernel_ulong_t)&sy8824e_cfg },
{ .name = "sy20276", .driver_data = (kernel_ulong_t)&sy20276_cfg },
{ .name = "sy20278", .driver_data = (kernel_ulong_t)&sy20278_cfg },
{ }
};
MODULE_DEVICE_TABLE(i2c, sy8824_id);

View File

@ -180,8 +180,8 @@ static const struct of_device_id sy8827n_dt_ids[] = {
MODULE_DEVICE_TABLE(of, sy8827n_dt_ids);
static const struct i2c_device_id sy8827n_id[] = {
{ "sy8827n", },
{ },
{ .name = "sy8827n" },
{ }
};
MODULE_DEVICE_TABLE(i2c, sy8827n_id);

View File

@ -145,11 +145,11 @@ static int tps6286x_i2c_probe(struct i2c_client *i2c)
}
static const struct i2c_device_id tps6286x_i2c_id[] = {
{ "tps62864" },
{ "tps62866" },
{ "tps62868" },
{ "tps62869" },
{}
{ .name = "tps62864" },
{ .name = "tps62866" },
{ .name = "tps62868" },
{ .name = "tps62869" },
{ }
};
MODULE_DEVICE_TABLE(i2c, tps6286x_i2c_id);

View File

@ -229,11 +229,11 @@ static const struct of_device_id tps6287x_dt_ids[] = {
MODULE_DEVICE_TABLE(of, tps6287x_dt_ids);
static const struct i2c_device_id tps6287x_i2c_id[] = {
{ "tps62870" },
{ "tps62871" },
{ "tps62872" },
{ "tps62873" },
{}
{ .name = "tps62870" },
{ .name = "tps62871" },
{ .name = "tps62872" },
{ .name = "tps62873" },
{ }
};
MODULE_DEVICE_TABLE(i2c, tps6287x_i2c_id);