Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1635434 > unrolled thread

[PATCH] staging: typec: fusb302: Fix module autoload

Started byJavier Martinez Canillas <javier@dowhile0.org>
First post2017-05-04 08:40 +0200
Last post2017-05-04 20:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: typec: fusb302: Fix module autoload Javier Martinez Canillas <javier@dowhile0.org> - 2017-05-04 08:40 +0200
    Re: [PATCH] staging: typec: fusb302: Fix module autoload Guenter Roeck <linux@roeck-us.net> - 2017-05-04 20:10 +0200

#1635434 — [PATCH] staging: typec: fusb302: Fix module autoload

FromJavier Martinez Canillas <javier@dowhile0.org>
Date2017-05-04 08:40 +0200
Subject[PATCH] staging: typec: fusb302: Fix module autoload
Message-ID<tDiAG-8dQ-9@gated-at.bofh.it>
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the OF and I2C device ID table entries as module aliases, using the
MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias
$

After this patch:

$ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias
alias:          of:N*T*Cfcs,fusb302C*
alias:          of:N*T*Cfcs,fusb302
alias:          i2c:typec_fusb302

Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
---

 drivers/staging/typec/fusb302/fusb302.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
index 2cee9a952c9b..aa460f93a293 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -1787,11 +1787,13 @@ static const struct of_device_id fusb302_dt_match[] = {
 	{.compatible = "fcs,fusb302"},
 	{},
 };
+MODULE_DEVICE_TABLE(of, fusb302_dt_match);
 
 static const struct i2c_device_id fusb302_i2c_device_id[] = {
 	{"typec_fusb302", 0},
 	{},
 };
+MODULE_DEVICE_TABLE(i2c, fusb302_i2c_device_id);
 
 static const struct dev_pm_ops fusb302_pm_ops = {
 	.suspend = fusb302_pm_suspend,
-- 
2.9.3

[toc] | [next] | [standalone]


#1635954

FromGuenter Roeck <linux@roeck-us.net>
Date2017-05-04 20:10 +0200
Message-ID<tDtmq-76E-13@gated-at.bofh.it>
In reply to#1635434
On Thu, May 04, 2017 at 08:33:45AM +0200, Javier Martinez Canillas wrote:
> If the driver is built as a module, autoload won't work because the module
> alias information is not filled. So user-space can't match the registered
> device with the corresponding module.
> 
> Export the OF and I2C device ID table entries as module aliases, using the
> MODULE_DEVICE_TABLE() macro.
> 
> Before this patch:
> 
> $ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias
> $
> 
> After this patch:
> 
> $ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias
> alias:          of:N*T*Cfcs,fusb302C*
> alias:          of:N*T*Cfcs,fusb302
> alias:          i2c:typec_fusb302
> 
> Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>

Thanks, queued.

Guenter

> ---
> 
>  drivers/staging/typec/fusb302/fusb302.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
> index 2cee9a952c9b..aa460f93a293 100644
> --- a/drivers/staging/typec/fusb302/fusb302.c
> +++ b/drivers/staging/typec/fusb302/fusb302.c
> @@ -1787,11 +1787,13 @@ static const struct of_device_id fusb302_dt_match[] = {
>  	{.compatible = "fcs,fusb302"},
>  	{},
>  };
> +MODULE_DEVICE_TABLE(of, fusb302_dt_match);
>  
>  static const struct i2c_device_id fusb302_i2c_device_id[] = {
>  	{"typec_fusb302", 0},
>  	{},
>  };
> +MODULE_DEVICE_TABLE(i2c, fusb302_i2c_device_id);
>  
>  static const struct dev_pm_ops fusb302_pm_ops = {
>  	.suspend = fusb302_pm_suspend,
> -- 
> 2.9.3
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web