* [PATCH] iio: Move MODULE_DEVICE_TABLE next to the table itself
@ 2026-05-05 10:29 Krzysztof Kozlowski
2026-05-05 10:49 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-05 10:29 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Kevin Tsai, linux-iio, linux-kernel
Cc: Krzysztof Kozlowski
By convention MODULE_DEVICE_TABLE() immediately follows the ID table it
exports, because this is easier to read and verify. It also makes more
sense since #ifdef for ACPI or OF could hide both of them.
Most of the privers already have this correctly placed, so adjust
the missing ones. No functional impact.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
drivers/iio/chemical/sgp30.c | 3 +--
drivers/iio/light/cm3232.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/chemical/sgp30.c b/drivers/iio/chemical/sgp30.c
index 21730d62b5c8..d42b62b7081e 100644
--- a/drivers/iio/chemical/sgp30.c
+++ b/drivers/iio/chemical/sgp30.c
@@ -498,6 +498,7 @@ static const struct of_device_id sgp_dt_ids[] = {
{ .compatible = "sensirion,sgpc3", .data = &sgp_devices[SGPC3] },
{ }
};
+MODULE_DEVICE_TABLE(of, sgp_dt_ids);
static int sgp_probe(struct i2c_client *client)
{
@@ -566,9 +567,7 @@ static const struct i2c_device_id sgp_id[] = {
{ "sgpc3", (kernel_ulong_t)&sgp_devices[SGPC3] },
{ }
};
-
MODULE_DEVICE_TABLE(i2c, sgp_id);
-MODULE_DEVICE_TABLE(of, sgp_dt_ids);
static struct i2c_driver sgp_driver = {
.driver = {
diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c
index 3a3ad6b4c468..90aa77e3a03b 100644
--- a/drivers/iio/light/cm3232.c
+++ b/drivers/iio/light/cm3232.c
@@ -369,6 +369,7 @@ static const struct i2c_device_id cm3232_id[] = {
{ "cm3232" },
{ }
};
+MODULE_DEVICE_TABLE(i2c, cm3232_id);
static int cm3232_suspend(struct device *dev)
{
@@ -400,8 +401,6 @@ static int cm3232_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(cm3232_pm_ops, cm3232_suspend, cm3232_resume);
-MODULE_DEVICE_TABLE(i2c, cm3232_id);
-
static const struct of_device_id cm3232_of_match[] = {
{.compatible = "capella,cm3232"},
{ }
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: Move MODULE_DEVICE_TABLE next to the table itself
2026-05-05 10:29 [PATCH] iio: Move MODULE_DEVICE_TABLE next to the table itself Krzysztof Kozlowski
@ 2026-05-05 10:49 ` Jonathan Cameron
2026-05-05 10:51 ` Krzysztof Kozlowski
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2026-05-05 10:49 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: David Lechner, Nuno Sá, Andy Shevchenko, Kevin Tsai,
linux-iio, linux-kernel
On Tue, 5 May 2026 12:29:04 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:
> By convention MODULE_DEVICE_TABLE() immediately follows the ID table it
> exports, because this is easier to read and verify. It also makes more
> sense since #ifdef for ACPI or OF could hide both of them.
>
> Most of the privers already have this correctly placed, so adjust
drivers
> the missing ones. No functional impact.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Fixed up the typo and applied.
Thanks,
Jonathan
> ---
> drivers/iio/chemical/sgp30.c | 3 +--
> drivers/iio/light/cm3232.c | 3 +--
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/chemical/sgp30.c b/drivers/iio/chemical/sgp30.c
> index 21730d62b5c8..d42b62b7081e 100644
> --- a/drivers/iio/chemical/sgp30.c
> +++ b/drivers/iio/chemical/sgp30.c
> @@ -498,6 +498,7 @@ static const struct of_device_id sgp_dt_ids[] = {
> { .compatible = "sensirion,sgpc3", .data = &sgp_devices[SGPC3] },
> { }
> };
> +MODULE_DEVICE_TABLE(of, sgp_dt_ids);
>
> static int sgp_probe(struct i2c_client *client)
> {
> @@ -566,9 +567,7 @@ static const struct i2c_device_id sgp_id[] = {
> { "sgpc3", (kernel_ulong_t)&sgp_devices[SGPC3] },
> { }
> };
> -
> MODULE_DEVICE_TABLE(i2c, sgp_id);
> -MODULE_DEVICE_TABLE(of, sgp_dt_ids);
>
> static struct i2c_driver sgp_driver = {
> .driver = {
> diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c
> index 3a3ad6b4c468..90aa77e3a03b 100644
> --- a/drivers/iio/light/cm3232.c
> +++ b/drivers/iio/light/cm3232.c
> @@ -369,6 +369,7 @@ static const struct i2c_device_id cm3232_id[] = {
> { "cm3232" },
> { }
> };
> +MODULE_DEVICE_TABLE(i2c, cm3232_id);
>
> static int cm3232_suspend(struct device *dev)
> {
> @@ -400,8 +401,6 @@ static int cm3232_resume(struct device *dev)
>
> static DEFINE_SIMPLE_DEV_PM_OPS(cm3232_pm_ops, cm3232_suspend, cm3232_resume);
>
> -MODULE_DEVICE_TABLE(i2c, cm3232_id);
> -
> static const struct of_device_id cm3232_of_match[] = {
> {.compatible = "capella,cm3232"},
> { }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: Move MODULE_DEVICE_TABLE next to the table itself
2026-05-05 10:49 ` Jonathan Cameron
@ 2026-05-05 10:51 ` Krzysztof Kozlowski
0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-05 10:51 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Lechner, Nuno Sá, Andy Shevchenko, Kevin Tsai,
linux-iio, linux-kernel
On 05/05/2026 12:49, Jonathan Cameron wrote:
> On Tue, 5 May 2026 12:29:04 +0200
> Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:
>
>> By convention MODULE_DEVICE_TABLE() immediately follows the ID table it
>> exports, because this is easier to read and verify. It also makes more
>> sense since #ifdef for ACPI or OF could hide both of them.
>>
>> Most of the privers already have this correctly placed, so adjust
> drivers
>> the missing ones. No functional impact.
Oh, damn, I just sent 20 other patches like that with the typo. I did
spellcheck but earlier patch and then changed this and...
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-05 10:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 10:29 [PATCH] iio: Move MODULE_DEVICE_TABLE next to the table itself Krzysztof Kozlowski
2026-05-05 10:49 ` Jonathan Cameron
2026-05-05 10:51 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox