diff options
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r-- | drivers/scsi/scsi_sysfs.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 5a065055e68a..19ec9e2d3f39 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -847,6 +847,8 @@ static int scsi_target_add(struct scsi_target *starget) | |||
847 | if (starget->state != STARGET_CREATED) | 847 | if (starget->state != STARGET_CREATED) |
848 | return 0; | 848 | return 0; |
849 | 849 | ||
850 | device_enable_async_suspend(&starget->dev); | ||
851 | |||
850 | error = device_add(&starget->dev); | 852 | error = device_add(&starget->dev); |
851 | if (error) { | 853 | if (error) { |
852 | dev_err(&starget->dev, "target device_add failed, error %d\n", error); | 854 | dev_err(&starget->dev, "target device_add failed, error %d\n", error); |
@@ -878,7 +880,8 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
878 | struct request_queue *rq = sdev->request_queue; | 880 | struct request_queue *rq = sdev->request_queue; |
879 | struct scsi_target *starget = sdev->sdev_target; | 881 | struct scsi_target *starget = sdev->sdev_target; |
880 | 882 | ||
881 | if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0) | 883 | error = scsi_device_set_state(sdev, SDEV_RUNNING); |
884 | if (error) | ||
882 | return error; | 885 | return error; |
883 | 886 | ||
884 | error = scsi_target_add(starget); | 887 | error = scsi_target_add(starget); |
@@ -886,16 +889,18 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
886 | return error; | 889 | return error; |
887 | 890 | ||
888 | transport_configure_device(&starget->dev); | 891 | transport_configure_device(&starget->dev); |
892 | device_enable_async_suspend(&sdev->sdev_gendev); | ||
889 | error = device_add(&sdev->sdev_gendev); | 893 | error = device_add(&sdev->sdev_gendev); |
890 | if (error) { | 894 | if (error) { |
891 | printk(KERN_INFO "error 1\n"); | 895 | printk(KERN_INFO "error 1\n"); |
892 | goto out_remove; | 896 | return error; |
893 | } | 897 | } |
898 | device_enable_async_suspend(&sdev->sdev_dev); | ||
894 | error = device_add(&sdev->sdev_dev); | 899 | error = device_add(&sdev->sdev_dev); |
895 | if (error) { | 900 | if (error) { |
896 | printk(KERN_INFO "error 2\n"); | 901 | printk(KERN_INFO "error 2\n"); |
897 | device_del(&sdev->sdev_gendev); | 902 | device_del(&sdev->sdev_gendev); |
898 | goto out_remove; | 903 | return error; |
899 | } | 904 | } |
900 | transport_add_device(&sdev->sdev_gendev); | 905 | transport_add_device(&sdev->sdev_gendev); |
901 | sdev->is_visible = 1; | 906 | sdev->is_visible = 1; |
@@ -910,14 +915,14 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
910 | else | 915 | else |
911 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_depth); | 916 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_depth); |
912 | if (error) | 917 | if (error) |
913 | goto out_remove; | 918 | return error; |
914 | 919 | ||
915 | if (sdev->host->hostt->change_queue_type) | 920 | if (sdev->host->hostt->change_queue_type) |
916 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_type_rw); | 921 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_type_rw); |
917 | else | 922 | else |
918 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_type); | 923 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_type); |
919 | if (error) | 924 | if (error) |
920 | goto out_remove; | 925 | return error; |
921 | 926 | ||
922 | error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL); | 927 | error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL); |
923 | 928 | ||
@@ -933,16 +938,11 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
933 | error = device_create_file(&sdev->sdev_gendev, | 938 | error = device_create_file(&sdev->sdev_gendev, |
934 | sdev->host->hostt->sdev_attrs[i]); | 939 | sdev->host->hostt->sdev_attrs[i]); |
935 | if (error) | 940 | if (error) |
936 | goto out_remove; | 941 | return error; |
937 | } | 942 | } |
938 | } | 943 | } |
939 | 944 | ||
940 | return 0; | ||
941 | |||
942 | out_remove: | ||
943 | __scsi_remove_device(sdev); | ||
944 | return error; | 945 | return error; |
945 | |||
946 | } | 946 | } |
947 | 947 | ||
948 | void __scsi_remove_device(struct scsi_device *sdev) | 948 | void __scsi_remove_device(struct scsi_device *sdev) |