Re: ehci-hcd on CARDBUS hangs when stopping card service

Linus Torvalds (torvalds@transmeta.com)
Fri, 24 May 2002 18:49:29 +0000 (UTC)


In article <3CED6E0B.8020501@pacbell.net>,
David Brownell <david-b@pacbell.net> wrote:
>
>Is there a clean way to detect the "card ejected before anything calls
>pci_dev->remove()" case? I don't really like the idea of wrapping code
>around every PCI register access to detect such cases.

You don't have much choice with CardBus, I'm afraid.

Even if the user were to do the rmmod "before" yanking out the card,
assuming that the rmmod took a bit of time and started the "remove()"
call at the same time the card was actually removed, you'll end up in
the same situation.

It's just a fact of life with any hot-plug thing that can be removed
without software first freeing it.

On most (practically all?) machines, a device that no longer exists will
return a nice floating 0xff for device reads, so it's usually reasonably
simple to detect (0xff is often not a legal status register value for
most devices for example).

Also, it's generally a good idea to "just say no" to endless loops in
drivers. Hardware bugs _do_ happen, and it's a lot more pleasant to have
the driver do a

printk("Device does not respond\n");

than for the kernel to hang.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/