Re: [PATCH 3/7] eeprom: at24: extend driver to plug into the NVMEM framework

From: Bartosz Golaszewski
Date: Fri Feb 12 2016 - 06:02:59 EST


2016-02-12 10:16 GMT+01:00 Andrew Lunn <andrew@xxxxxxx>:
> On Fri, Jan 29, 2016 at 02:10:17PM +0100, Bartosz Golaszewski wrote:
>> Hi Andrew,
>>
>> the patch works, but I'm hitting the following BUG when instantiating
>> an at24c32 device:
>
> Hi Bortosz
>
> Sorry for taking so long to get back to you. Can you confirm you had
> lockdep turned on.

Yes, this is from the config I used:

CONFIG_LOCKDEP_SUPPORT=y
CONFIG_LOCKDEP=y
# CONFIG_DEBUG_LOCKDEP is not set

Best regards,
Bartosz Golaszewski

> Thanks
> Andrew
>
>>
>> # echo 24c32 0x54 > /sys/class/i2c-adapter/i2c-2/new_device
>> [ 3.741893] BUG: key de753e8c not in .data!
>> [ 3.749166] ------------[ cut here ]------------
>> [ 3.756649] WARNING: CPU: 0 PID: 102 at
>> kernel/locking/lockdep.c:3002 __kernfs_create_file+0x60/0xc4()
>> [ 3.769048] DEBUG_LOCKS_WARN_ON(1)
>> [ 3.772463] Modules linked in: at24(+) nvmem_core cpufreq_dt
>> omap_wdt thermal_sys leds_gpio led_class hwmon
>> [ 3.788301] CPU: 0 PID: 102 Comm: udevd Not tainted 4.5.0-rc1-acme+ #7
>> [ 3.797833] Hardware name: Generic AM33XX (Flattened Device Tree)
>> [ 3.806920] [<c0017d44>] (unwind_backtrace) from [<c0014034>]
>> (show_stack+0x10/0x14)
>> [ 3.817762] [<c0014034>] (show_stack) from [<c036b478>]
>> (dump_stack+0x84/0x9c)
>> [ 3.828071] [<c036b478>] (dump_stack) from [<c003c850>]
>> (warn_slowpath_common+0x7c/0xb8)
>> [ 3.839284] [<c003c850>] (warn_slowpath_common) from [<c003c8bc>]
>> (warn_slowpath_fmt+0x30/0x40)
>> [ 3.851154] [<c003c8bc>] (warn_slowpath_fmt) from [<c01fbf3c>]
>> (__kernfs_create_file+0x60/0xc4)
>> [ 3.863025] [<c01fbf3c>] (__kernfs_create_file) from [<c01fc794>]
>> (sysfs_add_file_mode_ns+0x98/0x1bc)
>> [ 3.875488] [<c01fc794>] (sysfs_add_file_mode_ns) from [<c01fca40>]
>> (sysfs_create_bin_file+0x38/0x44)
>> [ 3.888000] [<c01fca40>] (sysfs_create_bin_file) from [<bf033770>]
>> (nvmem_register+0x2cc/0x34c [nvmem_core])
>> [ 3.901190] [<bf033770>] (nvmem_register [nvmem_core]) from
>> [<bf03c958>] (at24_probe+0x430/0x59c [at24])
>> [ 3.914055] [<bf03c958>] (at24_probe [at24]) from [<c054be80>]
>> (i2c_device_probe+0x168/0x1fc)
>> [ 3.925926] [<c054be80>] (i2c_device_probe) from [<c045ba44>]
>> (driver_probe_device+0x208/0x2c0)
>> [ 3.938003] [<c045ba44>] (driver_probe_device) from [<c045bb90>]
>> (__driver_attach+0x94/0x98)
>> [ 3.949821] [<c045bb90>] (__driver_attach) from [<c0459d80>]
>> (bus_for_each_dev+0x6c/0xa0)
>> [ 3.961373] [<c0459d80>] (bus_for_each_dev) from [<c045b038>]
>> (bus_add_driver+0x18c/0x214)
>> [ 3.973037] [<c045b038>] (bus_add_driver) from [<c045c4f4>]
>> (driver_register+0x78/0xf8)
>> [ 3.984458] [<c045c4f4>] (driver_register) from [<c054ca00>]
>> (i2c_register_driver+0x2c/0x80)
>> [ 3.996349] [<c054ca00>] (i2c_register_driver) from [<c0009804>]
>> (do_one_initcall+0x80/0x1e0)
>> [ 4.008344] [<c0009804>] (do_one_initcall) from [<c0123110>]
>> (do_init_module+0x5c/0x1d4)
>> [ 4.019910] [<c0123110>] (do_init_module) from [<c00cb2e4>]
>> (load_module+0x1cc0/0x1f48)
>> [ 4.031378] [<c00cb2e4>] (load_module) from [<c00cb71c>]
>> (SyS_finit_module+0x64/0x74)
>> [ 4.042665] [<c00cb71c>] (SyS_finit_module) from [<c000f820>]
>> (ret_fast_syscall+0x0/0x1c)
>> [ 4.054322] ---[ end trace 692db3ff57b96549 ]---
>> [ 4.062228] at24 2-0054: 4096 byte 24c32 EEPROM, writable, 1 bytes/write
>> [ 4.073224] i2c i2c-2: new_device: Instantiated device 24c32 at 0x54
>>
>> It seems to result in the nvmem attribute having 0 size while the
>> legacy eeprom file has size corresponding with the chip's memory area
>> size in bytes.
>>
>> Best regards,
>> Bartosz Golaszewski