aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ide-scsi.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-24 16:53:15 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-24 16:53:15 -0400
commit08da591e14cf87247ec09b17c350235157a92fc3 (patch)
treed00a02154071c7013c31bc8dd1d3c12c86d5daca /drivers/scsi/ide-scsi.c
parent6cdf6eb357c2681596b7b1672b92396ba82333d4 (diff)
ide: add ide_device_{get,put}() helpers
* Add 'struct ide_host *host' field to ide_hwif_t and set it in ide_host_alloc_all(). * Add ide_device_{get,put}() helpers loosely based on SCSI's scsi_device_{get,put}() ones. * Convert IDE device drivers to use ide_device_{get,put}(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/scsi/ide-scsi.c')
-rw-r--r--drivers/scsi/ide-scsi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 538552495d48..318ef382448f 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -101,8 +101,13 @@ static struct ide_scsi_obj *ide_scsi_get(struct gendisk *disk)
101 101
102 mutex_lock(&idescsi_ref_mutex); 102 mutex_lock(&idescsi_ref_mutex);
103 scsi = ide_scsi_g(disk); 103 scsi = ide_scsi_g(disk);
104 if (scsi) 104 if (scsi) {
105 scsi_host_get(scsi->host); 105 scsi_host_get(scsi->host);
106 if (ide_device_get(scsi->drive)) {
107 scsi_host_put(scsi->host);
108 scsi = NULL;
109 }
110 }
106 mutex_unlock(&idescsi_ref_mutex); 111 mutex_unlock(&idescsi_ref_mutex);
107 return scsi; 112 return scsi;
108} 113}
@@ -110,6 +115,7 @@ static struct ide_scsi_obj *ide_scsi_get(struct gendisk *disk)
110static void ide_scsi_put(struct ide_scsi_obj *scsi) 115static void ide_scsi_put(struct ide_scsi_obj *scsi)
111{ 116{
112 mutex_lock(&idescsi_ref_mutex); 117 mutex_lock(&idescsi_ref_mutex);
118 ide_device_put(scsi->drive);
113 scsi_host_put(scsi->host); 119 scsi_host_put(scsi->host);
114 mutex_unlock(&idescsi_ref_mutex); 120 mutex_unlock(&idescsi_ref_mutex);
115} 121}