diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-07-26 10:20:53 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-09-09 11:28:17 -0400 |
commit | 903f4fed858a7b56b260cbd55d174fe54d188fb7 (patch) | |
tree | c687e5605cb64982e57e8607e884b91cfe869946 /drivers/scsi/scsi_sysfs.c | |
parent | e517d3133f62c27b211f305a6dbd6f6ccac0db1b (diff) |
[SCSI] fix callers of scsi_remove_device() who already hold the scan muted
This patch (as544) adds a private entry point to scsi_remove_device, for
use when callers already own the scan_mutex. The appropriate callers are
modified to use the new entry point.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r-- | drivers/scsi/scsi_sysfs.c | 28 |
1 files changed, 15 insertions, 13 deletions
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 | ||