diff mbox series

[-next,4/9] i2c: at91: fix module autoloading

Message ID 20240819113855.787149-5-liuyuntao12@huawei.com (mailing list archive)
State Handled Elsewhere
Headers show
Series drivers: fix some module autoloading | expand

Commit Message

liuyuntao (F) Aug. 19, 2024, 11:38 a.m. UTC
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
based on the alias from platform_device_id table.

Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com>
---
 drivers/i2c/busses/i2c-at91-core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Arnd Bergmann Aug. 19, 2024, 11:55 a.m. UTC | #1
On Mon, Aug 19, 2024, at 13:38, Yuntao Liu wrote:
> Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
> based on the alias from platform_device_id table.
>
> Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com>
> ---
>  drivers/i2c/busses/i2c-at91-core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/i2c/busses/i2c-at91-core.c 
> b/drivers/i2c/busses/i2c-at91-core.c
> index dc52b3530725..bc3636f90712 100644
> --- a/drivers/i2c/busses/i2c-at91-core.c
> +++ b/drivers/i2c/busses/i2c-at91-core.c
> @@ -107,6 +107,7 @@ static const struct platform_device_id 
> at91_twi_devtypes[] = {
>  		/* sentinel */
>  	}
>  };
> +MODULE_DEVICE_TABLE(platform, at91_twi_devtypes);
> 
>  #if defined(CONFIG_OF)
>  static struct at91_twi_pdata at91sam9x5_config = {
> -- 

This device is always probed from DT, so a better fix would
be to remove the table and the #ifdef/of_match_ptr() around
the atmel_twi_dt_ids.

     Arnd
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c
index dc52b3530725..bc3636f90712 100644
--- a/drivers/i2c/busses/i2c-at91-core.c
+++ b/drivers/i2c/busses/i2c-at91-core.c
@@ -107,6 +107,7 @@  static const struct platform_device_id at91_twi_devtypes[] = {
 		/* sentinel */
 	}
 };
+MODULE_DEVICE_TABLE(platform, at91_twi_devtypes);
 
 #if defined(CONFIG_OF)
 static struct at91_twi_pdata at91sam9x5_config = {