diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/scsi_priv.h | 1 | ||||
-rw-r--r-- | drivers/scsi/scsi_sysfs.c | 28 |
2 files changed, 16 insertions, 13 deletions
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index ee6de1768e53..d05f778d31a8 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h | |||
@@ -124,6 +124,7 @@ extern void scsi_sysfs_unregister(void); | |||
124 | extern void scsi_sysfs_device_initialize(struct scsi_device *); | 124 | extern void scsi_sysfs_device_initialize(struct scsi_device *); |
125 | extern int scsi_sysfs_target_initialize(struct scsi_device *); | 125 | extern int scsi_sysfs_target_initialize(struct scsi_device *); |
126 | extern struct scsi_transport_template blank_transport_template; | 126 | extern struct scsi_transport_template blank_transport_template; |
127 | extern void __scsi_remove_device(struct scsi_device *); | ||
127 | 128 | ||
128 | extern struct bus_type scsi_bus_type; | 129 | extern struct bus_type scsi_bus_type; |
129 | 130 | ||
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index dae59d1da07a..b8052d5206cc 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -653,7 +653,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
653 | error = attr_add(&sdev->sdev_gendev, | 653 | error = attr_add(&sdev->sdev_gendev, |
654 | sdev->host->hostt->sdev_attrs[i]); | 654 | sdev->host->hostt->sdev_attrs[i]); |
655 | if (error) { | 655 | if (error) { |
656 | scsi_remove_device(sdev); | 656 | __scsi_remove_device(sdev); |
657 | goto out; | 657 | goto out; |
658 | } | 658 | } |
659 | } | 659 | } |
@@ -667,7 +667,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
667 | scsi_sysfs_sdev_attrs[i]); | 667 | scsi_sysfs_sdev_attrs[i]); |
668 | error = device_create_file(&sdev->sdev_gendev, attr); | 668 | error = device_create_file(&sdev->sdev_gendev, attr); |
669 | if (error) { | 669 | if (error) { |
670 | scsi_remove_device(sdev); | 670 | __scsi_remove_device(sdev); |
671 | goto out; | 671 | goto out; |
672 | } | 672 | } |
673 | } | 673 | } |
@@ -687,17 +687,10 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
687 | return error; | 687 | return error; |
688 | } | 688 | } |
689 | 689 | ||
690 | /** | 690 | void __scsi_remove_device(struct scsi_device *sdev) |
691 | * scsi_remove_device - unregister a device from the scsi bus | ||
692 | * @sdev: scsi_device to unregister | ||
693 | **/ | ||
694 | void scsi_remove_device(struct scsi_device *sdev) | ||
695 | { | 691 | { |
696 | struct Scsi_Host *shost = sdev->host; | ||
697 | |||
698 | down(&shost->scan_mutex); | ||
699 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) | 692 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) |
700 | goto out; | 693 | return; |
701 | 694 | ||
702 | class_device_unregister(&sdev->sdev_classdev); | 695 | class_device_unregister(&sdev->sdev_classdev); |
703 | device_del(&sdev->sdev_gendev); | 696 | device_del(&sdev->sdev_gendev); |
@@ -706,8 +699,17 @@ void scsi_remove_device(struct scsi_device *sdev) | |||
706 | sdev->host->hostt->slave_destroy(sdev); | 699 | sdev->host->hostt->slave_destroy(sdev); |
707 | transport_unregister_device(&sdev->sdev_gendev); | 700 | transport_unregister_device(&sdev->sdev_gendev); |
708 | put_device(&sdev->sdev_gendev); | 701 | put_device(&sdev->sdev_gendev); |
709 | out: | 702 | } |
710 | up(&shost->scan_mutex); | 703 | |
704 | /** | ||
705 | * scsi_remove_device - unregister a device from the scsi bus | ||
706 | * @sdev: scsi_device to unregister | ||
707 | **/ | ||
708 | void scsi_remove_device(struct scsi_device *sdev) | ||
709 | { | ||
710 | down(&sdev->host->scan_mutex); | ||
711 | __scsi_remove_device(sdev); | ||
712 | up(&sdev->host->scan_mutex); | ||
711 | } | 713 | } |
712 | EXPORT_SYMBOL(scsi_remove_device); | 714 | EXPORT_SYMBOL(scsi_remove_device); |
713 | 715 | ||