Commit 7822082d authored by Thomas Maier's avatar Thomas Maier Committed by Linus Torvalds

[PATCH] pktcdvd: Replace pktcdvd strings with macro DRIVER_NAME.

pktcdvd: Replace pktcdvd strings with macro DRIVER_NAME.
Signed-off-by: default avatarThomas Maier <balagi@justmail.de>
Signed-off-by: default avatarPeter Osterlund <petero2@telia.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d321765f
...@@ -62,6 +62,8 @@ ...@@ -62,6 +62,8 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define DRIVER_NAME "pktcdvd"
#if PACKET_DEBUG #if PACKET_DEBUG
#define DPRINTK(fmt, args...) printk(KERN_NOTICE fmt, ##args) #define DPRINTK(fmt, args...) printk(KERN_NOTICE fmt, ##args)
#else #else
...@@ -89,7 +91,7 @@ static void pkt_bio_finished(struct pktcdvd_device *pd) ...@@ -89,7 +91,7 @@ static void pkt_bio_finished(struct pktcdvd_device *pd)
{ {
BUG_ON(atomic_read(&pd->cdrw.pending_bios) <= 0); BUG_ON(atomic_read(&pd->cdrw.pending_bios) <= 0);
if (atomic_dec_and_test(&pd->cdrw.pending_bios)) { if (atomic_dec_and_test(&pd->cdrw.pending_bios)) {
VPRINTK("pktcdvd: queue empty\n"); VPRINTK(DRIVER_NAME": queue empty\n");
atomic_set(&pd->iosched.attention, 1); atomic_set(&pd->iosched.attention, 1);
wake_up(&pd->wqueue); wake_up(&pd->wqueue);
} }
...@@ -400,7 +402,7 @@ static void pkt_dump_sense(struct packet_command *cgc) ...@@ -400,7 +402,7 @@ static void pkt_dump_sense(struct packet_command *cgc)
int i; int i;
struct request_sense *sense = cgc->sense; struct request_sense *sense = cgc->sense;
printk("pktcdvd:"); printk(DRIVER_NAME":");
for (i = 0; i < CDROM_PACKET_SIZE; i++) for (i = 0; i < CDROM_PACKET_SIZE; i++)
printk(" %02x", cgc->cmd[i]); printk(" %02x", cgc->cmd[i]);
printk(" - "); printk(" - ");
...@@ -528,7 +530,7 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) ...@@ -528,7 +530,7 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd)
need_write_seek = 0; need_write_seek = 0;
if (need_write_seek && reads_queued) { if (need_write_seek && reads_queued) {
if (atomic_read(&pd->cdrw.pending_bios) > 0) { if (atomic_read(&pd->cdrw.pending_bios) > 0) {
VPRINTK("pktcdvd: write, waiting\n"); VPRINTK(DRIVER_NAME": write, waiting\n");
break; break;
} }
pkt_flush_cache(pd); pkt_flush_cache(pd);
...@@ -537,7 +539,7 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) ...@@ -537,7 +539,7 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd)
} else { } else {
if (!reads_queued && writes_queued) { if (!reads_queued && writes_queued) {
if (atomic_read(&pd->cdrw.pending_bios) > 0) { if (atomic_read(&pd->cdrw.pending_bios) > 0) {
VPRINTK("pktcdvd: read, waiting\n"); VPRINTK(DRIVER_NAME": read, waiting\n");
break; break;
} }
pd->iosched.writing = 1; pd->iosched.writing = 1;
...@@ -600,7 +602,7 @@ static int pkt_set_segment_merging(struct pktcdvd_device *pd, request_queue_t *q ...@@ -600,7 +602,7 @@ static int pkt_set_segment_merging(struct pktcdvd_device *pd, request_queue_t *q
set_bit(PACKET_MERGE_SEGS, &pd->flags); set_bit(PACKET_MERGE_SEGS, &pd->flags);
return 0; return 0;
} else { } else {
printk("pktcdvd: cdrom max_phys_segments too small\n"); printk(DRIVER_NAME": cdrom max_phys_segments too small\n");
return -EIO; return -EIO;
} }
} }
...@@ -1049,7 +1051,7 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt) ...@@ -1049,7 +1051,7 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
for (f = 0; f < pkt->frames; f++) for (f = 0; f < pkt->frames; f++)
if (!bio_add_page(pkt->w_bio, bvec[f].bv_page, CD_FRAMESIZE, bvec[f].bv_offset)) if (!bio_add_page(pkt->w_bio, bvec[f].bv_page, CD_FRAMESIZE, bvec[f].bv_offset))
BUG(); BUG();
VPRINTK("pktcdvd: vcnt=%d\n", pkt->w_bio->bi_vcnt); VPRINTK(DRIVER_NAME": vcnt=%d\n", pkt->w_bio->bi_vcnt);
atomic_set(&pkt->io_wait, 1); atomic_set(&pkt->io_wait, 1);
pkt->w_bio->bi_rw = WRITE; pkt->w_bio->bi_rw = WRITE;
...@@ -1286,7 +1288,7 @@ work_to_do: ...@@ -1286,7 +1288,7 @@ work_to_do:
static void pkt_print_settings(struct pktcdvd_device *pd) static void pkt_print_settings(struct pktcdvd_device *pd)
{ {
printk("pktcdvd: %s packets, ", pd->settings.fp ? "Fixed" : "Variable"); printk(DRIVER_NAME": %s packets, ", pd->settings.fp ? "Fixed" : "Variable");
printk("%u blocks, ", pd->settings.size >> 2); printk("%u blocks, ", pd->settings.size >> 2);
printk("Mode-%c disc\n", pd->settings.block_mode == 8 ? '1' : '2'); printk("Mode-%c disc\n", pd->settings.block_mode == 8 ? '1' : '2');
} }
...@@ -1471,7 +1473,7 @@ static int pkt_set_write_settings(struct pktcdvd_device *pd) ...@@ -1471,7 +1473,7 @@ static int pkt_set_write_settings(struct pktcdvd_device *pd)
/* /*
* paranoia * paranoia
*/ */
printk("pktcdvd: write mode wrong %d\n", wp->data_block_type); printk(DRIVER_NAME": write mode wrong %d\n", wp->data_block_type);
return 1; return 1;
} }
wp->packet_size = cpu_to_be32(pd->settings.size >> 2); wp->packet_size = cpu_to_be32(pd->settings.size >> 2);
...@@ -1515,7 +1517,7 @@ static int pkt_writable_track(struct pktcdvd_device *pd, track_information *ti) ...@@ -1515,7 +1517,7 @@ static int pkt_writable_track(struct pktcdvd_device *pd, track_information *ti)
if (ti->rt == 1 && ti->blank == 0) if (ti->rt == 1 && ti->blank == 0)
return 1; return 1;
printk("pktcdvd: bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet); printk(DRIVER_NAME": bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet);
return 0; return 0;
} }
...@@ -1533,7 +1535,7 @@ static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di) ...@@ -1533,7 +1535,7 @@ static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di)
case 0x12: /* DVD-RAM */ case 0x12: /* DVD-RAM */
return 1; return 1;
default: default:
VPRINTK("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile); VPRINTK(DRIVER_NAME": Wrong disc profile (%x)\n", pd->mmc3_profile);
return 0; return 0;
} }
...@@ -1542,22 +1544,22 @@ static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di) ...@@ -1542,22 +1544,22 @@ static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di)
* but i'm not sure, should we leave this to user apps? probably. * but i'm not sure, should we leave this to user apps? probably.
*/ */
if (di->disc_type == 0xff) { if (di->disc_type == 0xff) {
printk("pktcdvd: Unknown disc. No track?\n"); printk(DRIVER_NAME": Unknown disc. No track?\n");
return 0; return 0;
} }
if (di->disc_type != 0x20 && di->disc_type != 0) { if (di->disc_type != 0x20 && di->disc_type != 0) {
printk("pktcdvd: Wrong disc type (%x)\n", di->disc_type); printk(DRIVER_NAME": Wrong disc type (%x)\n", di->disc_type);
return 0; return 0;
} }
if (di->erasable == 0) { if (di->erasable == 0) {
printk("pktcdvd: Disc not erasable\n"); printk(DRIVER_NAME": Disc not erasable\n");
return 0; return 0;
} }
if (di->border_status == PACKET_SESSION_RESERVED) { if (di->border_status == PACKET_SESSION_RESERVED) {
printk("pktcdvd: Can't write to last track (reserved)\n"); printk(DRIVER_NAME": Can't write to last track (reserved)\n");
return 0; return 0;
} }
...@@ -1593,12 +1595,12 @@ static int pkt_probe_settings(struct pktcdvd_device *pd) ...@@ -1593,12 +1595,12 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
track = 1; /* (di.last_track_msb << 8) | di.last_track_lsb; */ track = 1; /* (di.last_track_msb << 8) | di.last_track_lsb; */
if ((ret = pkt_get_track_info(pd, track, 1, &ti))) { if ((ret = pkt_get_track_info(pd, track, 1, &ti))) {
printk("pktcdvd: failed get_track\n"); printk(DRIVER_NAME": failed get_track\n");
return ret; return ret;
} }
if (!pkt_writable_track(pd, &ti)) { if (!pkt_writable_track(pd, &ti)) {
printk("pktcdvd: can't write to this track\n"); printk(DRIVER_NAME": can't write to this track\n");
return -EROFS; return -EROFS;
} }
...@@ -1608,11 +1610,11 @@ static int pkt_probe_settings(struct pktcdvd_device *pd) ...@@ -1608,11 +1610,11 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
*/ */
pd->settings.size = be32_to_cpu(ti.fixed_packet_size) << 2; pd->settings.size = be32_to_cpu(ti.fixed_packet_size) << 2;
if (pd->settings.size == 0) { if (pd->settings.size == 0) {
printk("pktcdvd: detected zero packet size!\n"); printk(DRIVER_NAME": detected zero packet size!\n");
return -ENXIO; return -ENXIO;
} }
if (pd->settings.size > PACKET_MAX_SECTORS) { if (pd->settings.size > PACKET_MAX_SECTORS) {
printk("pktcdvd: packet size is too big\n"); printk(DRIVER_NAME": packet size is too big\n");
return -EROFS; return -EROFS;
} }
pd->settings.fp = ti.fp; pd->settings.fp = ti.fp;
...@@ -1654,7 +1656,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd) ...@@ -1654,7 +1656,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
pd->settings.block_mode = PACKET_BLOCK_MODE2; pd->settings.block_mode = PACKET_BLOCK_MODE2;
break; break;
default: default:
printk("pktcdvd: unknown data mode\n"); printk(DRIVER_NAME": unknown data mode\n");
return -EROFS; return -EROFS;
} }
return 0; return 0;
...@@ -1688,10 +1690,10 @@ static int pkt_write_caching(struct pktcdvd_device *pd, int set) ...@@ -1688,10 +1690,10 @@ static int pkt_write_caching(struct pktcdvd_device *pd, int set)
cgc.buflen = cgc.cmd[8] = 2 + ((buf[0] << 8) | (buf[1] & 0xff)); cgc.buflen = cgc.cmd[8] = 2 + ((buf[0] << 8) | (buf[1] & 0xff));
ret = pkt_mode_select(pd, &cgc); ret = pkt_mode_select(pd, &cgc);
if (ret) { if (ret) {
printk("pktcdvd: write caching control failed\n"); printk(DRIVER_NAME": write caching control failed\n");
pkt_dump_sense(&cgc); pkt_dump_sense(&cgc);
} else if (!ret && set) } else if (!ret && set)
printk("pktcdvd: enabled write caching on %s\n", pd->name); printk(DRIVER_NAME": enabled write caching on %s\n", pd->name);
return ret; return ret;
} }
...@@ -1805,11 +1807,11 @@ static int pkt_media_speed(struct pktcdvd_device *pd, unsigned *speed) ...@@ -1805,11 +1807,11 @@ static int pkt_media_speed(struct pktcdvd_device *pd, unsigned *speed)
} }
if (!buf[6] & 0x40) { if (!buf[6] & 0x40) {
printk("pktcdvd: Disc type is not CD-RW\n"); printk(DRIVER_NAME": Disc type is not CD-RW\n");
return 1; return 1;
} }
if (!buf[6] & 0x4) { if (!buf[6] & 0x4) {
printk("pktcdvd: A1 values on media are not valid, maybe not CDRW?\n"); printk(DRIVER_NAME": A1 values on media are not valid, maybe not CDRW?\n");
return 1; return 1;
} }
...@@ -1829,14 +1831,14 @@ static int pkt_media_speed(struct pktcdvd_device *pd, unsigned *speed) ...@@ -1829,14 +1831,14 @@ static int pkt_media_speed(struct pktcdvd_device *pd, unsigned *speed)
*speed = us_clv_to_speed[sp]; *speed = us_clv_to_speed[sp];
break; break;
default: default:
printk("pktcdvd: Unknown disc sub-type %d\n",st); printk(DRIVER_NAME": Unknown disc sub-type %d\n",st);
return 1; return 1;
} }
if (*speed) { if (*speed) {
printk("pktcdvd: Max. media speed: %d\n",*speed); printk(DRIVER_NAME": Max. media speed: %d\n",*speed);
return 0; return 0;
} else { } else {
printk("pktcdvd: Unknown speed %d for sub-type %d\n",sp,st); printk(DRIVER_NAME": Unknown speed %d for sub-type %d\n",sp,st);
return 1; return 1;
} }
} }
...@@ -1847,7 +1849,7 @@ static int pkt_perform_opc(struct pktcdvd_device *pd) ...@@ -1847,7 +1849,7 @@ static int pkt_perform_opc(struct pktcdvd_device *pd)
struct request_sense sense; struct request_sense sense;
int ret; int ret;
VPRINTK("pktcdvd: Performing OPC\n"); VPRINTK(DRIVER_NAME": Performing OPC\n");
init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE); init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
cgc.sense = &sense; cgc.sense = &sense;
...@@ -1865,12 +1867,12 @@ static int pkt_open_write(struct pktcdvd_device *pd) ...@@ -1865,12 +1867,12 @@ static int pkt_open_write(struct pktcdvd_device *pd)
unsigned int write_speed, media_write_speed, read_speed; unsigned int write_speed, media_write_speed, read_speed;
if ((ret = pkt_probe_settings(pd))) { if ((ret = pkt_probe_settings(pd))) {
VPRINTK("pktcdvd: %s failed probe\n", pd->name); VPRINTK(DRIVER_NAME": %s failed probe\n", pd->name);
return ret; return ret;
} }
if ((ret = pkt_set_write_settings(pd))) { if ((ret = pkt_set_write_settings(pd))) {
DPRINTK("pktcdvd: %s failed saving write settings\n", pd->name); DPRINTK(DRIVER_NAME": %s failed saving write settings\n", pd->name);
return -EIO; return -EIO;
} }
...@@ -1882,26 +1884,26 @@ static int pkt_open_write(struct pktcdvd_device *pd) ...@@ -1882,26 +1884,26 @@ static int pkt_open_write(struct pktcdvd_device *pd)
case 0x13: /* DVD-RW */ case 0x13: /* DVD-RW */
case 0x1a: /* DVD+RW */ case 0x1a: /* DVD+RW */
case 0x12: /* DVD-RAM */ case 0x12: /* DVD-RAM */
DPRINTK("pktcdvd: write speed %ukB/s\n", write_speed); DPRINTK(DRIVER_NAME": write speed %ukB/s\n", write_speed);
break; break;
default: default:
if ((ret = pkt_media_speed(pd, &media_write_speed))) if ((ret = pkt_media_speed(pd, &media_write_speed)))
media_write_speed = 16; media_write_speed = 16;
write_speed = min(write_speed, media_write_speed * 177); write_speed = min(write_speed, media_write_speed * 177);
DPRINTK("pktcdvd: write speed %ux\n", write_speed / 176); DPRINTK(DRIVER_NAME": write speed %ux\n", write_speed / 176);
break; break;
} }
read_speed = write_speed; read_speed = write_speed;
if ((ret = pkt_set_speed(pd, write_speed, read_speed))) { if ((ret = pkt_set_speed(pd, write_speed, read_speed))) {
DPRINTK("pktcdvd: %s couldn't set write speed\n", pd->name); DPRINTK(DRIVER_NAME": %s couldn't set write speed\n", pd->name);
return -EIO; return -EIO;
} }
pd->write_speed = write_speed; pd->write_speed = write_speed;
pd->read_speed = read_speed; pd->read_speed = read_speed;
if ((ret = pkt_perform_opc(pd))) { if ((ret = pkt_perform_opc(pd))) {
DPRINTK("pktcdvd: %s Optimum Power Calibration failed\n", pd->name); DPRINTK(DRIVER_NAME": %s Optimum Power Calibration failed\n", pd->name);
} }
return 0; return 0;
...@@ -1929,7 +1931,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, int write) ...@@ -1929,7 +1931,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, int write)
goto out_putdev; goto out_putdev;
if ((ret = pkt_get_last_written(pd, &lba))) { if ((ret = pkt_get_last_written(pd, &lba))) {
printk("pktcdvd: pkt_get_last_written failed\n"); printk(DRIVER_NAME": pkt_get_last_written failed\n");
goto out_unclaim; goto out_unclaim;
} }
...@@ -1959,11 +1961,11 @@ static int pkt_open_dev(struct pktcdvd_device *pd, int write) ...@@ -1959,11 +1961,11 @@ static int pkt_open_dev(struct pktcdvd_device *pd, int write)
if (write) { if (write) {
if (!pkt_grow_pktlist(pd, CONFIG_CDROM_PKTCDVD_BUFFERS)) { if (!pkt_grow_pktlist(pd, CONFIG_CDROM_PKTCDVD_BUFFERS)) {
printk("pktcdvd: not enough memory for buffers\n"); printk(DRIVER_NAME": not enough memory for buffers\n");
ret = -ENOMEM; ret = -ENOMEM;
goto out_unclaim; goto out_unclaim;
} }
printk("pktcdvd: %lukB available on disc\n", lba << 1); printk(DRIVER_NAME": %lukB available on disc\n", lba << 1);
} }
return 0; return 0;
...@@ -1983,7 +1985,7 @@ out: ...@@ -1983,7 +1985,7 @@ out:
static void pkt_release_dev(struct pktcdvd_device *pd, int flush) static void pkt_release_dev(struct pktcdvd_device *pd, int flush)
{ {
if (flush && pkt_flush_cache(pd)) if (flush && pkt_flush_cache(pd))
DPRINTK("pktcdvd: %s not flushing cache\n", pd->name); DPRINTK(DRIVER_NAME": %s not flushing cache\n", pd->name);
pkt_lock_door(pd, 0); pkt_lock_door(pd, 0);
...@@ -2006,7 +2008,7 @@ static int pkt_open(struct inode *inode, struct file *file) ...@@ -2006,7 +2008,7 @@ static int pkt_open(struct inode *inode, struct file *file)
struct pktcdvd_device *pd = NULL; struct pktcdvd_device *pd = NULL;
int ret; int ret;
VPRINTK("pktcdvd: entering open\n"); VPRINTK(DRIVER_NAME": entering open\n");
mutex_lock(&ctl_mutex); mutex_lock(&ctl_mutex);
pd = pkt_find_dev_from_minor(iminor(inode)); pd = pkt_find_dev_from_minor(iminor(inode));
...@@ -2040,7 +2042,7 @@ static int pkt_open(struct inode *inode, struct file *file) ...@@ -2040,7 +2042,7 @@ static int pkt_open(struct inode *inode, struct file *file)
out_dec: out_dec:
pd->refcnt--; pd->refcnt--;
out: out:
VPRINTK("pktcdvd: failed open (%d)\n", ret); VPRINTK(DRIVER_NAME": failed open (%d)\n", ret);
mutex_unlock(&ctl_mutex); mutex_unlock(&ctl_mutex);
return ret; return ret;
} }
...@@ -2088,7 +2090,7 @@ static int pkt_make_request(request_queue_t *q, struct bio *bio) ...@@ -2088,7 +2090,7 @@ static int pkt_make_request(request_queue_t *q, struct bio *bio)
pd = q->queuedata; pd = q->queuedata;
if (!pd) { if (!pd) {
printk("pktcdvd: %s incorrect request queue\n", bdevname(bio->bi_bdev, b)); printk(DRIVER_NAME": %s incorrect request queue\n", bdevname(bio->bi_bdev, b));
goto end_io; goto end_io;
} }
...@@ -2110,13 +2112,13 @@ static int pkt_make_request(request_queue_t *q, struct bio *bio) ...@@ -2110,13 +2112,13 @@ static int pkt_make_request(request_queue_t *q, struct bio *bio)
} }
if (!test_bit(PACKET_WRITABLE, &pd->flags)) { if (!test_bit(PACKET_WRITABLE, &pd->flags)) {
printk("pktcdvd: WRITE for ro device %s (%llu)\n", printk(DRIVER_NAME": WRITE for ro device %s (%llu)\n",
pd->name, (unsigned long long)bio->bi_sector); pd->name, (unsigned long long)bio->bi_sector);
goto end_io; goto end_io;
} }
if (!bio->bi_size || (bio->bi_size % CD_FRAMESIZE)) { if (!bio->bi_size || (bio->bi_size % CD_FRAMESIZE)) {
printk("pktcdvd: wrong bio size\n"); printk(DRIVER_NAME": wrong bio size\n");
goto end_io; goto end_io;
} }
...@@ -2319,7 +2321,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) ...@@ -2319,7 +2321,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
struct block_device *bdev; struct block_device *bdev;
if (pd->pkt_dev == dev) { if (pd->pkt_dev == dev) {
printk("pktcdvd: Recursive setup not allowed\n"); printk(DRIVER_NAME": Recursive setup not allowed\n");
return -EBUSY; return -EBUSY;
} }
for (i = 0; i < MAX_WRITERS; i++) { for (i = 0; i < MAX_WRITERS; i++) {
...@@ -2327,11 +2329,11 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) ...@@ -2327,11 +2329,11 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
if (!pd2) if (!pd2)
continue; continue;
if (pd2->bdev->bd_dev == dev) { if (pd2->bdev->bd_dev == dev) {
printk("pktcdvd: %s already setup\n", bdevname(pd2->bdev, b)); printk(DRIVER_NAME": %s already setup\n", bdevname(pd2->bdev, b));
return -EBUSY; return -EBUSY;
} }
if (pd2->pkt_dev == dev) { if (pd2->pkt_dev == dev) {
printk("pktcdvd: Can't chain pktcdvd devices\n"); printk(DRIVER_NAME": Can't chain pktcdvd devices\n");
return -EBUSY; return -EBUSY;
} }
} }
...@@ -2354,7 +2356,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) ...@@ -2354,7 +2356,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
atomic_set(&pd->cdrw.pending_bios, 0); atomic_set(&pd->cdrw.pending_bios, 0);
pd->cdrw.thread = kthread_run(kcdrwd, pd, "%s", pd->name); pd->cdrw.thread = kthread_run(kcdrwd, pd, "%s", pd->name);
if (IS_ERR(pd->cdrw.thread)) { if (IS_ERR(pd->cdrw.thread)) {
printk("pktcdvd: can't start kernel thread\n"); printk(DRIVER_NAME": can't start kernel thread\n");
ret = -ENOMEM; ret = -ENOMEM;
goto out_mem; goto out_mem;
} }
...@@ -2364,7 +2366,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) ...@@ -2364,7 +2366,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
proc->data = pd; proc->data = pd;
proc->proc_fops = &pkt_proc_fops; proc->proc_fops = &pkt_proc_fops;
} }
DPRINTK("pktcdvd: writer %s mapped to %s\n", pd->name, bdevname(bdev, b)); DPRINTK(DRIVER_NAME": writer %s mapped to %s\n", pd->name, bdevname(bdev, b));
return 0; return 0;
out_mem: out_mem:
...@@ -2401,7 +2403,7 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -2401,7 +2403,7 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg);
default: default:
VPRINTK("pktcdvd: Unknown ioctl for %s (%x)\n", pd->name, cmd); VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd);
return -ENOTTY; return -ENOTTY;
} }
...@@ -2446,7 +2448,7 @@ static int pkt_setup_dev(struct pkt_ctrl_command *ctrl_cmd) ...@@ -2446,7 +2448,7 @@ static int pkt_setup_dev(struct pkt_ctrl_command *ctrl_cmd)
if (!pkt_devs[idx]) if (!pkt_devs[idx])
break; break;
if (idx == MAX_WRITERS) { if (idx == MAX_WRITERS) {
printk("pktcdvd: max %d writers supported\n", MAX_WRITERS); printk(DRIVER_NAME": max %d writers supported\n", MAX_WRITERS);
return -EBUSY; return -EBUSY;
} }
...@@ -2470,7 +2472,7 @@ static int pkt_setup_dev(struct pkt_ctrl_command *ctrl_cmd) ...@@ -2470,7 +2472,7 @@ static int pkt_setup_dev(struct pkt_ctrl_command *ctrl_cmd)
spin_lock_init(&pd->lock); spin_lock_init(&pd->lock);
spin_lock_init(&pd->iosched.lock); spin_lock_init(&pd->iosched.lock);
sprintf(pd->name, "pktcdvd%d", idx); sprintf(pd->name, DRIVER_NAME"%d", idx);
init_waitqueue_head(&pd->wqueue); init_waitqueue_head(&pd->wqueue);
pd->bio_queue = RB_ROOT; pd->bio_queue = RB_ROOT;
...@@ -2478,7 +2480,7 @@ static int pkt_setup_dev(struct pkt_ctrl_command *ctrl_cmd) ...@@ -2478,7 +2480,7 @@ static int pkt_setup_dev(struct pkt_ctrl_command *ctrl_cmd)
disk->first_minor = idx; disk->first_minor = idx;
disk->fops = &pktcdvd_ops; disk->fops = &pktcdvd_ops;
disk->flags = GENHD_FL_REMOVABLE; disk->flags = GENHD_FL_REMOVABLE;
sprintf(disk->disk_name, "pktcdvd%d", idx); sprintf(disk->disk_name, DRIVER_NAME"%d", idx);
disk->private_data = pd; disk->private_data = pd;
disk->queue = blk_alloc_queue(GFP_KERNEL); disk->queue = blk_alloc_queue(GFP_KERNEL);
if (!disk->queue) if (!disk->queue)
...@@ -2520,7 +2522,7 @@ static int pkt_remove_dev(struct pkt_ctrl_command *ctrl_cmd) ...@@ -2520,7 +2522,7 @@ static int pkt_remove_dev(struct pkt_ctrl_command *ctrl_cmd)
break; break;
} }
if (idx == MAX_WRITERS) { if (idx == MAX_WRITERS) {
DPRINTK("pktcdvd: dev not setup\n"); DPRINTK(DRIVER_NAME": dev not setup\n");
return -ENXIO; return -ENXIO;
} }
...@@ -2533,7 +2535,7 @@ static int pkt_remove_dev(struct pkt_ctrl_command *ctrl_cmd) ...@@ -2533,7 +2535,7 @@ static int pkt_remove_dev(struct pkt_ctrl_command *ctrl_cmd)
blkdev_put(pd->bdev); blkdev_put(pd->bdev);
remove_proc_entry(pd->name, pkt_proc); remove_proc_entry(pd->name, pkt_proc);
DPRINTK("pktcdvd: writer %s unmapped\n", pd->name); DPRINTK(DRIVER_NAME": writer %s unmapped\n", pd->name);
del_gendisk(pd->disk); del_gendisk(pd->disk);
blk_cleanup_queue(pd->disk->queue); blk_cleanup_queue(pd->disk->queue);
...@@ -2610,7 +2612,7 @@ static struct file_operations pkt_ctl_fops = { ...@@ -2610,7 +2612,7 @@ static struct file_operations pkt_ctl_fops = {
static struct miscdevice pkt_misc = { static struct miscdevice pkt_misc = {
.minor = MISC_DYNAMIC_MINOR, .minor = MISC_DYNAMIC_MINOR,
.name = "pktcdvd", .name = DRIVER_NAME,
.fops = &pkt_ctl_fops .fops = &pkt_ctl_fops
}; };
...@@ -2623,9 +2625,9 @@ static int __init pkt_init(void) ...@@ -2623,9 +2625,9 @@ static int __init pkt_init(void)
if (!psd_pool) if (!psd_pool)
return -ENOMEM; return -ENOMEM;
ret = register_blkdev(pkt_major, "pktcdvd"); ret = register_blkdev(pkt_major, DRIVER_NAME);
if (ret < 0) { if (ret < 0) {
printk("pktcdvd: Unable to register block device\n"); printk(DRIVER_NAME": Unable to register block device\n");
goto out2; goto out2;
} }
if (!pkt_major) if (!pkt_major)
...@@ -2633,18 +2635,18 @@ static int __init pkt_init(void) ...@@ -2633,18 +2635,18 @@ static int __init pkt_init(void)
ret = misc_register(&pkt_misc); ret = misc_register(&pkt_misc);
if (ret) { if (ret) {
printk("pktcdvd: Unable to register misc device\n"); printk(DRIVER_NAME": Unable to register misc device\n");
goto out; goto out;
} }
mutex_init(&ctl_mutex); mutex_init(&ctl_mutex);
pkt_proc = proc_mkdir("pktcdvd", proc_root_driver); pkt_proc = proc_mkdir(DRIVER_NAME, proc_root_driver);
return 0; return 0;
out: out:
unregister_blkdev(pkt_major, "pktcdvd"); unregister_blkdev(pkt_major, DRIVER_NAME);
out2: out2:
mempool_destroy(psd_pool); mempool_destroy(psd_pool);
return ret; return ret;
...@@ -2652,9 +2654,9 @@ out2: ...@@ -2652,9 +2654,9 @@ out2:
static void __exit pkt_exit(void) static void __exit pkt_exit(void)
{ {
remove_proc_entry("pktcdvd", proc_root_driver); remove_proc_entry(DRIVER_NAME, proc_root_driver);
misc_deregister(&pkt_misc); misc_deregister(&pkt_misc);
unregister_blkdev(pkt_major, "pktcdvd"); unregister_blkdev(pkt_major, DRIVER_NAME);
mempool_destroy(psd_pool); mempool_destroy(psd_pool);
} }
......
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