aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@googlemail.com>2009-07-17 19:55:16 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-07 13:42:57 -0400
commite972d7027c0fb7055f5f2fe02d662c9528063bef (patch)
tree47dfac8825a9299332d3c41d9b674dbc01039ac9 /drivers/ide
parent37bbe084d1152cb580d2cc88b4eda2004506a141 (diff)
ide-tape: convert to ide_debug_log macro
Remove tape->debug_mask and use drive->debug_mask instead. There should be no functional change resulting from this patch. Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-tape.c102
1 files changed, 49 insertions, 53 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 1d74f159bcc4..3468ece98496 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -47,28 +47,13 @@
47#include <asm/unaligned.h> 47#include <asm/unaligned.h>
48#include <linux/mtio.h> 48#include <linux/mtio.h>
49 49
50enum {
51 /* output errors only */
52 DBG_ERR = (1 << 0),
53 /* output all sense key/asc */
54 DBG_SENSE = (1 << 1),
55 /* info regarding all chrdev-related procedures */
56 DBG_CHRDEV = (1 << 2),
57 /* all remaining procedures */
58 DBG_PROCS = (1 << 3),
59};
60
61/* define to see debug info */ 50/* define to see debug info */
62#define IDETAPE_DEBUG_LOG 0 51#undef IDETAPE_DEBUG_LOG
63 52
64#if IDETAPE_DEBUG_LOG 53#ifdef IDETAPE_DEBUG_LOG
65#define debug_log(lvl, fmt, args...) \ 54#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args)
66{ \
67 if (tape->debug_mask & lvl) \
68 printk(KERN_INFO "ide-tape: " fmt, ## args); \
69}
70#else 55#else
71#define debug_log(lvl, fmt, args...) do {} while (0) 56#define ide_debug_log(lvl, fmt, args...) do {} while (0)
72#endif 57#endif
73 58
74/**************************** Tunable parameters *****************************/ 59/**************************** Tunable parameters *****************************/
@@ -230,8 +215,6 @@ typedef struct ide_tape_obj {
230 char drv_write_prot; 215 char drv_write_prot;
231 /* the tape is write protected (hardware or opened as read-only) */ 216 /* the tape is write protected (hardware or opened as read-only) */
232 char write_prot; 217 char write_prot;
233
234 u32 debug_mask;
235} idetape_tape_t; 218} idetape_tape_t;
236 219
237static DEFINE_MUTEX(idetape_ref_mutex); 220static DEFINE_MUTEX(idetape_ref_mutex);
@@ -290,8 +273,9 @@ static void idetape_analyze_error(ide_drive_t *drive)
290 tape->asc = sense[12]; 273 tape->asc = sense[12];
291 tape->ascq = sense[13]; 274 tape->ascq = sense[13];
292 275
293 debug_log(DBG_ERR, "pc = %x, sense key = %x, asc = %x, ascq = %x\n", 276 ide_debug_log(IDE_DBG_FUNC,
294 pc->c[0], tape->sense_key, tape->asc, tape->ascq); 277 "cmd: 0x%x, sense key = %x, asc = %x, ascq = %x",
278 rq->cmd[0], tape->sense_key, tape->asc, tape->ascq);
295 279
296 /* correct remaining bytes to transfer */ 280 /* correct remaining bytes to transfer */
297 if (pc->flags & PC_FLAG_DMA_ERROR) 281 if (pc->flags & PC_FLAG_DMA_ERROR)
@@ -344,7 +328,8 @@ static int ide_tape_callback(ide_drive_t *drive, int dsc)
344 int uptodate = pc->error ? 0 : 1; 328 int uptodate = pc->error ? 0 : 1;
345 int err = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; 329 int err = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
346 330
347 debug_log(DBG_PROCS, "Enter %s\n", __func__); 331 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, dsc: %d, err: %d", rq->cmd[0],
332 dsc, err);
348 333
349 if (dsc) 334 if (dsc)
350 ide_tape_handle_dsc(drive); 335 ide_tape_handle_dsc(drive);
@@ -390,10 +375,12 @@ static int ide_tape_callback(ide_drive_t *drive, int dsc)
390static void idetape_postpone_request(ide_drive_t *drive) 375static void idetape_postpone_request(ide_drive_t *drive)
391{ 376{
392 idetape_tape_t *tape = drive->driver_data; 377 idetape_tape_t *tape = drive->driver_data;
378 struct request *rq = drive->hwif->rq;
393 379
394 debug_log(DBG_PROCS, "Enter %s\n", __func__); 380 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, dsc_poll_freq: %lu",
381 rq->cmd[0], tape->dsc_poll_freq);
395 382
396 tape->postponed_rq = drive->hwif->rq; 383 tape->postponed_rq = rq;
397 384
398 ide_stall_queue(drive, tape->dsc_poll_freq); 385 ide_stall_queue(drive, tape->dsc_poll_freq);
399} 386}
@@ -488,7 +475,8 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive,
488 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); 475 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq));
489 return ide_stopped; 476 return ide_stopped;
490 } 477 }
491 debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]); 478 ide_debug_log(IDE_DBG_SENSE, "retry #%d, cmd: 0x%02x", pc->retries,
479 pc->c[0]);
492 480
493 pc->retries++; 481 pc->retries++;
494 482
@@ -583,8 +571,9 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
583 struct ide_cmd cmd; 571 struct ide_cmd cmd;
584 u8 stat; 572 u8 stat;
585 573
586 debug_log(DBG_SENSE, "sector: %llu, nr_sectors: %u\n", 574 ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, sector: %llu, nr_sectors: %u",
587 (unsigned long long)blk_rq_pos(rq), blk_rq_sectors(rq)); 575 rq->cmd[0], (unsigned long long)blk_rq_pos(rq),
576 blk_rq_sectors(rq));
588 577
589 BUG_ON(!(blk_special_request(rq) || blk_sense_request(rq))); 578 BUG_ON(!(blk_special_request(rq) || blk_sense_request(rq)));
590 579
@@ -745,7 +734,7 @@ static int ide_tape_read_position(ide_drive_t *drive)
745 struct ide_atapi_pc pc; 734 struct ide_atapi_pc pc;
746 u8 buf[20]; 735 u8 buf[20];
747 736
748 debug_log(DBG_PROCS, "Enter %s\n", __func__); 737 ide_debug_log(IDE_DBG_FUNC, "enter");
749 738
750 /* prep cmd */ 739 /* prep cmd */
751 ide_init_pc(&pc); 740 ide_init_pc(&pc);
@@ -756,9 +745,9 @@ static int ide_tape_read_position(ide_drive_t *drive)
756 return -1; 745 return -1;
757 746
758 if (!pc.error) { 747 if (!pc.error) {
759 debug_log(DBG_SENSE, "BOP - %s\n", 748 ide_debug_log(IDE_DBG_FUNC, "BOP - %s",
760 (buf[0] & 0x80) ? "Yes" : "No"); 749 (buf[0] & 0x80) ? "Yes" : "No");
761 debug_log(DBG_SENSE, "EOP - %s\n", 750 ide_debug_log(IDE_DBG_FUNC, "EOP - %s",
762 (buf[0] & 0x40) ? "Yes" : "No"); 751 (buf[0] & 0x40) ? "Yes" : "No");
763 752
764 if (buf[0] & 0x4) { 753 if (buf[0] & 0x4) {
@@ -768,8 +757,8 @@ static int ide_tape_read_position(ide_drive_t *drive)
768 &drive->atapi_flags); 757 &drive->atapi_flags);
769 return -1; 758 return -1;
770 } else { 759 } else {
771 debug_log(DBG_SENSE, "Block Location - %u\n", 760 ide_debug_log(IDE_DBG_FUNC, "Block Location: %u",
772 be32_to_cpup((__be32 *)&buf[4])); 761 be32_to_cpup((__be32 *)&buf[4]));
773 762
774 tape->partition = buf[1]; 763 tape->partition = buf[1];
775 tape->first_frame = be32_to_cpup((__be32 *)&buf[4]); 764 tape->first_frame = be32_to_cpup((__be32 *)&buf[4]);
@@ -866,7 +855,8 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size)
866 struct request *rq; 855 struct request *rq;
867 int ret; 856 int ret;
868 857
869 debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd); 858 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, size: %d", cmd, size);
859
870 BUG_ON(cmd != REQ_IDETAPE_READ && cmd != REQ_IDETAPE_WRITE); 860 BUG_ON(cmd != REQ_IDETAPE_READ && cmd != REQ_IDETAPE_WRITE);
871 BUG_ON(size < 0 || size % tape->blk_size); 861 BUG_ON(size < 0 || size % tape->blk_size);
872 862
@@ -1029,7 +1019,7 @@ static int idetape_rewind_tape(ide_drive_t *drive)
1029 struct ide_atapi_pc pc; 1019 struct ide_atapi_pc pc;
1030 int ret; 1020 int ret;
1031 1021
1032 debug_log(DBG_SENSE, "Enter %s\n", __func__); 1022 ide_debug_log(IDE_DBG_FUNC, "enter");
1033 1023
1034 idetape_create_rewind_cmd(drive, &pc); 1024 idetape_create_rewind_cmd(drive, &pc);
1035 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 1025 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0);
@@ -1055,7 +1045,7 @@ static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd,
1055 int nr_stages; 1045 int nr_stages;
1056 } config; 1046 } config;
1057 1047
1058 debug_log(DBG_PROCS, "Enter %s\n", __func__); 1048 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%04x", cmd);
1059 1049
1060 switch (cmd) { 1050 switch (cmd) {
1061 case 0x0340: 1051 case 0x0340:
@@ -1085,6 +1075,9 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op,
1085 int retval, count = 0; 1075 int retval, count = 0;
1086 int sprev = !!(tape->caps[4] & 0x20); 1076 int sprev = !!(tape->caps[4] & 0x20);
1087 1077
1078
1079 ide_debug_log(IDE_DBG_FUNC, "mt_op: %d, mt_count: %d", mt_op, mt_count);
1080
1088 if (mt_count == 0) 1081 if (mt_count == 0)
1089 return 0; 1082 return 0;
1090 if (MTBSF == mt_op || MTBSFM == mt_op) { 1083 if (MTBSF == mt_op || MTBSFM == mt_op) {
@@ -1148,7 +1141,7 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf,
1148 ssize_t ret = 0; 1141 ssize_t ret = 0;
1149 int rc; 1142 int rc;
1150 1143
1151 debug_log(DBG_CHRDEV, "Enter %s, count %Zd\n", __func__, count); 1144 ide_debug_log(IDE_DBG_FUNC, "count %Zd", count);
1152 1145
1153 if (tape->chrdev_dir != IDETAPE_DIR_READ) { 1146 if (tape->chrdev_dir != IDETAPE_DIR_READ) {
1154 if (test_bit(ilog2(IDE_AFLAG_DETECT_BS), &drive->atapi_flags)) 1147 if (test_bit(ilog2(IDE_AFLAG_DETECT_BS), &drive->atapi_flags))
@@ -1187,8 +1180,6 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf,
1187 } 1180 }
1188 1181
1189 if (!done && test_bit(ilog2(IDE_AFLAG_FILEMARK), &drive->atapi_flags)) { 1182 if (!done && test_bit(ilog2(IDE_AFLAG_FILEMARK), &drive->atapi_flags)) {
1190 debug_log(DBG_SENSE, "%s: spacing over filemark\n", tape->name);
1191
1192 idetape_space_over_filemarks(drive, MTFSF, 1); 1183 idetape_space_over_filemarks(drive, MTFSF, 1);
1193 return 0; 1184 return 0;
1194 } 1185 }
@@ -1209,7 +1200,7 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf,
1209 if (tape->write_prot) 1200 if (tape->write_prot)
1210 return -EACCES; 1201 return -EACCES;
1211 1202
1212 debug_log(DBG_CHRDEV, "Enter %s, count %Zd\n", __func__, count); 1203 ide_debug_log(IDE_DBG_FUNC, "count %Zd", count);
1213 1204
1214 /* Initialize write operation */ 1205 /* Initialize write operation */
1215 rc = idetape_init_rw(drive, IDETAPE_DIR_WRITE); 1206 rc = idetape_init_rw(drive, IDETAPE_DIR_WRITE);
@@ -1273,8 +1264,8 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count)
1273 struct ide_atapi_pc pc; 1264 struct ide_atapi_pc pc;
1274 int i, retval; 1265 int i, retval;
1275 1266
1276 debug_log(DBG_ERR, "Handling MTIOCTOP ioctl: mt_op=%d, mt_count=%d\n", 1267 ide_debug_log(IDE_DBG_FUNC, "MTIOCTOP ioctl: mt_op: %d, mt_count: %d",
1277 mt_op, mt_count); 1268 mt_op, mt_count);
1278 1269
1279 switch (mt_op) { 1270 switch (mt_op) {
1280 case MTFSF: 1271 case MTFSF:
@@ -1393,7 +1384,7 @@ static int idetape_chrdev_ioctl(struct inode *inode, struct file *file,
1393 int block_offset = 0, position = tape->first_frame; 1384 int block_offset = 0, position = tape->first_frame;
1394 void __user *argp = (void __user *)arg; 1385 void __user *argp = (void __user *)arg;
1395 1386
1396 debug_log(DBG_CHRDEV, "Enter %s, cmd=%u\n", __func__, cmd); 1387 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x", cmd);
1397 1388
1398 if (tape->chrdev_dir == IDETAPE_DIR_WRITE) { 1389 if (tape->chrdev_dir == IDETAPE_DIR_WRITE) {
1399 ide_tape_flush_merge_buffer(drive); 1390 ide_tape_flush_merge_buffer(drive);
@@ -1461,6 +1452,9 @@ static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive)
1461 (buf[4 + 6] << 8) + 1452 (buf[4 + 6] << 8) +
1462 buf[4 + 7]; 1453 buf[4 + 7];
1463 tape->drv_write_prot = (buf[2] & 0x80) >> 7; 1454 tape->drv_write_prot = (buf[2] & 0x80) >> 7;
1455
1456 ide_debug_log(IDE_DBG_FUNC, "blk_size: %d, write_prot: %d",
1457 tape->blk_size, tape->drv_write_prot);
1464} 1458}
1465 1459
1466static int idetape_chrdev_open(struct inode *inode, struct file *filp) 1460static int idetape_chrdev_open(struct inode *inode, struct file *filp)
@@ -1480,7 +1474,10 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
1480 return -ENXIO; 1474 return -ENXIO;
1481 } 1475 }
1482 1476
1483 debug_log(DBG_CHRDEV, "Enter %s\n", __func__); 1477 drive = tape->drive;
1478 filp->private_data = tape;
1479
1480 ide_debug_log(IDE_DBG_FUNC, "enter");
1484 1481
1485 /* 1482 /*
1486 * We really want to do nonseekable_open(inode, filp); here, but some 1483 * We really want to do nonseekable_open(inode, filp); here, but some
@@ -1489,9 +1486,6 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
1489 */ 1486 */
1490 filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); 1487 filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
1491 1488
1492 drive = tape->drive;
1493
1494 filp->private_data = tape;
1495 1489
1496 if (test_and_set_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags)) { 1490 if (test_and_set_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags)) {
1497 retval = -EBUSY; 1491 retval = -EBUSY;
@@ -1570,7 +1564,7 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
1570 lock_kernel(); 1564 lock_kernel();
1571 tape = drive->driver_data; 1565 tape = drive->driver_data;
1572 1566
1573 debug_log(DBG_CHRDEV, "Enter %s\n", __func__); 1567 ide_debug_log(IDE_DBG_FUNC, "enter");
1574 1568
1575 if (tape->chrdev_dir == IDETAPE_DIR_WRITE) 1569 if (tape->chrdev_dir == IDETAPE_DIR_WRITE)
1576 idetape_write_release(drive, minor); 1570 idetape_write_release(drive, minor);
@@ -1707,7 +1701,6 @@ static int divf_buffer_size(ide_drive_t *drive) { return 1024; }
1707 1701
1708ide_devset_rw_flag(dsc_overlap, IDE_DFLAG_DSC_OVERLAP); 1702ide_devset_rw_flag(dsc_overlap, IDE_DFLAG_DSC_OVERLAP);
1709 1703
1710ide_tape_devset_rw_field(debug_mask, debug_mask);
1711ide_tape_devset_rw_field(tdsc, best_dsc_rw_freq); 1704ide_tape_devset_rw_field(tdsc, best_dsc_rw_freq);
1712 1705
1713ide_tape_devset_r_field(avg_speed, avg_speed); 1706ide_tape_devset_r_field(avg_speed, avg_speed);
@@ -1719,7 +1712,6 @@ static const struct ide_proc_devset idetape_settings[] = {
1719 __IDE_PROC_DEVSET(avg_speed, 0, 0xffff, NULL, NULL), 1712 __IDE_PROC_DEVSET(avg_speed, 0, 0xffff, NULL, NULL),
1720 __IDE_PROC_DEVSET(buffer, 0, 0xffff, NULL, divf_buffer), 1713 __IDE_PROC_DEVSET(buffer, 0, 0xffff, NULL, divf_buffer),
1721 __IDE_PROC_DEVSET(buffer_size, 0, 0xffff, NULL, divf_buffer_size), 1714 __IDE_PROC_DEVSET(buffer_size, 0, 0xffff, NULL, divf_buffer_size),
1722 __IDE_PROC_DEVSET(debug_mask, 0, 0xffff, NULL, NULL),
1723 __IDE_PROC_DEVSET(dsc_overlap, 0, 1, NULL, NULL), 1715 __IDE_PROC_DEVSET(dsc_overlap, 0, 1, NULL, NULL),
1724 __IDE_PROC_DEVSET(speed, 0, 0xffff, NULL, NULL), 1716 __IDE_PROC_DEVSET(speed, 0, 0xffff, NULL, NULL),
1725 __IDE_PROC_DEVSET(tdsc, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX, 1717 __IDE_PROC_DEVSET(tdsc, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX,
@@ -1746,7 +1738,9 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
1746 int buffer_size; 1738 int buffer_size;
1747 u16 *ctl = (u16 *)&tape->caps[12]; 1739 u16 *ctl = (u16 *)&tape->caps[12];
1748 1740
1749 drive->pc_callback = ide_tape_callback; 1741 ide_debug_log(IDE_DBG_FUNC, "minor: %d", minor);
1742
1743 drive->pc_callback = ide_tape_callback;
1750 1744
1751 drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; 1745 drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP;
1752 1746
@@ -1932,7 +1926,9 @@ static int ide_tape_probe(ide_drive_t *drive)
1932 struct gendisk *g; 1926 struct gendisk *g;
1933 int minor; 1927 int minor;
1934 1928
1935 if (!strstr("ide-tape", drive->driver_req)) 1929 ide_debug_log(IDE_DBG_FUNC, "enter");
1930
1931 if (!strstr(DRV_NAME, drive->driver_req))
1936 goto failed; 1932 goto failed;
1937 1933
1938 if (drive->media != ide_tape) 1934 if (drive->media != ide_tape)