mbox series

[-next,0/9] drivers: fix some module autoloading

Message ID 20240819113855.787149-1-liuyuntao12@huawei.com
Headers show
Series drivers: fix some module autoloading | expand

Message

Yuntao Liu 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.

Yuntao Liu (9):
  usb: ehci-mv: fix module autoloading
  soc: pxa: ssp: fix module autoloading
  misc: atmel-ssc: fix module autoloading
  i2c: at91: fix module autoloading
  mpc85xx_edac: fix module autoloading
  dmaengine: pxa: fix module autoloading
  dmaengine: mmp_pdma: fix module autoloading
  dmaengine: at_hdmac: fix module autoloading
  ipmi: ipmi_ssif: fix module autoloading

 drivers/char/ipmi/ipmi_ssif.c      | 1 +
 drivers/dma/at_hdmac.c             | 1 +
 drivers/dma/mmp_pdma.c             | 1 +
 drivers/dma/pxa_dma.c              | 1 +
 drivers/edac/mpc85xx_edac.c        | 1 +
 drivers/i2c/busses/i2c-at91-core.c | 1 +
 drivers/misc/atmel-ssc.c           | 1 +
 drivers/soc/pxa/ssp.c              | 1 +
 drivers/usb/host/ehci-mv.c         | 1 +
 9 files changed, 9 insertions(+)

Comments

Arnd Bergmann Aug. 19, 2024, 11:49 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/usb/host/ehci-mv.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
> index 2f1fc7eb8b72..33d925316eec 100644
> --- a/drivers/usb/host/ehci-mv.c
> +++ b/drivers/usb/host/ehci-mv.c
> @@ -260,6 +260,7 @@ static const struct platform_device_id ehci_id_table[] = {
>  	{"pxa-sph", 0},
>  	{},
>  };
> +MODULE_DEVICE_TABLE(platform, ehci_id_table);

Neither of the two entries is used any more, so a better
fix would be to remove the platform_device_id table.

     Arnd
Arnd Bergmann Aug. 19, 2024, 11:54 a.m. UTC | #2
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/misc/atmel-ssc.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index 6eac0f335915..e7a87183bfbb 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -110,6 +110,7 @@ static const struct platform_device_id 
> atmel_ssc_devtypes[] = {
>  		/* sentinel */
>  	}
>  };
> +MODULE_DEVICE_TABLE(platform, atmel_ssc_devtypes);

I think this driver is autoloaded by the drivers using it,
so this entry is not needed. there is also an of_device_id
table that will load the driver based on the DT information. 

     Arnd
Arnd Bergmann Aug. 19, 2024, 11:57 a.m. UTC | #3
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>

Acked-by: Arnd Bergmann <arnd@arndb.de>

>  	},
>  	{}
>  };
> +MODULE_DEVICE_TABLE(platform, mpc85xx_pci_err_match);
> 

I see that this device is created in arch/powerpc/sysdev/fsl_pci.c,
so your change makes sense here.

     Arnd
Arnd Bergmann Aug. 19, 2024, 12:09 p.m. UTC | #4
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.
>
> Yuntao Liu (9):
>   usb: ehci-mv: fix module autoloading
>   soc: pxa: ssp: fix module autoloading
>   misc: atmel-ssc: fix module autoloading
>   i2c: at91: fix module autoloading
>   mpc85xx_edac: fix module autoloading
>   dmaengine: pxa: fix module autoloading
>   dmaengine: mmp_pdma: fix module autoloading
>   dmaengine: at_hdmac: fix module autoloading
>   ipmi: ipmi_ssif: fix module autoloading

I looked at all the patches and found that most of them do not
use the table any more, or will stop using it in the near future.

I think your work to validate the correctness of the entries
is useful, but it may be more helpful to focus on removing
all the unused tables, including those that have a
MODULE_DEVICE_TABLE() tag.

If you are planning to do more such cleanups, maybe you can
go through them one subsystem at a time and look for drivers
that have both of_device_id and i2c_device_id/platform_device_id/
spi_device_id tables. If nothing in the kernel creates a device
with the legacy string, you can then send a patch that removes
the old device ID list and at the same time makes the DT support
unconditional in case there is an #ifdef CONFIG_OF check.

If the probe() function accesses platform_data, this would also
be unused, allowing an even nicer cleanup of removing the
platofrm_data path in favor of OF properties.

      Arnd