aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cdrom')
-rw-r--r--drivers/cdrom/cdrom.c46
-rw-r--r--drivers/cdrom/gdrom.c48
-rw-r--r--drivers/cdrom/viocd.c106
3 files changed, 109 insertions, 91 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index e3749d0ba68b..af13c62dc473 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -242,6 +242,8 @@
242 242
243-------------------------------------------------------------------------*/ 243-------------------------------------------------------------------------*/
244 244
245#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
246
245#define REVISION "Revision: 3.20" 247#define REVISION "Revision: 3.20"
246#define VERSION "Id: cdrom.c 3.20 2003/12/17" 248#define VERSION "Id: cdrom.c 3.20 2003/12/17"
247 249
@@ -314,11 +316,17 @@ static const char *mrw_format_status[] = {
314static const char *mrw_address_space[] = { "DMA", "GAA" }; 316static const char *mrw_address_space[] = { "DMA", "GAA" };
315 317
316#if (ERRLOGMASK!=CD_NOTHING) 318#if (ERRLOGMASK!=CD_NOTHING)
317#define cdinfo(type, fmt, args...) \ 319#define cdinfo(type, fmt, args...) \
318 if ((ERRLOGMASK & type) || debug==1 ) \ 320do { \
319 printk(KERN_INFO "cdrom: " fmt, ## args) 321 if ((ERRLOGMASK & type) || debug == 1) \
322 pr_info(fmt, ##args); \
323} while (0)
320#else 324#else
321#define cdinfo(type, fmt, args...) 325#define cdinfo(type, fmt, args...) \
326do { \
327 if (0 && (ERRLOGMASK & type) || debug == 1) \
328 pr_info(fmt, ##args); \
329} while (0)
322#endif 330#endif
323 331
324/* These are used to simplify getting data in from and back to user land */ 332/* These are used to simplify getting data in from and back to user land */
@@ -395,7 +403,7 @@ int register_cdrom(struct cdrom_device_info *cdi)
395 if (cdo->open == NULL || cdo->release == NULL) 403 if (cdo->open == NULL || cdo->release == NULL)
396 return -EINVAL; 404 return -EINVAL;
397 if (!banner_printed) { 405 if (!banner_printed) {
398 printk(KERN_INFO "Uniform CD-ROM driver " REVISION "\n"); 406 pr_info("Uniform CD-ROM driver " REVISION "\n");
399 banner_printed = 1; 407 banner_printed = 1;
400 cdrom_sysctl_register(); 408 cdrom_sysctl_register();
401 } 409 }
@@ -546,7 +554,7 @@ static int cdrom_mrw_bgformat(struct cdrom_device_info *cdi, int cont)
546 unsigned char buffer[12]; 554 unsigned char buffer[12];
547 int ret; 555 int ret;
548 556
549 printk(KERN_INFO "cdrom: %sstarting format\n", cont ? "Re" : ""); 557 pr_info("%sstarting format\n", cont ? "Re" : "");
550 558
551 /* 559 /*
552 * FmtData bit set (bit 4), format type is 1 560 * FmtData bit set (bit 4), format type is 1
@@ -576,7 +584,7 @@ static int cdrom_mrw_bgformat(struct cdrom_device_info *cdi, int cont)
576 584
577 ret = cdi->ops->generic_packet(cdi, &cgc); 585 ret = cdi->ops->generic_packet(cdi, &cgc);
578 if (ret) 586 if (ret)
579 printk(KERN_INFO "cdrom: bgformat failed\n"); 587 pr_info("bgformat failed\n");
580 588
581 return ret; 589 return ret;
582} 590}
@@ -622,8 +630,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi)
622 630
623 ret = 0; 631 ret = 0;
624 if (di.mrw_status == CDM_MRW_BGFORMAT_ACTIVE) { 632 if (di.mrw_status == CDM_MRW_BGFORMAT_ACTIVE) {
625 printk(KERN_INFO "cdrom: issuing MRW back ground " 633 pr_info("issuing MRW background format suspend\n");
626 "format suspend\n");
627 ret = cdrom_mrw_bgformat_susp(cdi, 0); 634 ret = cdrom_mrw_bgformat_susp(cdi, 0);
628 } 635 }
629 636
@@ -658,7 +665,8 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space)
658 if ((ret = cdrom_mode_select(cdi, &cgc))) 665 if ((ret = cdrom_mode_select(cdi, &cgc)))
659 return ret; 666 return ret;
660 667
661 printk(KERN_INFO "cdrom: %s: mrw address space %s selected\n", cdi->name, mrw_address_space[space]); 668 pr_info("%s: mrw address space %s selected\n",
669 cdi->name, mrw_address_space[space]);
662 return 0; 670 return 0;
663} 671}
664 672
@@ -762,7 +770,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
762 * always reset to DMA lba space on open 770 * always reset to DMA lba space on open
763 */ 771 */
764 if (cdrom_mrw_set_lba_space(cdi, MRW_LBA_DMA)) { 772 if (cdrom_mrw_set_lba_space(cdi, MRW_LBA_DMA)) {
765 printk(KERN_ERR "cdrom: failed setting lba address space\n"); 773 pr_err("failed setting lba address space\n");
766 return 1; 774 return 1;
767 } 775 }
768 776
@@ -781,8 +789,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
781 * 3 - MRW formatting complete 789 * 3 - MRW formatting complete
782 */ 790 */
783 ret = 0; 791 ret = 0;
784 printk(KERN_INFO "cdrom open: mrw_status '%s'\n", 792 pr_info("open: mrw_status '%s'\n", mrw_format_status[di.mrw_status]);
785 mrw_format_status[di.mrw_status]);
786 if (!di.mrw_status) 793 if (!di.mrw_status)
787 ret = 1; 794 ret = 1;
788 else if (di.mrw_status == CDM_MRW_BGFORMAT_INACTIVE && 795 else if (di.mrw_status == CDM_MRW_BGFORMAT_INACTIVE &&
@@ -932,8 +939,7 @@ static void cdrom_dvd_rw_close_write(struct cdrom_device_info *cdi)
932 return; 939 return;
933 } 940 }
934 941
935 printk(KERN_INFO "cdrom: %s: dirty DVD+RW media, \"finalizing\"\n", 942 pr_info("%s: dirty DVD+RW media, \"finalizing\"\n", cdi->name);
936 cdi->name);
937 943
938 init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE); 944 init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
939 cgc.cmd[0] = GPCMD_FLUSH_CACHE; 945 cgc.cmd[0] = GPCMD_FLUSH_CACHE;
@@ -2176,7 +2182,7 @@ retry:
2176 * frame dma, so drop to single frame dma if we need to 2182 * frame dma, so drop to single frame dma if we need to
2177 */ 2183 */
2178 if (cdi->cdda_method == CDDA_BPC_FULL && nframes > 1) { 2184 if (cdi->cdda_method == CDDA_BPC_FULL && nframes > 1) {
2179 printk("cdrom: dropping to single frame dma\n"); 2185 pr_info("dropping to single frame dma\n");
2180 cdi->cdda_method = CDDA_BPC_SINGLE; 2186 cdi->cdda_method = CDDA_BPC_SINGLE;
2181 goto retry; 2187 goto retry;
2182 } 2188 }
@@ -2189,7 +2195,7 @@ retry:
2189 if (cdi->last_sense != 0x04 && cdi->last_sense != 0x0b) 2195 if (cdi->last_sense != 0x04 && cdi->last_sense != 0x0b)
2190 return ret; 2196 return ret;
2191 2197
2192 printk("cdrom: dropping to old style cdda (sense=%x)\n", cdi->last_sense); 2198 pr_info("dropping to old style cdda (sense=%x)\n", cdi->last_sense);
2193 cdi->cdda_method = CDDA_OLD; 2199 cdi->cdda_method = CDDA_OLD;
2194 return cdrom_read_cdda_old(cdi, ubuf, lba, nframes); 2200 return cdrom_read_cdda_old(cdi, ubuf, lba, nframes);
2195} 2201}
@@ -3401,7 +3407,7 @@ static int cdrom_print_info(const char *header, int val, char *info,
3401 "\t%d", CDROM_CAN(val) != 0); 3407 "\t%d", CDROM_CAN(val) != 0);
3402 break; 3408 break;
3403 default: 3409 default:
3404 printk(KERN_INFO "cdrom: invalid option%d\n", option); 3410 pr_info("invalid option%d\n", option);
3405 return 1; 3411 return 1;
3406 } 3412 }
3407 if (!ret) 3413 if (!ret)
@@ -3491,7 +3497,7 @@ doit:
3491 mutex_unlock(&cdrom_mutex); 3497 mutex_unlock(&cdrom_mutex);
3492 return proc_dostring(ctl, write, buffer, lenp, ppos); 3498 return proc_dostring(ctl, write, buffer, lenp, ppos);
3493done: 3499done:
3494 printk(KERN_INFO "cdrom: info buffer too small\n"); 3500 pr_info("info buffer too small\n");
3495 goto doit; 3501 goto doit;
3496} 3502}
3497 3503
@@ -3665,7 +3671,7 @@ static int __init cdrom_init(void)
3665 3671
3666static void __exit cdrom_exit(void) 3672static void __exit cdrom_exit(void)
3667{ 3673{
3668 printk(KERN_INFO "Uniform CD-ROM driver unloaded\n"); 3674 pr_info("Uniform CD-ROM driver unloaded\n");
3669 cdrom_sysctl_unregister(); 3675 cdrom_sysctl_unregister();
3670} 3676}
3671 3677
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 03c71f7698cb..261107d1457c 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -19,6 +19,8 @@
19 * 19 *
20 */ 20 */
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
22#include <linux/init.h> 24#include <linux/init.h>
23#include <linux/module.h> 25#include <linux/module.h>
24#include <linux/fs.h> 26#include <linux/fs.h>
@@ -32,6 +34,7 @@
32#include <linux/blkdev.h> 34#include <linux/blkdev.h>
33#include <linux/interrupt.h> 35#include <linux/interrupt.h>
34#include <linux/device.h> 36#include <linux/device.h>
37#include <linux/smp_lock.h>
35#include <linux/wait.h> 38#include <linux/wait.h>
36#include <linux/workqueue.h> 39#include <linux/workqueue.h>
37#include <linux/platform_device.h> 40#include <linux/platform_device.h>
@@ -339,8 +342,7 @@ static int gdrom_get_last_session(struct cdrom_device_info *cd_info,
339 tocuse = 0; 342 tocuse = 0;
340 err = gdrom_readtoc_cmd(gd.toc, 0); 343 err = gdrom_readtoc_cmd(gd.toc, 0);
341 if (err) { 344 if (err) {
342 printk(KERN_INFO "GDROM: Could not get CD " 345 pr_info("Could not get CD table of contents\n");
343 "table of contents\n");
344 return -ENXIO; 346 return -ENXIO;
345 } 347 }
346 } 348 }
@@ -357,8 +359,7 @@ static int gdrom_get_last_session(struct cdrom_device_info *cd_info,
357 } while (track >= fentry); 359 } while (track >= fentry);
358 360
359 if ((track > 100) || (track < get_entry_track(gd.toc->first))) { 361 if ((track > 100) || (track < get_entry_track(gd.toc->first))) {
360 printk(KERN_INFO "GDROM: No data on the last " 362 pr_info("No data on the last session of the CD\n");
361 "session of the CD\n");
362 gdrom_getsense(NULL); 363 gdrom_getsense(NULL);
363 return -ENXIO; 364 return -ENXIO;
364 } 365 }
@@ -451,14 +452,14 @@ static int gdrom_getsense(short *bufstring)
451 goto cleanup_sense; 452 goto cleanup_sense;
452 insw(GDROM_DATA_REG, &sense, sense_command->buflen/2); 453 insw(GDROM_DATA_REG, &sense, sense_command->buflen/2);
453 if (sense[1] & 40) { 454 if (sense[1] & 40) {
454 printk(KERN_INFO "GDROM: Drive not ready - command aborted\n"); 455 pr_info("Drive not ready - command aborted\n");
455 goto cleanup_sense; 456 goto cleanup_sense;
456 } 457 }
457 sense_key = sense[1] & 0x0F; 458 sense_key = sense[1] & 0x0F;
458 if (sense_key < ARRAY_SIZE(sense_texts)) 459 if (sense_key < ARRAY_SIZE(sense_texts))
459 printk(KERN_INFO "GDROM: %s\n", sense_texts[sense_key].text); 460 pr_info("%s\n", sense_texts[sense_key].text);
460 else 461 else
461 printk(KERN_ERR "GDROM: Unknown sense key: %d\n", sense_key); 462 pr_err("Unknown sense key: %d\n", sense_key);
462 if (bufstring) /* return addional sense data */ 463 if (bufstring) /* return addional sense data */
463 memcpy(bufstring, &sense[4], 2); 464 memcpy(bufstring, &sense[4], 2);
464 if (sense_key < 2) 465 if (sense_key < 2)
@@ -492,12 +493,18 @@ static struct cdrom_device_ops gdrom_ops = {
492 493
493static int gdrom_bdops_open(struct block_device *bdev, fmode_t mode) 494static int gdrom_bdops_open(struct block_device *bdev, fmode_t mode)
494{ 495{
495 return cdrom_open(gd.cd_info, bdev, mode); 496 int ret;
497 lock_kernel();
498 ret = cdrom_open(gd.cd_info, bdev, mode);
499 unlock_kernel();
500 return ret;
496} 501}
497 502
498static int gdrom_bdops_release(struct gendisk *disk, fmode_t mode) 503static int gdrom_bdops_release(struct gendisk *disk, fmode_t mode)
499{ 504{
505 lock_kernel();
500 cdrom_release(gd.cd_info, mode); 506 cdrom_release(gd.cd_info, mode);
507 unlock_kernel();
501 return 0; 508 return 0;
502} 509}
503 510
@@ -509,7 +516,13 @@ static int gdrom_bdops_mediachanged(struct gendisk *disk)
509static int gdrom_bdops_ioctl(struct block_device *bdev, fmode_t mode, 516static int gdrom_bdops_ioctl(struct block_device *bdev, fmode_t mode,
510 unsigned cmd, unsigned long arg) 517 unsigned cmd, unsigned long arg)
511{ 518{
512 return cdrom_ioctl(gd.cd_info, bdev, mode, cmd, arg); 519 int ret;
520
521 lock_kernel();
522 ret = cdrom_ioctl(gd.cd_info, bdev, mode, cmd, arg);
523 unlock_kernel();
524
525 return ret;
513} 526}
514 527
515static const struct block_device_operations gdrom_bdops = { 528static const struct block_device_operations gdrom_bdops = {
@@ -517,7 +530,7 @@ static const struct block_device_operations gdrom_bdops = {
517 .open = gdrom_bdops_open, 530 .open = gdrom_bdops_open,
518 .release = gdrom_bdops_release, 531 .release = gdrom_bdops_release,
519 .media_changed = gdrom_bdops_mediachanged, 532 .media_changed = gdrom_bdops_mediachanged,
520 .locked_ioctl = gdrom_bdops_ioctl, 533 .ioctl = gdrom_bdops_ioctl,
521}; 534};
522 535
523static irqreturn_t gdrom_command_interrupt(int irq, void *dev_id) 536static irqreturn_t gdrom_command_interrupt(int irq, void *dev_id)
@@ -643,14 +656,13 @@ static void gdrom_request(struct request_queue *rq)
643 struct request *req; 656 struct request *req;
644 657
645 while ((req = blk_fetch_request(rq)) != NULL) { 658 while ((req = blk_fetch_request(rq)) != NULL) {
646 if (!blk_fs_request(req)) { 659 if (req->cmd_type != REQ_TYPE_FS) {
647 printk(KERN_DEBUG "GDROM: Non-fs request ignored\n"); 660 printk(KERN_DEBUG "gdrom: Non-fs request ignored\n");
648 __blk_end_request_all(req, -EIO); 661 __blk_end_request_all(req, -EIO);
649 continue; 662 continue;
650 } 663 }
651 if (rq_data_dir(req) != READ) { 664 if (rq_data_dir(req) != READ) {
652 printk(KERN_NOTICE "GDROM: Read only device -"); 665 pr_notice("Read only device - write request ignored\n");
653 printk(" write request ignored\n");
654 __blk_end_request_all(req, -EIO); 666 __blk_end_request_all(req, -EIO);
655 continue; 667 continue;
656 } 668 }
@@ -685,7 +697,7 @@ static int __devinit gdrom_outputversion(void)
685 firmw_ver = kstrndup(id->firmver, 16, GFP_KERNEL); 697 firmw_ver = kstrndup(id->firmver, 16, GFP_KERNEL);
686 if (!firmw_ver) 698 if (!firmw_ver)
687 goto free_manuf_name; 699 goto free_manuf_name;
688 printk(KERN_INFO "GDROM: %s from %s with firmware %s\n", 700 pr_info("%s from %s with firmware %s\n",
689 model_name, manuf_name, firmw_ver); 701 model_name, manuf_name, firmw_ver);
690 err = 0; 702 err = 0;
691 kfree(firmw_ver); 703 kfree(firmw_ver);
@@ -757,7 +769,7 @@ static int __devinit probe_gdrom(struct platform_device *devptr)
757 int err; 769 int err;
758 /* Start the device */ 770 /* Start the device */
759 if (gdrom_execute_diagnostic() != 1) { 771 if (gdrom_execute_diagnostic() != 1) {
760 printk(KERN_WARNING "GDROM: ATA Probe for GDROM failed.\n"); 772 pr_warning("ATA Probe for GDROM failed\n");
761 return -ENODEV; 773 return -ENODEV;
762 } 774 }
763 /* Print out firmware ID */ 775 /* Print out firmware ID */
@@ -767,7 +779,7 @@ static int __devinit probe_gdrom(struct platform_device *devptr)
767 gdrom_major = register_blkdev(0, GDROM_DEV_NAME); 779 gdrom_major = register_blkdev(0, GDROM_DEV_NAME);
768 if (gdrom_major <= 0) 780 if (gdrom_major <= 0)
769 return gdrom_major; 781 return gdrom_major;
770 printk(KERN_INFO "GDROM: Registered with major number %d\n", 782 pr_info("Registered with major number %d\n",
771 gdrom_major); 783 gdrom_major);
772 /* Specify basic properties of drive */ 784 /* Specify basic properties of drive */
773 gd.cd_info = kzalloc(sizeof(struct cdrom_device_info), GFP_KERNEL); 785 gd.cd_info = kzalloc(sizeof(struct cdrom_device_info), GFP_KERNEL);
@@ -818,7 +830,7 @@ probe_fail_no_disk:
818 unregister_blkdev(gdrom_major, GDROM_DEV_NAME); 830 unregister_blkdev(gdrom_major, GDROM_DEV_NAME);
819 gdrom_major = 0; 831 gdrom_major = 0;
820probe_fail_no_mem: 832probe_fail_no_mem:
821 printk(KERN_WARNING "GDROM: Probe failed - error is 0x%X\n", err); 833 pr_warning("Probe failed - error is 0x%X\n", err);
822 return err; 834 return err;
823} 835}
824 836
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 451cd7071b1d..56bf9f44700c 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -31,6 +31,8 @@
31 * the OS/400 partition. 31 * the OS/400 partition.
32 */ 32 */
33 33
34#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
35
34#include <linux/major.h> 36#include <linux/major.h>
35#include <linux/blkdev.h> 37#include <linux/blkdev.h>
36#include <linux/cdrom.h> 38#include <linux/cdrom.h>
@@ -40,6 +42,7 @@
40#include <linux/module.h> 42#include <linux/module.h>
41#include <linux/completion.h> 43#include <linux/completion.h>
42#include <linux/proc_fs.h> 44#include <linux/proc_fs.h>
45#include <linux/smp_lock.h>
43#include <linux/seq_file.h> 46#include <linux/seq_file.h>
44#include <linux/scatterlist.h> 47#include <linux/scatterlist.h>
45 48
@@ -53,9 +56,6 @@
53 56
54#define VIOCD_VERS "1.06" 57#define VIOCD_VERS "1.06"
55 58
56#define VIOCD_KERN_WARNING KERN_WARNING "viocd: "
57#define VIOCD_KERN_INFO KERN_INFO "viocd: "
58
59/* 59/*
60 * Should probably make this a module parameter....sigh 60 * Should probably make this a module parameter....sigh
61 */ 61 */
@@ -154,13 +154,21 @@ static const struct file_operations proc_viocd_operations = {
154static int viocd_blk_open(struct block_device *bdev, fmode_t mode) 154static int viocd_blk_open(struct block_device *bdev, fmode_t mode)
155{ 155{
156 struct disk_info *di = bdev->bd_disk->private_data; 156 struct disk_info *di = bdev->bd_disk->private_data;
157 return cdrom_open(&di->viocd_info, bdev, mode); 157 int ret;
158
159 lock_kernel();
160 ret = cdrom_open(&di->viocd_info, bdev, mode);
161 unlock_kernel();
162
163 return ret;
158} 164}
159 165
160static int viocd_blk_release(struct gendisk *disk, fmode_t mode) 166static int viocd_blk_release(struct gendisk *disk, fmode_t mode)
161{ 167{
162 struct disk_info *di = disk->private_data; 168 struct disk_info *di = disk->private_data;
169 lock_kernel();
163 cdrom_release(&di->viocd_info, mode); 170 cdrom_release(&di->viocd_info, mode);
171 unlock_kernel();
164 return 0; 172 return 0;
165} 173}
166 174
@@ -168,7 +176,13 @@ static int viocd_blk_ioctl(struct block_device *bdev, fmode_t mode,
168 unsigned cmd, unsigned long arg) 176 unsigned cmd, unsigned long arg)
169{ 177{
170 struct disk_info *di = bdev->bd_disk->private_data; 178 struct disk_info *di = bdev->bd_disk->private_data;
171 return cdrom_ioctl(&di->viocd_info, bdev, mode, cmd, arg); 179 int ret;
180
181 lock_kernel();
182 ret = cdrom_ioctl(&di->viocd_info, bdev, mode, cmd, arg);
183 unlock_kernel();
184
185 return ret;
172} 186}
173 187
174static int viocd_blk_media_changed(struct gendisk *disk) 188static int viocd_blk_media_changed(struct gendisk *disk)
@@ -181,7 +195,7 @@ static const struct block_device_operations viocd_fops = {
181 .owner = THIS_MODULE, 195 .owner = THIS_MODULE,
182 .open = viocd_blk_open, 196 .open = viocd_blk_open,
183 .release = viocd_blk_release, 197 .release = viocd_blk_release,
184 .locked_ioctl = viocd_blk_ioctl, 198 .ioctl = viocd_blk_ioctl,
185 .media_changed = viocd_blk_media_changed, 199 .media_changed = viocd_blk_media_changed,
186}; 200};
187 201
@@ -202,9 +216,8 @@ static int viocd_open(struct cdrom_device_info *cdi, int purpose)
202 (u64)&we, VIOVERSION << 16, ((u64)device_no << 48), 216 (u64)&we, VIOVERSION << 16, ((u64)device_no << 48),
203 0, 0, 0); 217 0, 0, 0);
204 if (hvrc != 0) { 218 if (hvrc != 0) {
205 printk(VIOCD_KERN_WARNING 219 pr_warning("bad rc on HvCallEvent_signalLpEventFast %d\n",
206 "bad rc on HvCallEvent_signalLpEventFast %d\n", 220 (int)hvrc);
207 (int)hvrc);
208 return -EIO; 221 return -EIO;
209 } 222 }
210 223
@@ -213,8 +226,8 @@ static int viocd_open(struct cdrom_device_info *cdi, int purpose)
213 if (we.rc) { 226 if (we.rc) {
214 const struct vio_error_entry *err = 227 const struct vio_error_entry *err =
215 vio_lookup_rc(viocd_err_table, we.sub_result); 228 vio_lookup_rc(viocd_err_table, we.sub_result);
216 printk(VIOCD_KERN_WARNING "bad rc %d:0x%04X on open: %s\n", 229 pr_warning("bad rc %d:0x%04X on open: %s\n",
217 we.rc, we.sub_result, err->msg); 230 we.rc, we.sub_result, err->msg);
218 return -err->errno; 231 return -err->errno;
219 } 232 }
220 233
@@ -234,9 +247,8 @@ static void viocd_release(struct cdrom_device_info *cdi)
234 viopath_targetinst(viopath_hostLp), 0, 247 viopath_targetinst(viopath_hostLp), 0,
235 VIOVERSION << 16, ((u64)device_no << 48), 0, 0, 0); 248 VIOVERSION << 16, ((u64)device_no << 48), 0, 0, 0);
236 if (hvrc != 0) 249 if (hvrc != 0)
237 printk(VIOCD_KERN_WARNING 250 pr_warning("bad rc on HvCallEvent_signalLpEventFast %d\n",
238 "bad rc on HvCallEvent_signalLpEventFast %d\n", 251 (int)hvrc);
239 (int)hvrc);
240} 252}
241 253
242/* Send a read or write request to OS/400 */ 254/* Send a read or write request to OS/400 */
@@ -262,13 +274,12 @@ static int send_request(struct request *req)
262 274
263 sg_init_table(&sg, 1); 275 sg_init_table(&sg, 1);
264 if (blk_rq_map_sg(req->q, req, &sg) == 0) { 276 if (blk_rq_map_sg(req->q, req, &sg) == 0) {
265 printk(VIOCD_KERN_WARNING 277 pr_warning("error setting up scatter/gather list\n");
266 "error setting up scatter/gather list\n");
267 return -1; 278 return -1;
268 } 279 }
269 280
270 if (dma_map_sg(diskinfo->dev, &sg, 1, direction) == 0) { 281 if (dma_map_sg(diskinfo->dev, &sg, 1, direction) == 0) {
271 printk(VIOCD_KERN_WARNING "error allocating sg tce\n"); 282 pr_warning("error allocating sg tce\n");
272 return -1; 283 return -1;
273 } 284 }
274 dmaaddr = sg_dma_address(&sg); 285 dmaaddr = sg_dma_address(&sg);
@@ -284,7 +295,7 @@ static int send_request(struct request *req)
284 ((u64)DEVICE_NR(diskinfo) << 48) | dmaaddr, 295 ((u64)DEVICE_NR(diskinfo) << 48) | dmaaddr,
285 (u64)blk_rq_pos(req) * 512, len, 0); 296 (u64)blk_rq_pos(req) * 512, len, 0);
286 if (hvrc != HvLpEvent_Rc_Good) { 297 if (hvrc != HvLpEvent_Rc_Good) {
287 printk(VIOCD_KERN_WARNING "hv error on op %d\n", (int)hvrc); 298 pr_warning("hv error on op %d\n", (int)hvrc);
288 return -1; 299 return -1;
289 } 300 }
290 301
@@ -298,11 +309,10 @@ static void do_viocd_request(struct request_queue *q)
298 struct request *req; 309 struct request *req;
299 310
300 while ((rwreq == 0) && ((req = blk_fetch_request(q)) != NULL)) { 311 while ((rwreq == 0) && ((req = blk_fetch_request(q)) != NULL)) {
301 if (!blk_fs_request(req)) 312 if (req->cmd_type != REQ_TYPE_FS)
302 __blk_end_request_all(req, -EIO); 313 __blk_end_request_all(req, -EIO);
303 else if (send_request(req) < 0) { 314 else if (send_request(req) < 0) {
304 printk(VIOCD_KERN_WARNING 315 pr_warning("unable to send message to OS/400!\n");
305 "unable to send message to OS/400!");
306 __blk_end_request_all(req, -EIO); 316 __blk_end_request_all(req, -EIO);
307 } else 317 } else
308 rwreq++; 318 rwreq++;
@@ -327,8 +337,8 @@ static int viocd_media_changed(struct cdrom_device_info *cdi, int disc_nr)
327 (u64)&we, VIOVERSION << 16, ((u64)device_no << 48), 337 (u64)&we, VIOVERSION << 16, ((u64)device_no << 48),
328 0, 0, 0); 338 0, 0, 0);
329 if (hvrc != 0) { 339 if (hvrc != 0) {
330 printk(VIOCD_KERN_WARNING "bad rc on HvCallEvent_signalLpEventFast %d\n", 340 pr_warning("bad rc on HvCallEvent_signalLpEventFast %d\n",
331 (int)hvrc); 341 (int)hvrc);
332 return -EIO; 342 return -EIO;
333 } 343 }
334 344
@@ -338,9 +348,8 @@ static int viocd_media_changed(struct cdrom_device_info *cdi, int disc_nr)
338 if (we.rc) { 348 if (we.rc) {
339 const struct vio_error_entry *err = 349 const struct vio_error_entry *err =
340 vio_lookup_rc(viocd_err_table, we.sub_result); 350 vio_lookup_rc(viocd_err_table, we.sub_result);
341 printk(VIOCD_KERN_WARNING 351 pr_warning("bad rc %d:0x%04X on check_change: %s; Assuming no change\n",
342 "bad rc %d:0x%04X on check_change: %s; Assuming no change\n", 352 we.rc, we.sub_result, err->msg);
343 we.rc, we.sub_result, err->msg);
344 return 0; 353 return 0;
345 } 354 }
346 355
@@ -367,8 +376,8 @@ static int viocd_lock_door(struct cdrom_device_info *cdi, int locking)
367 (u64)&we, VIOVERSION << 16, 376 (u64)&we, VIOVERSION << 16,
368 (device_no << 48) | (flags << 32), 0, 0, 0); 377 (device_no << 48) | (flags << 32), 0, 0, 0);
369 if (hvrc != 0) { 378 if (hvrc != 0) {
370 printk(VIOCD_KERN_WARNING "bad rc on HvCallEvent_signalLpEventFast %d\n", 379 pr_warning("bad rc on HvCallEvent_signalLpEventFast %d\n",
371 (int)hvrc); 380 (int)hvrc);
372 return -EIO; 381 return -EIO;
373 } 382 }
374 383
@@ -455,8 +464,7 @@ static void vio_handle_cd_event(struct HvLpEvent *event)
455 return; 464 return;
456 /* First, we should NEVER get an int here...only acks */ 465 /* First, we should NEVER get an int here...only acks */
457 if (hvlpevent_is_int(event)) { 466 if (hvlpevent_is_int(event)) {
458 printk(VIOCD_KERN_WARNING 467 pr_warning("Yikes! got an int in viocd event handler!\n");
459 "Yikes! got an int in viocd event handler!\n");
460 if (hvlpevent_need_ack(event)) { 468 if (hvlpevent_need_ack(event)) {
461 event->xRc = HvLpEvent_Rc_InvalidSubtype; 469 event->xRc = HvLpEvent_Rc_InvalidSubtype;
462 HvCallEvent_ackLpEvent(event); 470 HvCallEvent_ackLpEvent(event);
@@ -510,10 +518,9 @@ return_complete:
510 const struct vio_error_entry *err = 518 const struct vio_error_entry *err =
511 vio_lookup_rc(viocd_err_table, 519 vio_lookup_rc(viocd_err_table,
512 bevent->sub_result); 520 bevent->sub_result);
513 printk(VIOCD_KERN_WARNING "request %p failed " 521 pr_warning("request %p failed with rc %d:0x%04X: %s\n",
514 "with rc %d:0x%04X: %s\n", 522 req, event->xRc,
515 req, event->xRc, 523 bevent->sub_result, err->msg);
516 bevent->sub_result, err->msg);
517 __blk_end_request_all(req, -EIO); 524 __blk_end_request_all(req, -EIO);
518 } else 525 } else
519 __blk_end_request_all(req, 0); 526 __blk_end_request_all(req, 0);
@@ -524,9 +531,8 @@ return_complete:
524 break; 531 break;
525 532
526 default: 533 default:
527 printk(VIOCD_KERN_WARNING 534 pr_warning("message with invalid subtype %0x04X!\n",
528 "message with invalid subtype %0x04X!\n", 535 event->xSubtype & VIOMINOR_SUBTYPE_MASK);
529 event->xSubtype & VIOMINOR_SUBTYPE_MASK);
530 if (hvlpevent_need_ack(event)) { 536 if (hvlpevent_need_ack(event)) {
531 event->xRc = HvLpEvent_Rc_InvalidSubtype; 537 event->xRc = HvLpEvent_Rc_InvalidSubtype;
532 HvCallEvent_ackLpEvent(event); 538 HvCallEvent_ackLpEvent(event);
@@ -593,23 +599,19 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
593 sprintf(c->name, VIOCD_DEVICE "%c", 'a' + deviceno); 599 sprintf(c->name, VIOCD_DEVICE "%c", 'a' + deviceno);
594 600
595 if (register_cdrom(c) != 0) { 601 if (register_cdrom(c) != 0) {
596 printk(VIOCD_KERN_WARNING "Cannot register viocd CD-ROM %s!\n", 602 pr_warning("Cannot register viocd CD-ROM %s!\n", c->name);
597 c->name);
598 goto out; 603 goto out;
599 } 604 }
600 printk(VIOCD_KERN_INFO "cd %s is iSeries resource %10.10s " 605 pr_info("cd %s is iSeries resource %10.10s type %4.4s, model %3.3s\n",
601 "type %4.4s, model %3.3s\n", 606 c->name, d->rsrcname, d->type, d->model);
602 c->name, d->rsrcname, d->type, d->model);
603 q = blk_init_queue(do_viocd_request, &viocd_reqlock); 607 q = blk_init_queue(do_viocd_request, &viocd_reqlock);
604 if (q == NULL) { 608 if (q == NULL) {
605 printk(VIOCD_KERN_WARNING "Cannot allocate queue for %s!\n", 609 pr_warning("Cannot allocate queue for %s!\n", c->name);
606 c->name);
607 goto out_unregister_cdrom; 610 goto out_unregister_cdrom;
608 } 611 }
609 gendisk = alloc_disk(1); 612 gendisk = alloc_disk(1);
610 if (gendisk == NULL) { 613 if (gendisk == NULL) {
611 printk(VIOCD_KERN_WARNING "Cannot create gendisk for %s!\n", 614 pr_warning("Cannot create gendisk for %s!\n", c->name);
612 c->name);
613 goto out_cleanup_queue; 615 goto out_cleanup_queue;
614 } 616 }
615 gendisk->major = VIOCD_MAJOR; 617 gendisk->major = VIOCD_MAJOR;
@@ -682,21 +684,19 @@ static int __init viocd_init(void)
682 return -ENODEV; 684 return -ENODEV;
683 } 685 }
684 686
685 printk(VIOCD_KERN_INFO "vers " VIOCD_VERS ", hosting partition %d\n", 687 pr_info("vers " VIOCD_VERS ", hosting partition %d\n", viopath_hostLp);
686 viopath_hostLp);
687 688
688 if (register_blkdev(VIOCD_MAJOR, VIOCD_DEVICE) != 0) { 689 if (register_blkdev(VIOCD_MAJOR, VIOCD_DEVICE) != 0) {
689 printk(VIOCD_KERN_WARNING "Unable to get major %d for %s\n", 690 pr_warning("Unable to get major %d for %s\n",
690 VIOCD_MAJOR, VIOCD_DEVICE); 691 VIOCD_MAJOR, VIOCD_DEVICE);
691 return -EIO; 692 return -EIO;
692 } 693 }
693 694
694 ret = viopath_open(viopath_hostLp, viomajorsubtype_cdio, 695 ret = viopath_open(viopath_hostLp, viomajorsubtype_cdio,
695 MAX_CD_REQ + 2); 696 MAX_CD_REQ + 2);
696 if (ret) { 697 if (ret) {
697 printk(VIOCD_KERN_WARNING 698 pr_warning("error opening path to host partition %d\n",
698 "error opening path to host partition %d\n", 699 viopath_hostLp);
699 viopath_hostLp);
700 goto out_unregister; 700 goto out_unregister;
701 } 701 }
702 702