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

This patch doesn't modify the compiled arrays, only their representation
in source form benefits.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/5a4fb64166ab7e06adf94e5fa3d46bb5f6493324.1784299069.git.u.kleine-koenig@baylibre.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Uwe Kleine-König (The Capable Hub)
2026-07-17 16:50:51 +02:00
committed by Greg Kroah-Hartman
parent 230cb31dc3
commit a4fa3300f0
11 changed files with 42 additions and 42 deletions

View File

@@ -73,32 +73,32 @@ static void ad_dpot_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id ad_dpot_id[] = {
{"ad5258", AD5258_ID},
{"ad5259", AD5259_ID},
{"ad5251", AD5251_ID},
{"ad5252", AD5252_ID},
{"ad5253", AD5253_ID},
{"ad5254", AD5254_ID},
{"ad5255", AD5255_ID},
{"ad5241", AD5241_ID},
{"ad5242", AD5242_ID},
{"ad5243", AD5243_ID},
{"ad5245", AD5245_ID},
{"ad5246", AD5246_ID},
{"ad5247", AD5247_ID},
{"ad5248", AD5248_ID},
{"ad5280", AD5280_ID},
{"ad5282", AD5282_ID},
{"adn2860", ADN2860_ID},
{"ad5273", AD5273_ID},
{"ad5161", AD5161_ID},
{"ad5171", AD5171_ID},
{"ad5170", AD5170_ID},
{"ad5172", AD5172_ID},
{"ad5173", AD5173_ID},
{"ad5272", AD5272_ID},
{"ad5274", AD5274_ID},
{}
{ .name = "ad5258", .driver_data = AD5258_ID },
{ .name = "ad5259", .driver_data = AD5259_ID },
{ .name = "ad5251", .driver_data = AD5251_ID },
{ .name = "ad5252", .driver_data = AD5252_ID },
{ .name = "ad5253", .driver_data = AD5253_ID },
{ .name = "ad5254", .driver_data = AD5254_ID },
{ .name = "ad5255", .driver_data = AD5255_ID },
{ .name = "ad5241", .driver_data = AD5241_ID },
{ .name = "ad5242", .driver_data = AD5242_ID },
{ .name = "ad5243", .driver_data = AD5243_ID },
{ .name = "ad5245", .driver_data = AD5245_ID },
{ .name = "ad5246", .driver_data = AD5246_ID },
{ .name = "ad5247", .driver_data = AD5247_ID },
{ .name = "ad5248", .driver_data = AD5248_ID },
{ .name = "ad5280", .driver_data = AD5280_ID },
{ .name = "ad5282", .driver_data = AD5282_ID },
{ .name = "adn2860", .driver_data = ADN2860_ID },
{ .name = "ad5273", .driver_data = AD5273_ID },
{ .name = "ad5161", .driver_data = AD5161_ID },
{ .name = "ad5171", .driver_data = AD5171_ID },
{ .name = "ad5170", .driver_data = AD5170_ID },
{ .name = "ad5172", .driver_data = AD5172_ID },
{ .name = "ad5173", .driver_data = AD5173_ID },
{ .name = "ad5272", .driver_data = AD5272_ID },
{ .name = "ad5274", .driver_data = AD5274_ID },
{ }
};
MODULE_DEVICE_TABLE(i2c, ad_dpot_id);

View File

@@ -141,8 +141,8 @@ static void sbrmi_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id sbrmi_id[] = {
{"sbrmi-i2c"},
{}
{ .name = "sbrmi-i2c" },
{ }
};
MODULE_DEVICE_TABLE(i2c, sbrmi_id);

View File

@@ -285,7 +285,7 @@ static UNIVERSAL_DEV_PM_OPS(apds9802als_pm_ops, apds9802als_suspend,
#endif /* CONFIG_PM */
static const struct i2c_device_id apds9802als_id[] = {
{ DRIVER_NAME },
{ .name = DRIVER_NAME },
{ }
};

View File

@@ -1363,9 +1363,9 @@ static int bh1770_runtime_resume(struct device *dev)
#endif
static const struct i2c_device_id bh1770_id[] = {
{ "bh1770glc" },
{ "sfh7770" },
{}
{ .name = "bh1770glc" },
{ .name = "sfh7770" },
{ }
};
MODULE_DEVICE_TABLE(i2c, bh1770_id);

View File

@@ -271,7 +271,7 @@ static void ds1682_remove(struct i2c_client *client)
}
static const struct i2c_device_id ds1682_id[] = {
{ "ds1682" },
{ .name = "ds1682" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ds1682_id);

View File

@@ -121,7 +121,7 @@ static void hmc6352_remove(struct i2c_client *client)
}
static const struct i2c_device_id hmc6352_id[] = {
{ "hmc6352" },
{ .name = "hmc6352" },
{ }
};

View File

@@ -95,7 +95,7 @@ static int ics932s401_detect(struct i2c_client *client,
static void ics932s401_remove(struct i2c_client *client);
static const struct i2c_device_id ics932s401_id[] = {
{ "ics932s401" },
{ .name = "ics932s401" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ics932s401_id);

View File

@@ -449,8 +449,8 @@ static SIMPLE_DEV_PM_OPS(isl29003_pm_ops, isl29003_suspend, isl29003_resume);
#endif /* CONFIG_PM_SLEEP */
static const struct i2c_device_id isl29003_id[] = {
{ "isl29003" },
{}
{ .name = "isl29003" },
{ }
};
MODULE_DEVICE_TABLE(i2c, isl29003_id);

View File

@@ -177,7 +177,7 @@ static void isl29020_remove(struct i2c_client *client)
}
static const struct i2c_device_id isl29020_id[] = {
{ "isl29020" },
{ .name = "isl29020" },
{ }
};

View File

@@ -247,9 +247,9 @@ static int lis3_i2c_runtime_resume(struct device *dev)
#endif /* CONFIG_PM */
static const struct i2c_device_id lis3lv02d_id[] = {
{"lis3lv02d", LIS3LV02D},
{"lis331dlh", LIS331DLH},
{}
{ .name = "lis3lv02d", .driver_data = LIS3LV02D },
{ .name = "lis331dlh", .driver_data = LIS331DLH },
{ }
};
MODULE_DEVICE_TABLE(i2c, lis3lv02d_id);

View File

@@ -420,7 +420,7 @@ static SIMPLE_DEV_PM_OPS(tsl2550_pm_ops, tsl2550_suspend, tsl2550_resume);
#endif /* CONFIG_PM_SLEEP */
static const struct i2c_device_id tsl2550_id[] = {
{ "tsl2550" },
{ .name = "tsl2550" },
{ }
};
MODULE_DEVICE_TABLE(i2c, tsl2550_id);