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 in the list
terminator.
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: Daniel Thompson (RISCstar) <danielt@kernel.org>
Link: https://patch.msgid.link/20260518111203.639603-2-u.kleine-koenig@baylibre.com
Signed-off-by: Lee Jones <lee@kernel.org>
adp8860_i2c_resume);
static const struct i2c_device_id adp8860_id[] = {
- { "adp8860", adp8860 },
- { "adp8861", adp8861 },
- { "adp8863", adp8863 },
+ { .name = "adp8860", .driver_data = adp8860 },
+ { .name = "adp8861", .driver_data = adp8861 },
+ { .name = "adp8863", .driver_data = adp8863 },
{ }
};
MODULE_DEVICE_TABLE(i2c, adp8860_id);
adp8870_i2c_resume);
static const struct i2c_device_id adp8870_id[] = {
- { "adp8870" },
+ { .name = "adp8870" },
{ }
};
MODULE_DEVICE_TABLE(i2c, adp8870_id);
MODULE_DEVICE_TABLE(of, arcxcnn_dt_ids);
static const struct i2c_device_id arcxcnn_ids[] = {
- {"arc2c0608", ARC2C0608},
+ { .name = "arc2c0608", .driver_data = ARC2C0608 },
{ }
};
MODULE_DEVICE_TABLE(i2c, arcxcnn_ids);
static DEFINE_SIMPLE_DEV_PM_OPS(aw99706_pm_ops, aw99706_suspend, aw99706_resume);
static const struct i2c_device_id aw99706_ids[] = {
- { "aw99706" },
+ { .name = "aw99706" },
{ }
};
MODULE_DEVICE_TABLE(i2c, aw99706_ids);
}
static const struct i2c_device_id bd6107_ids[] = {
- { "bd6107" },
+ { .name = "bd6107" },
{ }
};
MODULE_DEVICE_TABLE(i2c, bd6107_ids);
}
static const struct i2c_device_id ktz8866_ids[] = {
- { "ktz8866" },
- {}
+ { .name = "ktz8866" },
+ { }
};
MODULE_DEVICE_TABLE(i2c, ktz8866_ids);
}
static const struct i2c_device_id lm3509_id[] = {
- { LM3509_NAME },
- {}
+ { .name = LM3509_NAME },
+ { }
};
MODULE_DEVICE_TABLE(i2c, lm3509_id);
}
static const struct i2c_device_id lm3630a_id[] = {
- { LM3630A_NAME },
- {}
+ { .name = LM3630A_NAME },
+ { }
};
MODULE_DEVICE_TABLE(i2c, lm3630a_id);
}
static const struct i2c_device_id lm3639_id[] = {
- { LM3639_NAME },
- {}
+ { .name = LM3639_NAME },
+ { }
};
MODULE_DEVICE_TABLE(i2c, lm3639_id);
MODULE_DEVICE_TABLE(of, lp855x_dt_ids);
static const struct i2c_device_id lp855x_ids[] = {
- {"lp8550", LP8550},
- {"lp8551", LP8551},
- {"lp8552", LP8552},
- {"lp8553", LP8553},
- {"lp8555", LP8555},
- {"lp8556", LP8556},
- {"lp8557", LP8557},
+ { .name = "lp8550", .driver_data = LP8550 },
+ { .name = "lp8551", .driver_data = LP8551 },
+ { .name = "lp8552", .driver_data = LP8552 },
+ { .name = "lp8553", .driver_data = LP8553 },
+ { .name = "lp8555", .driver_data = LP8555 },
+ { .name = "lp8556", .driver_data = LP8556 },
+ { .name = "lp8557", .driver_data = LP8557 },
{ }
};
MODULE_DEVICE_TABLE(i2c, lp855x_ids);
}
static const struct i2c_device_id lv5207lp_ids[] = {
- { "lv5207lp" },
+ { .name = "lv5207lp" },
{ }
};
MODULE_DEVICE_TABLE(i2c, lv5207lp_ids);
MODULE_DEVICE_TABLE(of, mp3309c_match_table);
static const struct i2c_device_id mp3309c_id[] = {
- { "mp3309c" },
+ { .name = "mp3309c" },
{ }
};
MODULE_DEVICE_TABLE(i2c, mp3309c_id);