aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index ed720863ab97..34cdce6738a6 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -16,6 +16,7 @@
16#include <scsi/scsi_host.h> 16#include <scsi/scsi_host.h>
17#include <scsi/scsi_tcq.h> 17#include <scsi/scsi_tcq.h>
18#include <scsi/scsi_transport.h> 18#include <scsi/scsi_transport.h>
19#include <scsi/scsi_driver.h>
19 20
20#include "scsi_priv.h" 21#include "scsi_priv.h"
21#include "scsi_logging.h" 22#include "scsi_logging.h"
@@ -714,6 +715,7 @@ static int attr_add(struct device *dev, struct device_attribute *attr)
714int scsi_sysfs_add_sdev(struct scsi_device *sdev) 715int scsi_sysfs_add_sdev(struct scsi_device *sdev)
715{ 716{
716 int error, i; 717 int error, i;
718 struct request_queue *rq = sdev->request_queue;
717 719
718 if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0) 720 if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
719 return error; 721 return error;
@@ -733,6 +735,17 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
733 /* take a reference for the sdev_classdev; this is 735 /* take a reference for the sdev_classdev; this is
734 * released by the sdev_class .release */ 736 * released by the sdev_class .release */
735 get_device(&sdev->sdev_gendev); 737 get_device(&sdev->sdev_gendev);
738
739 error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL);
740
741 if (error)
742 sdev_printk(KERN_INFO, sdev,
743 "Failed to register bsg queue, errno=%d\n", error);
744
745 /* we're treating error on bsg register as non-fatal, so pretend
746 * nothing went wrong */
747 error = 0;
748
736 if (sdev->host->hostt->sdev_attrs) { 749 if (sdev->host->hostt->sdev_attrs) {
737 for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) { 750 for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) {
738 error = attr_add(&sdev->sdev_gendev, 751 error = attr_add(&sdev->sdev_gendev,
@@ -779,6 +792,7 @@ void __scsi_remove_device(struct scsi_device *sdev)
779 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) 792 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
780 return; 793 return;
781 794
795 bsg_unregister_queue(sdev->request_queue);
782 class_device_unregister(&sdev->sdev_classdev); 796 class_device_unregister(&sdev->sdev_classdev);
783 transport_remove_device(dev); 797 transport_remove_device(dev);
784 device_del(dev); 798 device_del(dev);
@@ -803,7 +817,7 @@ void scsi_remove_device(struct scsi_device *sdev)
803} 817}
804EXPORT_SYMBOL(scsi_remove_device); 818EXPORT_SYMBOL(scsi_remove_device);
805 819
806void __scsi_remove_target(struct scsi_target *starget) 820static void __scsi_remove_target(struct scsi_target *starget)
807{ 821{
808 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 822 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
809 unsigned long flags; 823 unsigned long flags;