Commit 088b1b88 authored by Borislav Petkov's avatar Borislav Petkov Committed by Bartlomiej Zolnierkiewicz

ide: improve debugging scheme

and more specifically, push __func__ into debug
macro thus making ide_debug_log() calls shorter and more readable.
Signed-off-by: default avatarBorislav Petkov <petkovbb@gmail.com>
parent 70775e9c
This diff is collapsed.
......@@ -11,7 +11,7 @@
#define IDECD_DEBUG_LOG 0
#if IDECD_DEBUG_LOG
#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args)
#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args)
#else
#define ide_debug_log(lvl, fmt, args...) do {} while (0)
#endif
......
......@@ -74,7 +74,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
struct request *rq = drive->hwif->rq;
int error;
ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
ide_debug_log(IDE_DBG_FUNC, "enter");
switch (uptodate) {
case 0:
......@@ -121,7 +121,7 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
struct ide_atapi_pc *pc = drive->pc;
int uptodate = pc->error ? 0 : 1;
ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
ide_debug_log(IDE_DBG_FUNC, "enter");
if (floppy->failed_pc == pc)
floppy->failed_pc = NULL;
......@@ -140,11 +140,11 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
(u16)get_unaligned((u16 *)&buf[16]) : 0x10000;
if (floppy->failed_pc)
ide_debug_log(IDE_DBG_PC, "pc = %x, ",
ide_debug_log(IDE_DBG_PC, "pc = %x",
floppy->failed_pc->c[0]);
ide_debug_log(IDE_DBG_SENSE, "sense key = %x, asc = %x,"
"ascq = %x\n", floppy->sense_key,
"ascq = %x", floppy->sense_key,
floppy->asc, floppy->ascq);
} else
printk(KERN_ERR PFX "Error in REQUEST SENSE itself - "
......@@ -193,7 +193,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
return ide_stopped;
}
ide_debug_log(IDE_DBG_FUNC, "%s: Retry #%d\n", __func__, pc->retries);
ide_debug_log(IDE_DBG_FUNC, "retry #%d", pc->retries);
pc->retries++;
......@@ -242,8 +242,7 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive,
int blocks = rq->nr_sectors / floppy->bs_factor;
int cmd = rq_data_dir(rq);
ide_debug_log(IDE_DBG_FUNC, "%s: block: %d, blocks: %d\n", __func__,
block, blocks);
ide_debug_log(IDE_DBG_FUNC, "block: %d, blocks: %d", block, blocks);
ide_init_pc(pc);
pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10;
......@@ -287,15 +286,10 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
ide_hwif_t *hwif = drive->hwif;
struct ide_atapi_pc *pc;
ide_debug_log(IDE_DBG_FUNC, "%s: dev: %s, cmd: 0x%x, cmd_type: %x, "
"errors: %d\n",
__func__, rq->rq_disk ? rq->rq_disk->disk_name : "?",
rq->cmd[0], rq->cmd_type, rq->errors);
ide_debug_log(IDE_DBG_FUNC, "%s: sector: %ld, nr_sectors: %ld, "
"current_nr_sectors: %d\n",
__func__, (long)rq->sector, rq->nr_sectors,
rq->current_nr_sectors);
if (drive->debug_mask & IDE_DBG_RQ)
blk_dump_rq_flags(rq, (rq->rq_disk
? rq->rq_disk->disk_name
: "dev?"));
if (rq->errors >= ERROR_MAX) {
if (floppy->failed_pc)
......@@ -438,8 +432,9 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
length = be16_to_cpup((__be16 *)&pc.buf[desc_start + 6]);
ide_debug_log(IDE_DBG_PROBE, "Descriptor %d: %dkB, %d blocks, "
"%d sector size\n",
i, blocks * length / 1024, blocks, length);
"%d sector size",
i, blocks * length / 1024,
blocks, length);
if (i)
continue;
......@@ -495,7 +490,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
"in drive\n", drive->name);
break;
}
ide_debug_log(IDE_DBG_PROBE, "Descriptor 0 Code: %d\n",
ide_debug_log(IDE_DBG_PROBE, "Descriptor 0 Code: %d",
pc.buf[desc_start + 4] & 0x03);
}
......
......@@ -182,7 +182,7 @@ static int ide_gd_open(struct block_device *bdev, fmode_t mode)
drive = idkp->drive;
ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
ide_debug_log(IDE_DBG_FUNC, "enter");
idkp->openers++;
......@@ -232,7 +232,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode)
struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
ide_drive_t *drive = idkp->drive;
ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
ide_debug_log(IDE_DBG_FUNC, "enter");
if (idkp->openers == 1)
drive->disk_ops->flush(drive);
......
......@@ -8,7 +8,7 @@
#define IDE_GD_DEBUG_LOG 0
#if IDE_GD_DEBUG_LOG
#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args)
#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args)
#else
#define ide_debug_log(lvl, fmt, args...) do {} while (0)
#endif
......
......@@ -1048,7 +1048,8 @@ enum {
#define __ide_debug_log(lvl, fmt, args...) \
{ \
if (unlikely(drive->debug_mask & lvl)) \
printk(KERN_INFO DRV_NAME ": " fmt, ## args); \
printk(KERN_INFO DRV_NAME ": %s: " fmt "\n", \
__func__, ## args); \
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment