Code like the above just basically can _never_ be correct.
The locking just doesn't make any sense like that.
Real locking looks something like this:
lock_device(dev);
driver = dev->driver;
dev->driver = NULL;
unlock_device(dev);
if (driver->remove)
driver->remove(dev);
put_driver(driver);
together with some promise that "dev" cannot go away from under us (ie a
refcount on "dev" itself).
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/