aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2007-07-19 11:15:10 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-07-19 13:37:34 -0400
commit80ed71ce1a3369521c693ebf30abb9cfe1dc7e66 (patch)
treef439b74804b10b04a34fe0c3f4c4597f1f7e890a /drivers
parentb02b6bc46571b21a545c9e697df1e226ff22bc81 (diff)
[SCSI] bsg: separate bsg and SCSI (so SCSI can be modular)
This patch moves the bsg registration into SCSI so that bsg no longer has a dependency on the scsi_interface_register API. This can be viewed as a temporary expedient until we can get universal bsg binding sorted out properly. Also use the sdev bus_id as the generic bsg name (to avoid clashes with the queue name). Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/scsi_sysfs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 34e483d31c18..ad5f21fd5d45 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -715,6 +715,7 @@ static int attr_add(struct device *dev, struct device_attribute *attr)
715int scsi_sysfs_add_sdev(struct scsi_device *sdev) 715int scsi_sysfs_add_sdev(struct scsi_device *sdev)
716{ 716{
717 int error, i; 717 int error, i;
718 struct request_queue *rq = sdev->request_queue;
718 719
719 if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0) 720 if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
720 return error; 721 return error;
@@ -734,6 +735,17 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
734 /* take a reference for the sdev_classdev; this is 735 /* take a reference for the sdev_classdev; this is
735 * released by the sdev_class .release */ 736 * released by the sdev_class .release */
736 get_device(&sdev->sdev_gendev); 737 get_device(&sdev->sdev_gendev);
738
739 error = bsg_register_queue(rq, sdev->sdev_gendev.bus_id);
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
737 if (sdev->host->hostt->sdev_attrs) { 749 if (sdev->host->hostt->sdev_attrs) {
738 for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) { 750 for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) {
739 error = attr_add(&sdev->sdev_gendev, 751 error = attr_add(&sdev->sdev_gendev,
@@ -780,6 +792,7 @@ void __scsi_remove_device(struct scsi_device *sdev)
780 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) 792 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
781 return; 793 return;
782 794
795 bsg_unregister_queue(sdev->request_queue);
783 class_device_unregister(&sdev->sdev_classdev); 796 class_device_unregister(&sdev->sdev_classdev);
784 transport_remove_device(dev); 797 transport_remove_device(dev);
785 device_del(dev); 798 device_del(dev);