[PATCH 01/14] uas: add basic task management functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This just allocates the structures.

Signed-off-by: Oliver Neukum <oneukum@xxxxxxxx>
---
 drivers/usb/storage/uas.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 44b096c..13e6313 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -38,6 +38,8 @@ struct uas_dev_info {
 	struct usb_anchor cmd_urbs;
 	struct usb_anchor sense_urbs;
 	struct usb_anchor data_urbs;
+	struct task_mgmt_iu *tmf_iu;
+	struct urb *management_urb;
 	unsigned long flags;
 	int qdepth, resetting;
 	unsigned cmd_pipe, status_pipe, data_in_pipe, data_out_pipe;
@@ -921,6 +923,8 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	struct Scsi_Host *shost = NULL;
 	struct uas_dev_info *devinfo;
 	struct usb_device *udev = interface_to_usbdev(intf);
+	struct task_mgmt_iu *tmf;
+	struct urb *mu;
 	unsigned long dev_flags;
 
 	if (!uas_use_uas_driver(intf, id, &dev_flags))
@@ -929,6 +933,11 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	if (uas_switch_interface(udev, intf))
 		return -ENODEV;
 
+	tmf = kmalloc(sizeof(*tmf), GFP_KERNEL);
+	mu = usb_alloc_urb(0, GFP_KERNEL);
+	if (!tmf && !mu)
+		goto set_alt0;
+
 	shost = scsi_host_alloc(&uas_host_template,
 				sizeof(struct uas_dev_info));
 	if (!shost)
@@ -946,6 +955,8 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	devinfo->resetting = 0;
 	devinfo->shutdown = 0;
 	devinfo->flags = dev_flags;
+	devinfo->tmf_iu = tmf;
+	devinfo->management_urb = mu;
 	init_usb_anchor(&devinfo->cmd_urbs);
 	init_usb_anchor(&devinfo->sense_urbs);
 	init_usb_anchor(&devinfo->data_urbs);
@@ -969,6 +980,8 @@ free_streams:
 	usb_set_intfdata(intf, NULL);
 set_alt0:
 	usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0);
+	kfree(tmf);
+	usb_free_urb(mu);
 	if (shost)
 		scsi_host_put(shost);
 	return result;
@@ -1129,6 +1142,8 @@ static void uas_disconnect(struct usb_interface *intf)
 	usb_kill_anchored_urbs(&devinfo->sense_urbs);
 	usb_kill_anchored_urbs(&devinfo->data_urbs);
 	uas_zap_pending(devinfo, DID_NO_CONNECT);
+	kfree(devinfo->tmf_iu);
+	usb_free_urb(devinfo->management_urb);
 
 	scsi_remove_host(shost);
 	uas_free_streams(devinfo);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux