aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 82c2afe4d28a..3833189144ed 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -331,11 +331,10 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk)
331 mutex_lock(&idetape_ref_mutex); 331 mutex_lock(&idetape_ref_mutex);
332 tape = ide_tape_g(disk); 332 tape = ide_tape_g(disk);
333 if (tape) { 333 if (tape) {
334 kref_get(&tape->kref); 334 if (ide_device_get(tape->drive))
335 if (ide_device_get(tape->drive)) {
336 kref_put(&tape->kref, ide_tape_release);
337 tape = NULL; 335 tape = NULL;
338 } 336 else
337 kref_get(&tape->kref);
339 } 338 }
340 mutex_unlock(&idetape_ref_mutex); 339 mutex_unlock(&idetape_ref_mutex);
341 return tape; 340 return tape;
@@ -343,9 +342,11 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk)
343 342
344static void ide_tape_put(struct ide_tape_obj *tape) 343static void ide_tape_put(struct ide_tape_obj *tape)
345{ 344{
345 ide_drive_t *drive = tape->drive;
346
346 mutex_lock(&idetape_ref_mutex); 347 mutex_lock(&idetape_ref_mutex);
347 ide_device_put(tape->drive);
348 kref_put(&tape->kref, ide_tape_release); 348 kref_put(&tape->kref, ide_tape_release);
349 ide_device_put(drive);
349 mutex_unlock(&idetape_ref_mutex); 350 mutex_unlock(&idetape_ref_mutex);
350} 351}
351 352
@@ -2337,7 +2338,7 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
2337{ 2338{
2338 idetape_tape_t *tape = drive->driver_data; 2339 idetape_tape_t *tape = drive->driver_data;
2339 struct ide_atapi_pc pc; 2340 struct ide_atapi_pc pc;
2340 char fw_rev[6], vendor_id[10], product_id[18]; 2341 char fw_rev[4], vendor_id[8], product_id[16];
2341 2342
2342 idetape_create_inquiry_cmd(&pc); 2343 idetape_create_inquiry_cmd(&pc);
2343 if (idetape_queue_pc_tail(drive, &pc)) { 2344 if (idetape_queue_pc_tail(drive, &pc)) {
@@ -2349,11 +2350,11 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
2349 memcpy(product_id, &pc.buf[16], 16); 2350 memcpy(product_id, &pc.buf[16], 16);
2350 memcpy(fw_rev, &pc.buf[32], 4); 2351 memcpy(fw_rev, &pc.buf[32], 4);
2351 2352
2352 ide_fixstring(vendor_id, 10, 0); 2353 ide_fixstring(vendor_id, 8, 0);
2353 ide_fixstring(product_id, 18, 0); 2354 ide_fixstring(product_id, 16, 0);
2354 ide_fixstring(fw_rev, 6, 0); 2355 ide_fixstring(fw_rev, 4, 0);
2355 2356
2356 printk(KERN_INFO "ide-tape: %s <-> %s: %s %s rev %s\n", 2357 printk(KERN_INFO "ide-tape: %s <-> %s: %.8s %.16s rev %.4s\n",
2357 drive->name, tape->name, vendor_id, product_id, fw_rev); 2358 drive->name, tape->name, vendor_id, product_id, fw_rev);
2358} 2359}
2359 2360