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/