Am 12.09.2010 um 19:45 schrieb Dr. H. Nikolaus Schaller:

> 
> Am 11.09.2010 um 16:21 schrieb Daniel Gloeckner:
> 
>> Hi,
>> 
>> On Sat, Sep 11, 2010 at 03:53:47PM +0200, Dr. H. Nikolaus Schaller wrote:
>>> Or do you mean changeing the module_init(i2c_adap_jz_init); to
>>> subsys_initcall(i2c_adap_jz_init); ?
>> 
>> yes, that's what I ment.
> 
> I now tried to replace
> 
> MODULE_LICENSE("GPL");
> 
> module_init(i2c_adap_jz_init);
> module_exit(i2c_adap_jz_exit);
> 
> with
> 
> MODULE_LICENSE("GPL");
> 
> subsys_init(i2c_adap_jz_init);
> subsys_exit(i2c_adap_jz_exit);
> 
> 
> in i2c_jz47xx.c but it makes the whole i2c system fail.
> 
> Without kernel error messages (except that i2cdetect has no
> device and the RTC driver does not find a device).

It took me a while tun understand that it is quite
confusing how these macros work and interact (or don't)...

Well, some mistakes I did:
*  it is not module_init() and subsys_init()
   but subsys_initcall()
* There is no module_initcall(). Instead,
   module_init() is mapped to device_initcall()
* there is no subsys_exit() or subsys_exitcall()
* the compiler appears to have silently ignored to
  link the module with malformed init()
  Therefore, it wasn't loaded because it was not
  linked.
* I did not check the build log for error messages

Now, with

        subsys_exitcall(i2c_adap_jz_init);
        module_exit(i2c_adap_jz_exit);

the i2c_get_adapter(0) is found when first requested!

And, the i2c_open() and i2c_read() calls don't
report errors, i.e. the devices are responding.

Thanks for the help!

The next steps are to make the other i2c devices work
(e.g. /proc/jz/battery-level, /proc/powerdown)

And then replace this hackish i2c_open() stuff with

        i2c_transfer(i2c_get_adapter(0), ...)

Nikolaus

_______________________________________________
Mipsbook-devel mailing list
Mipsbook-devel@linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/mipsbook-devel

Reply via email to