Hi David (and others),

The Lego tower USB interface is very similar to the ADU200 board from
Ontrak Control Systems.

I downloaded the 0.56 Lego Tower driver for Linux 2.6.0-test7
and modified it slightly to refer to ADU200 devices.
(global replace of constants).

I am running Redhat 8.0 with kernel 2.6.0-test9

The driver works wonderfully.... except....

When I enable the "Sleep-inside-spinlock checking" option of the
Kernel Debugging configuration I get the following warning message.

"Debug: sleeping function called from invalid context at include/asm/semaphore.h:119"

The partial dmesg listing is:
================= snipped from dmesg ======================
drivers/usb/misc/adutux.c :  adu_read : enter, count = 8 
drivers/usb/misc/adutux.c :  adu_interrupt_in_callback : enter, status 0 
Debug: sleeping function called from invalid context at include/asm/semaphore.h:119
in_atomic():1, irqs_disabled():0
Call Trace:
 [<c011af7d>] __might_sleep+0xab/0xce
 [<c81b6b9d>] adu_interrupt_in_callback+0x10d/0x234 [adutux]
 [<c02ad203>] usb_hcd_giveback_urb+0x27/0x3c
 [<c02c3aaa>] uhci_finish_completion+0x76/0xbe
 [<c02ad24d>] usb_hcd_irq+0x35/0x5c
 [<c010bb99>] handle_IRQ_event+0x39/0x62
 [<c010bed7>] do_IRQ+0x9f/0x14e
 [<c010802a>] default_idle+0x0/0x2c
 [<c0105000>] rest_init+0x0/0x62
 [<c010a4d8>] common_interrupt+0x18/0x20
 [<c010802a>] default_idle+0x0/0x2c
 [<c0105000>] rest_init+0x0/0x62
 [<c0108051>] default_idle+0x27/0x2c
 [<c01080c3>] cpu_idle+0x31/0x3a
 [<c046c674>] start_kernel+0x150/0x15e
 [<c046c402>] unknown_bootoption+0x0/0xf6

drivers/usb/misc/adutux.c :  adu_interrupt_in_callback reading  8  
drivers/usb/misc/adutux.c :  adu_interrupt_in_callback : leave, status 0 
drivers/usb/misc/adutux.c :  adu_read : leave, return value 8 
==================== end of dmesg snippet ====================

Inspecting the legousbtower.c code reveals that it behaves the same way.

The offending line is the down() call in the 
tower_interrupt_in_callback......... (named adu_interrupt_in_callback in my code)

The down() function in ./include/asm/semaphore.h calls
might_sleep in ./kernel/sched.c which generates the warning message.

QUESTIONS:
Is this acceptable behaviour?
If not, how should the code be modified?

Thanks for your attention.
John Homppi

Here is my adutux.c source code for reference.

 




Attachment: adutux.c
Description: Binary data

Reply via email to