Cape IIO Kernel NULL Pointer derefence

Using Ubuntu 13.04 3.8.13-bone31

After approximately five minutes AIN* values go to “Resource Temporarily Unavailable”

elsinore@brewery:~$ cat /sys/devices/ocp.2/helper.13/AIN*
cat: /sys/devices/ocp.2/helper.13/AIN0: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.13/AIN1: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.13/AIN2: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.13/AIN3: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.13/AIN4: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.13/AIN5: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.13/AIN6: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.13/AIN7: Resource temporarily unavailable

When I unload the cape:

Dec 3 19:38:04 brewery kernel: [ 873.063510] Unable to handle kernel NULL pointer dereference at virtual address 0000001b
Dec 3 19:38:04 brewery kernel: [ 873.072312] pgd = df308000
Dec 3 19:38:04 brewery kernel: [ 873.075179] [0000001b] *pgd=9f475831, *pte=00000000, *ppte=00000000
Dec 3 19:38:04 brewery kernel: [ 873.081805] Internal error: Oops: 17 [#1] SMP ARM
Dec 3 19:38:04 brewery kernel: [ 873.086721] Modules linked in: g_multi libcomposite r8712u© hid_ntrig
Dec 3 19:38:04 brewery kernel: [ 873.093665] CPU: 0 Tainted: G C (3.8.13-bone31 #1)
Dec 3 19:38:04 brewery kernel: [ 873.099955] PC is at omap_device_idle+0x10/0x54
Dec 3 19:38:04 brewery kernel: [ 873.104689] LR is at _od_runtime_suspend+0x1c/0x24
Dec 3 19:38:04 brewery kernel: [ 873.109697] pc : [] lr : [] psr: a0000013
Dec 3 19:38:04 brewery kernel: [ 873.109697] sp : de5bbd68 ip : df0484cc fp : de155c18
Dec 3 19:38:04 brewery kernel: [ 873.121695] r10: de5bbda0 r9 : c0059db0 r8 : 00000000
Dec 3 19:38:04 brewery kernel: [ 873.127155] r7 : 60000013 r6 : 00000000 r5 : df28f410 r4 : 00000000
Dec 3 19:38:04 brewery kernel: [ 873.133976] r3 : 00000000 r2 : 000c000b r1 : df28f480 r0 : df28f400
Dec 3 19:38:04 brewery kernel: [ 873.140800] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Dec 3 19:38:04 brewery kernel: [ 873.148256] Control: 10c5387d Table: 9f308019 DAC: 00000015
Dec 3 19:38:04 brewery kernel: [ 873.154260] Process bash (pid: 1491, stack limit = 0xde5ba240)
Dec 3 19:38:04 brewery kernel: [ 873.160356] Stack: (0xde5bbd68 to 0xde5bc000)
Dec 3 19:38:04 brewery kernel: [ 873.182260] bd60: 00000000 c0028540 00000000 df28f410 c0028524 c038e278
Dec 3 19:38:04 brewery kernel: [ 873.199820] bd80: c094f4d8 df28f410 00000000 c038e7d8 60000013 00000001 00000003 00000000
Dec 3 19:38:04 brewery kernel: [ 873.215648] bda0: de664e00 fffffdf4 de5ba000 df28f410 00000000 df28f480 60000013 00200200
Dec 3 19:38:04 brewery kernel: [ 873.227851] bdc0: c066a264 de623df8 de155c18 c038f684 00000000 df28f410 c0027984 00000004
Dec 3 19:38:04 brewery kernel: [ 873.236519] bde0: 60000013 c038ae38 df28f410 c038e278 c094f4d8 df28f410 00000000 c038ebb8
Dec 3 19:38:04 brewery kernel: [ 873.252565] be00: df28f51c df28f410 00000004 df28f480 60000013 c038ed10 c03943f4 df28f410
Dec 3 19:38:04 brewery kernel: [ 873.272087] be20: df7f9b10 c099be08 00000000 c039fbe8 c039fbbc df28f410 c099d194 c03878e0
Dec 3 19:38:04 brewery kernel: [ 873.287712] be40: c03878cc c03862d8 df578580 df28f444 df28f410 c038633c 00000000 df28f410
Dec 3 19:38:04 brewery kernel: [ 873.304292] be60: df04843c c0385e70 df28f410 df0b7200 df0b7210 c03840e8 df28f400 df0b7200
Dec 3 19:38:04 brewery kernel: [ 873.312980] be80: 00000000 c0387c58 df28f400 c0387e74 df47d680 c04d1bf8 0000002b df47d680
Dec 3 19:38:04 brewery kernel: [ 873.338590] bea0: de623dc0 de623df8 00100100 c04d1cc4 df578580 ffffffff ffffffb0 de623dc8
Dec 3 19:38:04 brewery kernel: [ 873.361964] bec0: de623dc0 de623e10 db25f000 c04d2498 de39e410 00000000 df0d7c10 de00da58
Dec 3 19:38:04 brewery kernel: [ 873.381545] bee0: df0d7c10 c039c69c 00000007 de155c20 00000003 c039dca8 ffffffff de00da58
Dec 3 19:38:04 brewery kernel: [ 873.394988] bf00: c09c05c0 c061992c 22222222 22222222 22222222 de157f48 de00da40 00000003
Dec 3 19:38:04 brewery kernel: [ 873.404766] bf20: de00da58 de5bbf80 c066a264 df0d7c18 00000000 c0382ed0 00000003 c014e684
Dec 3 19:38:04 brewery kernel: [ 873.424443] bf40: de333bc0 000ac408 00000003 de5bbf80 000ac408 de5ba000 00000003 c00f5474
Dec 3 19:38:04 brewery kernel: [ 873.440066] bf60: de333bc0 000ac408 00000000 00000000 de333bc0 00000000 000ac408 c00f5754
Dec 3 19:38:04 brewery kernel: [ 873.461551] bf80: 00000000 00000000 00000003 00000003 000ac408 b6f55a78 00000004 c000da04
Dec 3 19:38:04 brewery kernel: [ 873.477265] bfa0: 00000000 c000d880 00000003 000ac408 00000001 000ac408 00000003 00000000
Dec 3 19:38:04 brewery kernel: [ 873.487589] bfc0: 00000003 000ac408 b6f55a78 00000004 00000003 00000000 000a6094 00000000
Dec 3 19:38:05 brewery kernel: [ 873.497337] bfe0: 00000000 be9368ac b6ec444d b6efbfbc 40070010 00000001 00000000 00000019
Dec 3 19:38:05 brewery kernel: [ 873.506043] [] (omap_device_idle+0x10/0x54) from [] (_od_runtime_suspend+0x1c/0x24)
Dec 3 19:38:05 brewery kernel: [ 873.515928] [] (_od_runtime_suspend+0x1c/0x24) from [] (__rpm_callback+0x30/0x58)
Dec 3 19:38:05 brewery kernel: [ 873.525620] [] (__rpm_callback+0x30/0x58) from [] (rpm_suspend+0x2b0/0x4a4)
Dec 3 19:38:05 brewery kernel: [ 873.534760] [] (rpm_suspend+0x2b0/0x4a4) from [] (__pm_runtime_suspend+0x48/0x90)
Dec 3 19:38:05 brewery kernel: [ 873.544444] [] (__pm_runtime_suspend+0x48/0x90) from [] (pm_generic_runtime_idle+0x20/0x50)
Dec 3 19:38:05 brewery kernel: [ 873.555037] [] (pm_generic_runtime_idle+0x20/0x50) from [] (__rpm_callback+0x30/0x58)
Dec 3 19:38:05 brewery kernel: [ 873.565084] [] (__rpm_callback+0x30/0x58) from [] (rpm_idle+0x180/0x228)
Dec 3 19:38:05 brewery kernel: [ 873.573948] [] (rpm_idle+0x180/0x228) from [] (__pm_runtime_idle+0x48/0x90)
Dec 3 19:38:05 brewery kernel: [ 873.583100] [] (__pm_runtime_idle+0x48/0x90) from [] (ti_tscadc_remove+0x2c/0x48)
Dec 3 19:38:05 brewery kernel: [ 873.592795] [] (ti_tscadc_remove+0x2c/0x48) from [] (platform_drv_remove+0x14/0x18)
Dec 3 19:38:05 brewery kernel: [ 873.602663] [] (platform_drv_remove+0x14/0x18) from [] (__device_release_driver+0x7c/0xc4)
Dec 3 19:38:05 brewery kernel: [ 873.613168] [] (__device_release_driver+0x7c/0xc4) from [] (device_release_driver+0x1c/0x28)
Dec 3 19:38:05 brewery kernel: [ 873.623852] [] (device_release_driver+0x1c/0x28) from [] (bus_remove_device+0xc8/0xd8)
Dec 3 19:38:05 brewery kernel: [ 873.633988] [] (bus_remove_device+0xc8/0xd8) from [] (device_del+0x108/0x16c)
Dec 3 19:38:05 brewery kernel: [ 873.643308] [] (device_del+0x108/0x16c) from [] (platform_device_del+0x14/0x44)
Dec 3 19:38:05 brewery kernel: [ 873.652810] [] (platform_device_del+0x14/0x44) from [] (platform_device_unregister+0xc/0x18)
Dec 3 19:38:05 brewery kernel: [ 873.663510] [] (platform_device_unregister+0xc/0x18) from [] (of_overlay_device_entry_change.isra.0+0xe8/0x16c)
Dec 3 19:38:05 brewery kernel: [ 873.675928] [] (of_overlay_device_entry_change.isra.0+0xe8/0x16c) from [] (of_overlay_revert_one+0x48/0x1e8)
Dec 3 19:38:05 brewery kernel: [ 873.688069] [] (of_overlay_revert_one+0x48/0x1e8) from [] (of_overlay_revert+0x3c/0x60)
Dec 3 19:38:05 brewery kernel: [ 873.698298] [] (of_overlay_revert+0x3c/0x60) from [] (bone_capemgr_remove_slot_no_lock+0x40/0xc8)
Dec 3 19:38:05 brewery kernel: [ 873.709436] [] (bone_capemgr_remove_slot_no_lock+0x40/0xc8) from [] (slots_store+0x78/0x3b0)
Dec 3 19:38:05 brewery kernel: [ 873.720118] [] (slots_store+0x78/0x3b0) from [] (dev_attr_store+0x18/0x24)
Dec 3 19:38:05 brewery kernel: [ 873.729170] [] (dev_attr_store+0x18/0x24) from [] (sysfs_write_file+0x100/0x148)
Dec 3 19:38:05 brewery kernel: [ 873.738751] [] (sysfs_write_file+0x100/0x148) from [] (vfs_write+0xa8/0x178)
Dec 3 19:38:05 brewery kernel: [ 873.747963] [] (vfs_write+0xa8/0x178) from [] (sys_write+0x38/0x64)
Dec 3 19:38:05 brewery kernel: [ 873.756362] [] (sys_write+0x38/0x64) from [] (ret_fast_syscall+0x0/0x30)
Dec 3 19:38:05 brewery kernel: [ 873.770224] Code: e3500000 e92d4010 01a04000 159041c8 (e5d4301b)
Dec 3 19:38:05 brewery kernel: [ 873.776680] —[ end trace 11c5dfaa4d81386f ]—

Is dumped to the syslog

What have I done wrong?

As others have noted here

https://groups.google.com/forum/#!category-topic/beagleboard/beaglebone-black/ZLSuKKM9Im4

Unloading cape is a bit problematic… shortly don’t expect it to work reliably

Ok, but how to I make the reading on the analogue inputs more reliable?

I have the same problem with Ubuntu 13.04 3.8.13-bone37

Any body know how to solve it?