]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/scsi_sysfs.c
V4L/DVB (3673): Fix budget-av CAM reset
[linux-2.6-omap-h63xx.git] / drivers / scsi / scsi_sysfs.c
index ea7f3a43357235f3287efe594e41f9799b2fa0aa..a6fde52946d68d1f2c5f943b2380185dc71c34c7 100644 (file)
@@ -106,7 +106,10 @@ static int scsi_scan(struct Scsi_Host *shost, const char *str)
                return -EINVAL;
        if (check_set(&lun, s3))
                return -EINVAL;
-       res = scsi_scan_host_selected(shost, channel, id, lun, 1);
+       if (shost->transportt->user_scan)
+               res = shost->transportt->user_scan(shost, channel, id, lun);
+       else
+               res = scsi_scan_host_selected(shost, channel, id, lun, 1);
        return res;
 }
 
@@ -214,8 +217,9 @@ static void scsi_device_cls_release(struct class_device *class_dev)
        put_device(&sdev->sdev_gendev);
 }
 
-static void scsi_device_dev_release(struct device *dev)
+static void scsi_device_dev_release_usercontext(void *data)
 {
+       struct device *dev = data;
        struct scsi_device *sdev;
        struct device *parent;
        struct scsi_target *starget;
@@ -234,6 +238,7 @@ static void scsi_device_dev_release(struct device *dev)
 
        if (sdev->request_queue) {
                sdev->request_queue->queuedata = NULL;
+               /* user context needed to free queue */
                scsi_free_queue(sdev->request_queue);
                /* temporary expedient, try to catch use of queue lock
                 * after free of sdev */
@@ -249,6 +254,13 @@ static void scsi_device_dev_release(struct device *dev)
                put_device(parent);
 }
 
+static void scsi_device_dev_release(struct device *dev)
+{
+       struct scsi_device *sdp = to_scsi_device(dev);
+       execute_in_process_context(scsi_device_dev_release_usercontext, dev,
+                                  &sdp->ew);
+}
+
 static struct class sdev_class = {
        .name           = "scsi_device",
        .release        = scsi_device_cls_release,
@@ -274,7 +286,7 @@ static int scsi_bus_suspend(struct device * dev, pm_message_t state)
                return err;
 
        if (sht->suspend)
-               err = sht->suspend(sdev);
+               err = sht->suspend(sdev, state);
 
        return err;
 }
@@ -745,9 +757,9 @@ void scsi_remove_device(struct scsi_device *sdev)
 {
        struct Scsi_Host *shost = sdev->host;
 
-       down(&shost->scan_mutex);
+       mutex_lock(&shost->scan_mutex);
        __scsi_remove_device(sdev);
-       up(&shost->scan_mutex);
+       mutex_unlock(&shost->scan_mutex);
 }
 EXPORT_SYMBOL(scsi_remove_device);