summaryrefslogtreecommitdiff
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>2026-05-19 10:13:09 +0200
committerJonathan Cameron <jic23@kernel.org>2026-05-31 11:01:46 +0100
commitf68afce8e8a74f52a879f56f607dfedf552b5ab5 (patch)
tree87b2f99b3e0b31a3e23fd48b2a3e6c5a6fe851af /drivers/iio/adc
parentc4657858d43ada628e2f4eaf591c43efb3649933 (diff)
downloadlinux-next-f68afce8e8a74f52a879f56f607dfedf552b5ab5.tar.gz
linux-next-f68afce8e8a74f52a879f56f607dfedf552b5ab5.zip
iio: Initialize i2c_device_id arrays using member names
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. 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: Siratul Islam <email@sirat.me> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/ad7291.c2
-rw-r--r--drivers/iio/adc/ad799x.c16
-rw-r--r--drivers/iio/adc/gehc-pmc-adc.c2
-rw-r--r--drivers/iio/adc/ina2xx-adc.c12
-rw-r--r--drivers/iio/adc/ltc2309.c4
-rw-r--r--drivers/iio/adc/ltc2471.c4
-rw-r--r--drivers/iio/adc/ltc2485.c2
-rw-r--r--drivers/iio/adc/ltc2497.c4
-rw-r--r--drivers/iio/adc/max34408.c4
-rw-r--r--drivers/iio/adc/mcp3422.c16
-rw-r--r--drivers/iio/adc/nau7802.c2
-rw-r--r--drivers/iio/adc/rohm-bd79124.c2
-rw-r--r--drivers/iio/adc/ti-adc081c.c6
-rw-r--r--drivers/iio/adc/ti-ads1015.c6
-rw-r--r--drivers/iio/adc/ti-ads1100.c4
-rw-r--r--drivers/iio/adc/ti-ads1119.c2
-rw-r--r--drivers/iio/adc/ti-ads7138.c4
-rw-r--r--drivers/iio/adc/ti-ads7924.c2
18 files changed, 47 insertions, 47 deletions
diff --git a/drivers/iio/adc/ad7291.c b/drivers/iio/adc/ad7291.c
index 60e12faa3207..6a1493e27a30 100644
--- a/drivers/iio/adc/ad7291.c
+++ b/drivers/iio/adc/ad7291.c
@@ -536,7 +536,7 @@ static int ad7291_probe(struct i2c_client *client)
}
static const struct i2c_device_id ad7291_id[] = {
- { "ad7291" },
+ { .name = "ad7291" },
{ }
};
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index 0ceedea5df0b..bb076d8f5dd5 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -940,14 +940,14 @@ static int ad799x_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(ad799x_pm_ops, ad799x_suspend, ad799x_resume);
static const struct i2c_device_id ad799x_id[] = {
- { "ad7991", ad7991 },
- { "ad7995", ad7995 },
- { "ad7999", ad7999 },
- { "ad7992", ad7992 },
- { "ad7993", ad7993 },
- { "ad7994", ad7994 },
- { "ad7997", ad7997 },
- { "ad7998", ad7998 },
+ { .name = "ad7991", .driver_data = ad7991 },
+ { .name = "ad7995", .driver_data = ad7995 },
+ { .name = "ad7999", .driver_data = ad7999 },
+ { .name = "ad7992", .driver_data = ad7992 },
+ { .name = "ad7993", .driver_data = ad7993 },
+ { .name = "ad7994", .driver_data = ad7994 },
+ { .name = "ad7997", .driver_data = ad7997 },
+ { .name = "ad7998", .driver_data = ad7998 },
{ }
};
diff --git a/drivers/iio/adc/gehc-pmc-adc.c b/drivers/iio/adc/gehc-pmc-adc.c
index d1167818b17d..24193e941494 100644
--- a/drivers/iio/adc/gehc-pmc-adc.c
+++ b/drivers/iio/adc/gehc-pmc-adc.c
@@ -207,7 +207,7 @@ static const struct of_device_id pmc_adc_of_match[] = {
MODULE_DEVICE_TABLE(of, pmc_adc_of_match);
static const struct i2c_device_id pmc_adc_id_table[] = {
- { "pmc-adc" },
+ { .name = "pmc-adc" },
{ }
};
MODULE_DEVICE_TABLE(i2c, pmc_adc_id_table);
diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c
index 7c04e3ec1cbc..c412f5ed46a1 100644
--- a/drivers/iio/adc/ina2xx-adc.c
+++ b/drivers/iio/adc/ina2xx-adc.c
@@ -1078,12 +1078,12 @@ static void ina2xx_remove(struct i2c_client *client)
}
static const struct i2c_device_id ina2xx_id[] = {
- { "ina219", ina219 },
- { "ina220", ina219 },
- { "ina226", ina226 },
- { "ina230", ina226 },
- { "ina231", ina226 },
- { "ina236", ina236 },
+ { .name = "ina219", .driver_data = ina219 },
+ { .name = "ina220", .driver_data = ina219 },
+ { .name = "ina226", .driver_data = ina226 },
+ { .name = "ina230", .driver_data = ina226 },
+ { .name = "ina231", .driver_data = ina226 },
+ { .name = "ina236", .driver_data = ina236 },
{ }
};
MODULE_DEVICE_TABLE(i2c, ina2xx_id);
diff --git a/drivers/iio/adc/ltc2309.c b/drivers/iio/adc/ltc2309.c
index 87b78d0353f1..1ad533270a39 100644
--- a/drivers/iio/adc/ltc2309.c
+++ b/drivers/iio/adc/ltc2309.c
@@ -243,8 +243,8 @@ static const struct of_device_id ltc2309_of_match[] = {
MODULE_DEVICE_TABLE(of, ltc2309_of_match);
static const struct i2c_device_id ltc2309_id[] = {
- { "ltc2305", (kernel_ulong_t)&ltc2305_chip_info },
- { "ltc2309", (kernel_ulong_t)&ltc2309_chip_info },
+ { .name = "ltc2305", .driver_data = (kernel_ulong_t)&ltc2305_chip_info },
+ { .name = "ltc2309", .driver_data = (kernel_ulong_t)&ltc2309_chip_info },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc2309_id);
diff --git a/drivers/iio/adc/ltc2471.c b/drivers/iio/adc/ltc2471.c
index a579107fd5c9..369af700969f 100644
--- a/drivers/iio/adc/ltc2471.c
+++ b/drivers/iio/adc/ltc2471.c
@@ -136,8 +136,8 @@ static int ltc2471_i2c_probe(struct i2c_client *client)
}
static const struct i2c_device_id ltc2471_i2c_id[] = {
- { "ltc2471", ltc2471 },
- { "ltc2473", ltc2473 },
+ { .name = "ltc2471", .driver_data = ltc2471 },
+ { .name = "ltc2473", .driver_data = ltc2473 },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc2471_i2c_id);
diff --git a/drivers/iio/adc/ltc2485.c b/drivers/iio/adc/ltc2485.c
index 060651dd4130..8c3806e061dd 100644
--- a/drivers/iio/adc/ltc2485.c
+++ b/drivers/iio/adc/ltc2485.c
@@ -124,7 +124,7 @@ static int ltc2485_probe(struct i2c_client *client)
}
static const struct i2c_device_id ltc2485_id[] = {
- { "ltc2485" },
+ { .name = "ltc2485" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc2485_id);
diff --git a/drivers/iio/adc/ltc2497.c b/drivers/iio/adc/ltc2497.c
index eb9d521e86e5..8e899d6ffcfa 100644
--- a/drivers/iio/adc/ltc2497.c
+++ b/drivers/iio/adc/ltc2497.c
@@ -142,8 +142,8 @@ static const struct ltc2497_chip_info ltc2497_info[] = {
};
static const struct i2c_device_id ltc2497_id[] = {
- { "ltc2497", (kernel_ulong_t)&ltc2497_info[TYPE_LTC2497] },
- { "ltc2499", (kernel_ulong_t)&ltc2497_info[TYPE_LTC2499] },
+ { .name = "ltc2497", .driver_data = (kernel_ulong_t)&ltc2497_info[TYPE_LTC2497] },
+ { .name = "ltc2499", .driver_data = (kernel_ulong_t)&ltc2497_info[TYPE_LTC2499] },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc2497_id);
diff --git a/drivers/iio/adc/max34408.c b/drivers/iio/adc/max34408.c
index 4f45fd22a90c..da847eaed84e 100644
--- a/drivers/iio/adc/max34408.c
+++ b/drivers/iio/adc/max34408.c
@@ -256,8 +256,8 @@ static const struct of_device_id max34408_of_match[] = {
MODULE_DEVICE_TABLE(of, max34408_of_match);
static const struct i2c_device_id max34408_id[] = {
- { "max34408", (kernel_ulong_t)&max34408_model_data },
- { "max34409", (kernel_ulong_t)&max34409_model_data },
+ { .name = "max34408", .driver_data = (kernel_ulong_t)&max34408_model_data },
+ { .name = "max34409", .driver_data = (kernel_ulong_t)&max34409_model_data },
{ }
};
MODULE_DEVICE_TABLE(i2c, max34408_id);
diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c
index 0cbd7a874798..f49cde672958 100644
--- a/drivers/iio/adc/mcp3422.c
+++ b/drivers/iio/adc/mcp3422.c
@@ -383,14 +383,14 @@ static int mcp3422_probe(struct i2c_client *client)
}
static const struct i2c_device_id mcp3422_id[] = {
- { "mcp3421", 1 },
- { "mcp3422", 2 },
- { "mcp3423", 3 },
- { "mcp3424", 4 },
- { "mcp3425", 5 },
- { "mcp3426", 6 },
- { "mcp3427", 7 },
- { "mcp3428", 8 },
+ { .name = "mcp3421", .driver_data = 1 },
+ { .name = "mcp3422", .driver_data = 2 },
+ { .name = "mcp3423", .driver_data = 3 },
+ { .name = "mcp3424", .driver_data = 4 },
+ { .name = "mcp3425", .driver_data = 5 },
+ { .name = "mcp3426", .driver_data = 6 },
+ { .name = "mcp3427", .driver_data = 7 },
+ { .name = "mcp3428", .driver_data = 8 },
{ }
};
MODULE_DEVICE_TABLE(i2c, mcp3422_id);
diff --git a/drivers/iio/adc/nau7802.c b/drivers/iio/adc/nau7802.c
index 970afb27b839..836c9b49c721 100644
--- a/drivers/iio/adc/nau7802.c
+++ b/drivers/iio/adc/nau7802.c
@@ -531,7 +531,7 @@ static int nau7802_probe(struct i2c_client *client)
}
static const struct i2c_device_id nau7802_i2c_id[] = {
- { "nau7802" },
+ { .name = "nau7802" },
{ }
};
MODULE_DEVICE_TABLE(i2c, nau7802_i2c_id);
diff --git a/drivers/iio/adc/rohm-bd79124.c b/drivers/iio/adc/rohm-bd79124.c
index 40d00bd0cc9d..864f3b1366b5 100644
--- a/drivers/iio/adc/rohm-bd79124.c
+++ b/drivers/iio/adc/rohm-bd79124.c
@@ -1104,7 +1104,7 @@ static const struct of_device_id bd79124_of_match[] = {
MODULE_DEVICE_TABLE(of, bd79124_of_match);
static const struct i2c_device_id bd79124_id[] = {
- { "bd79124" },
+ { .name = "bd79124" },
{ }
};
MODULE_DEVICE_TABLE(i2c, bd79124_id);
diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
index 8ef51c57912d..33f82bdfeb94 100644
--- a/drivers/iio/adc/ti-adc081c.c
+++ b/drivers/iio/adc/ti-adc081c.c
@@ -199,9 +199,9 @@ static int adc081c_probe(struct i2c_client *client)
}
static const struct i2c_device_id adc081c_id[] = {
- { "adc081c", (kernel_ulong_t)&adc081c_model },
- { "adc101c", (kernel_ulong_t)&adc101c_model },
- { "adc121c", (kernel_ulong_t)&adc121c_model },
+ { .name = "adc081c", .driver_data = (kernel_ulong_t)&adc081c_model },
+ { .name = "adc101c", .driver_data = (kernel_ulong_t)&adc101c_model },
+ { .name = "adc121c", .driver_data = (kernel_ulong_t)&adc121c_model },
{ }
};
MODULE_DEVICE_TABLE(i2c, adc081c_id);
diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index c7ffe47449e2..8a272af69f7d 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -1128,9 +1128,9 @@ static const struct ads1015_chip_data tla2024_data = {
};
static const struct i2c_device_id ads1015_id[] = {
- { "ads1015", (kernel_ulong_t)&ads1015_data },
- { "ads1115", (kernel_ulong_t)&ads1115_data },
- { "tla2024", (kernel_ulong_t)&tla2024_data },
+ { .name = "ads1015", .driver_data = (kernel_ulong_t)&ads1015_data },
+ { .name = "ads1115", .driver_data = (kernel_ulong_t)&ads1115_data },
+ { .name = "tla2024", .driver_data = (kernel_ulong_t)&tla2024_data },
{ }
};
MODULE_DEVICE_TABLE(i2c, ads1015_id);
diff --git a/drivers/iio/adc/ti-ads1100.c b/drivers/iio/adc/ti-ads1100.c
index aa8946063c7d..9fe8d54cce83 100644
--- a/drivers/iio/adc/ti-ads1100.c
+++ b/drivers/iio/adc/ti-ads1100.c
@@ -400,8 +400,8 @@ static DEFINE_RUNTIME_DEV_PM_OPS(ads1100_pm_ops,
NULL);
static const struct i2c_device_id ads1100_id[] = {
- { "ads1100" },
- { "ads1000" },
+ { .name = "ads1100" },
+ { .name = "ads1000" },
{ }
};
diff --git a/drivers/iio/adc/ti-ads1119.c b/drivers/iio/adc/ti-ads1119.c
index 2320be0efb50..d31f3d6eb781 100644
--- a/drivers/iio/adc/ti-ads1119.c
+++ b/drivers/iio/adc/ti-ads1119.c
@@ -804,7 +804,7 @@ static const struct of_device_id __maybe_unused ads1119_of_match[] = {
MODULE_DEVICE_TABLE(of, ads1119_of_match);
static const struct i2c_device_id ads1119_id[] = {
- { "ads1119" },
+ { .name = "ads1119" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ads1119_id);
diff --git a/drivers/iio/adc/ti-ads7138.c b/drivers/iio/adc/ti-ads7138.c
index ee5c1b8e3a8e..af87f5f19a0f 100644
--- a/drivers/iio/adc/ti-ads7138.c
+++ b/drivers/iio/adc/ti-ads7138.c
@@ -727,8 +727,8 @@ static const struct of_device_id ads7138_of_match[] = {
MODULE_DEVICE_TABLE(of, ads7138_of_match);
static const struct i2c_device_id ads7138_device_ids[] = {
- { "ads7128", (kernel_ulong_t)&ads7128_data },
- { "ads7138", (kernel_ulong_t)&ads7138_data },
+ { .name = "ads7128", .driver_data = (kernel_ulong_t)&ads7128_data },
+ { .name = "ads7138", .driver_data = (kernel_ulong_t)&ads7138_data },
{ }
};
MODULE_DEVICE_TABLE(i2c, ads7138_device_ids);
diff --git a/drivers/iio/adc/ti-ads7924.c b/drivers/iio/adc/ti-ads7924.c
index 5f294595a415..ff30a52d2850 100644
--- a/drivers/iio/adc/ti-ads7924.c
+++ b/drivers/iio/adc/ti-ads7924.c
@@ -442,7 +442,7 @@ static int ads7924_probe(struct i2c_client *client)
}
static const struct i2c_device_id ads7924_id[] = {
- { "ads7924" },
+ { .name = "ads7924" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ads7924_id);