Skip to contentSkip to conversation

usx2y: prevent oops & dead keyboard on hot usb unplugging

PATCH karsten wiese 1 participant 1 message Apr 15, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines · --- Takashi Iwai

At Fri, 15 Apr 2005 16:28:54 +0200 (CEST),

Quoted 8 lines · karsten wiese
Quoted 5 lines · --- Takashi Iwai

At Fri, 15 Apr 2005 15:59:25 +0200 (CEST),

Quoted 3 lines · karsten wiese

--- Lee Revell <[email protected]> wrote:

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

On Thu, 2005-04-14 at 20:59 +0200, karsten wiese

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 3 lines

Hi Clemens & Takashi

Please commit the patch.

Is the ALSA in kernel 2.6.11 affected? If so,

this

Quoted 11 lines
Quoted 10 lines
Quoted 2 lines

Think so, yes. The keyboard dead effect + described

oops

Quoted 2 lines

has been around for quiet a long time. (There is a lkml mail from yesterday about an

usb-cellphone

Quoted 3 lines

setup,
where the same oops + dead keyboard happens also:

http://marc.theaimsgroup.com/?i=<20050414230621.49663f75.vsu%20()%20altlinux%20!%20ru>

Quoted 57 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

)
There is also an alsa-bug with snd-usb-audio in the bugbase.
Clemens seams not to be convinced about this

aproach

Quoted 6 lines
Quoted 6 lines

yet.

Quoted 5 lines

maybe 'cause the comment of snd_card_free_in_thread explicitly states that its the one to be called for hotplug:
/**
* snd_card_free_in_thread - call snd_card_free()

in

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

thread
* @card: soundcard structure
*
* This function schedules the call of

snd_card_free()

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

function in a
* work queue. When all devices are released

(non-busy),

Quoted 4 lines

the work
* is woken up and calls snd_card_free(). *
* When a card can be disconnected at any time by

Quoted 8 lines
Quoted 8 lines

hotplug

Quoted 2 lines

service,
* this function should be used in disconnect (or

detach)

Quoted 4 lines

callback
* instead of calling snd_card_free() directly. *
* Returns - zero otherwise a negative error code

if

Quoted 7 lines
Quoted 7 lines

the

Quoted 4 lines

start of thread failed.
*/

Also I remember , that snd_card_free didn't work ok

when i

Quoted 1 line

used it in the first implementations of

usx2y-module

Quoted 8 lines
Quoted 8 lines

some 2

Quoted 3 lines

years ago.
but that was on kernel 2.4.something....... maybe above comment is from kernel 2.4 also and the

hotplug

Quoted 1 line

system has changed ? anybody?

Might be. To be sure, check whether the release fops

is

Quoted 6 lines
Quoted 2 lines

called
properly before you calling snd_card_free().

You mean snd_card_disconnect()?
That's called with the same argument and before
snd_card_free().

Quoted 7 lines

No, I mean snd_card_free(), which you changed from snd_card_free_in_thread(). Someone has to release the files
(i.e. call release fops eventually) before clean up everything via
snd_card_free().

Erm, you mean the close (for snd_pcm_ops_t,snd_rawmidi_ops_t) and release (for snd_hwdep_ops_t) callbacks then? They should all be called before snd_card_free()?
in other words:
<snip>
int snd_card_free_in_thread(snd_card_t * card)

{
	if (card->files == NULL) {
		snd_card_free(card);
		return 0;
	}

</snip>
the "(card->files == NULL)" MUST be true before
snd_card_free() can be called safely?

Karsten

___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click