diff options
| -rw-r--r-- | drivers/scsi/scsi.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index e02885451425..9b3829931f40 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
| @@ -986,9 +986,9 @@ int scsi_device_get(struct scsi_device *sdev) | |||
| 986 | return -ENXIO; | 986 | return -ENXIO; |
| 987 | if (!get_device(&sdev->sdev_gendev)) | 987 | if (!get_device(&sdev->sdev_gendev)) |
| 988 | return -ENXIO; | 988 | return -ENXIO; |
| 989 | /* We can fail this if we're doing SCSI operations | 989 | /* We can fail try_module_get if we're doing SCSI operations |
| 990 | * from module exit (like cache flush) */ | 990 | * from module exit (like cache flush) */ |
| 991 | try_module_get(sdev->host->hostt->module); | 991 | __module_get(sdev->host->hostt->module); |
| 992 | 992 | ||
| 993 | return 0; | 993 | return 0; |
| 994 | } | 994 | } |
| @@ -1004,14 +1004,7 @@ EXPORT_SYMBOL(scsi_device_get); | |||
| 1004 | */ | 1004 | */ |
| 1005 | void scsi_device_put(struct scsi_device *sdev) | 1005 | void scsi_device_put(struct scsi_device *sdev) |
| 1006 | { | 1006 | { |
| 1007 | #ifdef CONFIG_MODULE_UNLOAD | 1007 | module_put(sdev->host->hostt->module); |
| 1008 | struct module *module = sdev->host->hostt->module; | ||
| 1009 | |||
| 1010 | /* The module refcount will be zero if scsi_device_get() | ||
| 1011 | * was called from a module removal routine */ | ||
| 1012 | if (module && module_refcount(module) != 0) | ||
| 1013 | module_put(module); | ||
| 1014 | #endif | ||
| 1015 | put_device(&sdev->sdev_gendev); | 1008 | put_device(&sdev->sdev_gendev); |
| 1016 | } | 1009 | } |
| 1017 | EXPORT_SYMBOL(scsi_device_put); | 1010 | EXPORT_SYMBOL(scsi_device_put); |
