summaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/usb.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-02-13 19:49:25 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-02-15 09:00:46 +0100
commit456a52a6e58bc7769da154251ba9a6ac75c3d70a (patch)
tree6512b6811471e3c2a517bf1e7bc514a029fe447d /drivers/usb/storage/usb.c
parent801af0ef12281e1fc72fb3765ea2ba0ef6802bf0 (diff)
downloadbarebox-456a52a6e58bc7769da154251ba9a6ac75c3d70a.tar.gz
USB storage: fix disconnect
USB storage support missed disconnect support. Implement this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r--drivers/usb/storage/usb.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 865ba8e..5f15464 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -415,7 +415,7 @@ static int usb_stor_add_blkdev(struct us_data *us, struct device_d *dev,
if (result != 0)
dev_warn(dev, "No partition table found\n");
- list_add_tail(&pblk_dev->list, &us_blkdev_list);
+ list_add_tail(&pblk_dev->list, &us->blk_dev_list);
US_DEBUGP("USB disk device successfully added\n");
return 0;
@@ -556,6 +556,7 @@ static int usb_stor_probe(struct usb_device *usbdev,
us->ifnum = intf->bInterfaceNumber;
us->subclass = intf->bInterfaceSubClass;
us->protocol = intf->bInterfaceProtocol;
+ INIT_LIST_HEAD(&us->blk_dev_list);
/* get standard transport and protocol settings */
get_transport(us);
@@ -582,30 +583,18 @@ BadDevice:
/* Handle a USB mass-storage disconnect */
static void usb_stor_disconnect(struct usb_device *usbdev)
{
-#if 0
struct us_data *us = (struct us_data *)usbdev->drv_data;
struct us_blk_dev *bdev, *bdev_tmp;
- US_DEBUGP("Disconnecting USB Mass Storage device %s\n",
- usbdev->dev.name);
-
- /* release all block devices of this mass storage device */
- list_for_each_entry_safe(bdev, bdev_tmp, &us_blkdev_list, list) {
- if (bdev->us == us) {
- US_DEBUGP("Releasing %s\n", bdev->dev.name);
- list_del(&bdev->list);
- unregister_device(&bdev->dev);
- free(bdev);
- }
+ list_for_each_entry_safe(bdev, bdev_tmp, &us->blk_dev_list, list) {
+ list_del(&bdev->list);
+ blockdevice_unregister(&bdev->blk);
+ free(bdev);
}
/* release device's private data */
usbdev->drv_data = 0;
free(us);
-#else
- dev_err(&usbdev->dev, "Disk/partition removal not yet implemented "
- "in the ATA disk driver.");
-#endif
}
#define USUAL_DEV(use_proto, use_trans, drv_info) \