linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: Request module by alias in of_i2c.c
@ 2010-11-16 22:42 David Daney
  2010-11-17  6:24 ` Grant Likely
  0 siblings, 1 reply; 2+ messages in thread
From: David Daney @ 2010-11-16 22:42 UTC (permalink / raw)
  To: linux-mips, ralf, devicetree-discuss, grant.likely, linux-kernel
  Cc: David Daney

If we are registering an i2c device that has a device tree node like
this real-world example:

      rtc@68 {
        compatible = "dallas,ds1337";
        reg = <0x68>;
      };

of_i2c_register_devices() will try to load a module called ds1337.ko.
There is no such module, so it will fail.  If we look in modules.alias
we will find entries like these:

.
.
.
alias i2c:ds1339 rtc_ds1307
alias i2c:ds1338 rtc_ds1307
alias i2c:ds1337 rtc_ds1307
alias i2c:ds1307 rtc_ds1307
alias i2c:ds1374 rtc_ds1374
.
.
.

The module we want is really called rtc_ds1307.ko.  If we request a
module called "i2c:ds1337", the userspace module loader will do the
right thing (unless it is busybox) and load rtc_ds1307.ko.  So we add
the I2C_MODULE_PREFIX to the request_module() string.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 drivers/of/of_i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index c85d3c7..f37fbeb 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -61,7 +61,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
 		info.of_node = of_node_get(node);
 		info.archdata = &dev_ad;
 
-		request_module("%s", info.type);
+		request_module("%s%s", I2C_MODULE_PREFIX, info.type);
 
 		result = i2c_new_device(adap, &info);
 		if (result == NULL) {
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] of: Request module by alias in of_i2c.c
  2010-11-16 22:42 [PATCH] of: Request module by alias in of_i2c.c David Daney
@ 2010-11-17  6:24 ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2010-11-17  6:24 UTC (permalink / raw)
  To: David Daney; +Cc: linux-mips, ralf, devicetree-discuss, linux-kernel

On Tue, Nov 16, 2010 at 02:42:14PM -0800, David Daney wrote:
> If we are registering an i2c device that has a device tree node like
> this real-world example:
> 
>       rtc@68 {
>         compatible = "dallas,ds1337";
>         reg = <0x68>;
>       };
> 
> of_i2c_register_devices() will try to load a module called ds1337.ko.
> There is no such module, so it will fail.  If we look in modules.alias
> we will find entries like these:
> 
> .
> .
> .
> alias i2c:ds1339 rtc_ds1307
> alias i2c:ds1338 rtc_ds1307
> alias i2c:ds1337 rtc_ds1307
> alias i2c:ds1307 rtc_ds1307
> alias i2c:ds1374 rtc_ds1374
> .
> .
> .
> 
> The module we want is really called rtc_ds1307.ko.  If we request a
> module called "i2c:ds1337", the userspace module loader will do the
> right thing (unless it is busybox) and load rtc_ds1307.ko.  So we add
> the I2C_MODULE_PREFIX to the request_module() string.
> 
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>

Applied, thanks.

g.

> ---
>  drivers/of/of_i2c.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
> index c85d3c7..f37fbeb 100644
> --- a/drivers/of/of_i2c.c
> +++ b/drivers/of/of_i2c.c
> @@ -61,7 +61,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
>  		info.of_node = of_node_get(node);
>  		info.archdata = &dev_ad;
>  
> -		request_module("%s", info.type);
> +		request_module("%s%s", I2C_MODULE_PREFIX, info.type);
>  
>  		result = i2c_new_device(adap, &info);
>  		if (result == NULL) {
> -- 
> 1.7.2.3
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-17  6:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-16 22:42 [PATCH] of: Request module by alias in of_i2c.c David Daney
2010-11-17  6:24 ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).