#define DRIVER_NAME "pktcdvd"
+#define pkt_err(pd, fmt, ...) \
+ pr_err("%s: " fmt, pd->name, ##__VA_ARGS__)
+
#define pkt_dbg(level, pd, fmt, ...) \
do { \
if (level == 2 && PACKET_DEBUG >= 2) \
set_bit(PACKET_MERGE_SEGS, &pd->flags);
return 0;
} else {
- pr_err("cdrom max_phys_segments too small\n");
+ pkt_err(pd, "cdrom max_phys_segments too small\n");
return -EIO;
}
}
/*
* paranoia
*/
- pr_err("write mode wrong %d\n", wp->data_block_type);
+ pkt_err(pd, "write mode wrong %d\n", wp->data_block_type);
return 1;
}
wp->packet_size = cpu_to_be32(pd->settings.size >> 2);
if (ti->rt == 1 && ti->blank == 0)
return 1;
- pr_err("bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet);
+ pkt_err(pd, "bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet);
return 0;
}
}
if (di->disc_type != 0x20 && di->disc_type != 0) {
- pr_err("wrong disc type (%x)\n", di->disc_type);
+ pkt_err(pd, "wrong disc type (%x)\n", di->disc_type);
return 0;
}
}
if (di->border_status == PACKET_SESSION_RESERVED) {
- pr_err("can't write to last track (reserved)\n");
+ pkt_err(pd, "can't write to last track (reserved)\n");
return 0;
}
memset(&ti, 0, sizeof(track_information));
if ((ret = pkt_get_disc_info(pd, &di))) {
- pr_err("failed get_disc\n");
+ pkt_err(pd, "failed get_disc\n");
return ret;
}
track = 1; /* (di.last_track_msb << 8) | di.last_track_lsb; */
if ((ret = pkt_get_track_info(pd, track, 1, &ti))) {
- pr_err("failed get_track\n");
+ pkt_err(pd, "failed get_track\n");
return ret;
}
if (!pkt_writable_track(pd, &ti)) {
- pr_err("can't write to this track\n");
+ pkt_err(pd, "can't write to this track\n");
return -EROFS;
}
return -ENXIO;
}
if (pd->settings.size > PACKET_MAX_SECTORS) {
- pr_err("packet size is too big\n");
+ pkt_err(pd, "packet size is too big\n");
return -EROFS;
}
pd->settings.fp = ti.fp;
pd->settings.block_mode = PACKET_BLOCK_MODE2;
break;
default:
- pr_err("unknown data mode\n");
+ pkt_err(pd, "unknown data mode\n");
return -EROFS;
}
return 0;
cgc.buflen = cgc.cmd[8] = 2 + ((buf[0] << 8) | (buf[1] & 0xff));
ret = pkt_mode_select(pd, &cgc);
if (ret) {
- pr_err("write caching control failed\n");
+ pkt_err(pd, "write caching control failed\n");
pkt_dump_sense(&cgc);
} else if (!ret && set)
pr_notice("enabled write caching on %s\n", pd->name);
goto out;
if ((ret = pkt_get_last_written(pd, &lba))) {
- pr_err("pkt_get_last_written failed\n");
+ pkt_err(pd, "pkt_get_last_written failed\n");
goto out_putdev;
}
if (write) {
if (!pkt_grow_pktlist(pd, CONFIG_CDROM_PKTCDVD_BUFFERS)) {
- pr_err("not enough memory for buffers\n");
+ pkt_err(pd, "not enough memory for buffers\n");
ret = -ENOMEM;
goto out_putdev;
}
pd = q->queuedata;
if (!pd) {
- pr_err("%s incorrect request queue\n",
- bdevname(bio->bi_bdev, b));
+ pkt_err(pd, "%s incorrect request queue\n",
+ bdevname(bio->bi_bdev, b));
goto end_io;
}
}
if (!bio->bi_size || (bio->bi_size % CD_FRAMESIZE)) {
- pr_err("wrong bio size\n");
+ pkt_err(pd, "wrong bio size\n");
goto end_io;
}
struct block_device *bdev;
if (pd->pkt_dev == dev) {
- pr_err("recursive setup not allowed\n");
+ pkt_err(pd, "recursive setup not allowed\n");
return -EBUSY;
}
for (i = 0; i < MAX_WRITERS; i++) {
if (!pd2)
continue;
if (pd2->bdev->bd_dev == dev) {
- pr_err("%s already setup\n", bdevname(pd2->bdev, b));
+ pkt_err(pd, "%s already setup\n",
+ bdevname(pd2->bdev, b));
return -EBUSY;
}
if (pd2->pkt_dev == dev) {
- pr_err("can't chain pktcdvd devices\n");
+ pkt_err(pd, "can't chain pktcdvd devices\n");
return -EBUSY;
}
}
atomic_set(&pd->cdrw.pending_bios, 0);
pd->cdrw.thread = kthread_run(kcdrwd, pd, "%s", pd->name);
if (IS_ERR(pd->cdrw.thread)) {
- pr_err("can't start kernel thread\n");
+ pkt_err(pd, "can't start kernel thread\n");
ret = -ENOMEM;
goto out_mem;
}