aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:34 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:34 -0400
commit51509eec34debffec3c6f481f7371c9aeb6c63c1 (patch)
tree94728b2030fadb1f59d5d171541af9518d194366 /drivers/ide/ide-tape.c
parent05236ea6df7419f0f37cf9603cfee265cfce5832 (diff)
ide: add ide_check_atapi_device() helper
* Add ide_check_atapi_device() to ide-atapi.c and convert ide-{floppy,tape}.c to use it instead of ide*_identify_device(). While at it: * Add DRV_NAME defines to ide-{floppy,tape}.c. Cc: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 1fc1c2a6888f..7f56f2003342 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -15,6 +15,8 @@
15 * Documentation/ide/ChangeLog.ide-tape.1995-2002 15 * Documentation/ide/ChangeLog.ide-tape.1995-2002
16 */ 16 */
17 17
18#define DRV_NAME "ide-tape"
19
18#define IDETAPE_VERSION "1.20" 20#define IDETAPE_VERSION "1.20"
19 21
20#include <linux/module.h> 22#include <linux/module.h>
@@ -2296,45 +2298,6 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
2296 return 0; 2298 return 0;
2297} 2299}
2298 2300
2299/*
2300 * check the contents of the ATAPI IDENTIFY command results. We return:
2301 *
2302 * 1 - If the tape can be supported by us, based on the information we have so
2303 * far.
2304 *
2305 * 0 - If this tape driver is not currently supported by us.
2306 */
2307static int idetape_identify_device(ide_drive_t *drive)
2308{
2309 u8 gcw[2], protocol, device_type, removable, packet_size;
2310
2311 if (drive->id_read == 0)
2312 return 1;
2313
2314 *((u16 *)&gcw) = drive->id[ATA_ID_CONFIG];
2315
2316 protocol = (gcw[1] & 0xC0) >> 6;
2317 device_type = gcw[1] & 0x1F;
2318 removable = !!(gcw[0] & 0x80);
2319 packet_size = gcw[0] & 0x3;
2320
2321 /* Check that we can support this device */
2322 if (protocol != 2)
2323 printk(KERN_ERR "ide-tape: Protocol (0x%02x) is not ATAPI\n",
2324 protocol);
2325 else if (device_type != 1)
2326 printk(KERN_ERR "ide-tape: Device type (0x%02x) is not set "
2327 "to tape\n", device_type);
2328 else if (!removable)
2329 printk(KERN_ERR "ide-tape: The removable flag is not set\n");
2330 else if (packet_size != 0) {
2331 printk(KERN_ERR "ide-tape: Packet size (0x%02x) is not 12"
2332 " bytes\n", packet_size);
2333 } else
2334 return 1;
2335 return 0;
2336}
2337
2338static void idetape_get_inquiry_results(ide_drive_t *drive) 2301static void idetape_get_inquiry_results(ide_drive_t *drive)
2339{ 2302{
2340 idetape_tape_t *tape = drive->driver_data; 2303 idetape_tape_t *tape = drive->driver_data;
@@ -2679,7 +2642,7 @@ static int ide_tape_probe(ide_drive_t *drive)
2679 if (drive->media != ide_tape) 2642 if (drive->media != ide_tape)
2680 goto failed; 2643 goto failed;
2681 2644
2682 if (!idetape_identify_device(drive)) { 2645 if (drive->id_read == 1 && !ide_check_atapi_device(drive, DRV_NAME)) {
2683 printk(KERN_ERR "ide-tape: %s: not supported by this version of" 2646 printk(KERN_ERR "ide-tape: %s: not supported by this version of"
2684 " the driver\n", drive->name); 2647 " the driver\n", drive->name);
2685 goto failed; 2648 goto failed;