forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/parport/ieee1284.c
....@@ -31,12 +31,6 @@
3131 #undef DEBUG /* Don't want a garbled console */
3232 #endif
3333
34
-#ifdef DEBUG
35
-#define DPRINTK(stuff...) printk (stuff)
36
-#else
37
-#define DPRINTK(stuff...)
38
-#endif
39
-
4034 /* Make parport_wait_peripheral wake up.
4135 * It will be useful to call this from an interrupt handler. */
4236 static void parport_ieee1284_wakeup (struct parport *port)
....@@ -258,16 +252,15 @@
258252 PARPORT_STATUS_PAPEROUT,
259253 PARPORT_STATUS_PAPEROUT);
260254 if (r)
261
- DPRINTK (KERN_INFO "%s: Timeout at event 49\n",
255
+ pr_debug("%s: Timeout at event 49\n",
262256 port->name);
263257
264258 parport_data_forward (port);
265
- DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n",
266
- port->name);
259
+ pr_debug("%s: ECP direction: forward\n", port->name);
267260 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
268261 }
269262
270
- /* fall through */
263
+ fallthrough;
271264
272265 default:
273266 /* Terminate from all other modes. */
....@@ -281,8 +274,7 @@
281274 /* Event 24: nAck goes low */
282275 r = parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0);
283276 if (r)
284
- DPRINTK (KERN_INFO "%s: Timeout at event 24\n",
285
- port->name);
277
+ pr_debug("%s: Timeout at event 24\n", port->name);
286278
287279 /* Event 25: Set nAutoFd low */
288280 parport_frob_control (port,
....@@ -294,8 +286,7 @@
294286 PARPORT_STATUS_ACK,
295287 PARPORT_STATUS_ACK);
296288 if (r)
297
- DPRINTK (KERN_INFO "%s: Timeout at event 27\n",
298
- port->name);
289
+ pr_debug("%s: Timeout at event 27\n", port->name);
299290
300291 /* Event 29: Set nAutoFd high */
301292 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
....@@ -304,8 +295,7 @@
304295 port->ieee1284.mode = IEEE1284_MODE_COMPAT;
305296 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
306297
307
- DPRINTK (KERN_DEBUG "%s: In compatibility (forward idle) mode\n",
308
- port->name);
298
+ pr_debug("%s: In compatibility (forward idle) mode\n", port->name);
309299 }
310300 #endif /* IEEE1284 support */
311301
....@@ -329,7 +319,7 @@
329319 #ifndef CONFIG_PARPORT_1284
330320 if (mode == IEEE1284_MODE_COMPAT)
331321 return 0;
332
- printk (KERN_ERR "parport: IEEE1284 not supported in this kernel\n");
322
+ pr_err("parport: IEEE1284 not supported in this kernel\n");
333323 return -1;
334324 #else
335325 int m = mode & ~IEEE1284_ADDR;
....@@ -406,8 +396,7 @@
406396 PARPORT_CONTROL_SELECT
407397 | PARPORT_CONTROL_AUTOFD,
408398 PARPORT_CONTROL_SELECT);
409
- DPRINTK (KERN_DEBUG
410
- "%s: Peripheral not IEEE1284 compliant (0x%02X)\n",
399
+ pr_debug("%s: Peripheral not IEEE1284 compliant (0x%02X)\n",
411400 port->name, parport_read_status (port));
412401 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
413402 return -1; /* Not IEEE1284 compliant */
....@@ -430,8 +419,7 @@
430419 PARPORT_STATUS_ACK,
431420 PARPORT_STATUS_ACK)) {
432421 /* This shouldn't really happen with a compliant device. */
433
- DPRINTK (KERN_DEBUG
434
- "%s: Mode 0x%02x not supported? (0x%02x)\n",
422
+ pr_debug("%s: Mode 0x%02x not supported? (0x%02x)\n",
435423 port->name, mode, port->ops->read_status (port));
436424 parport_ieee1284_terminate (port);
437425 return 1;
....@@ -442,7 +430,7 @@
442430 /* xflag should be high for all modes other than nibble (0). */
443431 if (mode && !xflag) {
444432 /* Mode not supported. */
445
- DPRINTK (KERN_DEBUG "%s: Mode 0x%02x rejected by peripheral\n",
433
+ pr_debug("%s: Mode 0x%02x rejected by peripheral\n",
446434 port->name, mode);
447435 parport_ieee1284_terminate (port);
448436 return 1;
....@@ -463,9 +451,7 @@
463451 /* Event 52: nAck goes low */
464452 if (parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0)) {
465453 /* This peripheral is _very_ slow. */
466
- DPRINTK (KERN_DEBUG
467
- "%s: Event 52 didn't happen\n",
468
- port->name);
454
+ pr_debug("%s: Event 52 didn't happen\n", port->name);
469455 parport_ieee1284_terminate (port);
470456 return 1;
471457 }
....@@ -481,10 +467,9 @@
481467 PARPORT_STATUS_ACK)) {
482468 /* This shouldn't really happen with a compliant
483469 * device. */
484
- DPRINTK (KERN_DEBUG
485
- "%s: Mode 0x%02x not supported? (0x%02x)\n",
470
+ pr_debug("%s: Mode 0x%02x not supported? (0x%02x)\n",
486471 port->name, mode,
487
- port->ops->read_status (port));
472
+ port->ops->read_status(port));
488473 parport_ieee1284_terminate (port);
489474 return 1;
490475 }
....@@ -495,8 +480,8 @@
495480 /* xflag should be high. */
496481 if (!xflag) {
497482 /* Extended mode not supported. */
498
- DPRINTK (KERN_DEBUG "%s: Extended mode 0x%02x not "
499
- "supported\n", port->name, mode);
483
+ pr_debug("%s: Extended mode 0x%02x not supported\n",
484
+ port->name, mode);
500485 parport_ieee1284_terminate (port);
501486 return 1;
502487 }
....@@ -505,7 +490,7 @@
505490 }
506491
507492 /* Mode is supported */
508
- DPRINTK (KERN_DEBUG "%s: In mode 0x%02x\n", port->name, mode);
493
+ pr_debug("%s: In mode 0x%02x\n", port->name, mode);
509494 port->ieee1284.mode = mode;
510495
511496 /* But ECP is special */
....@@ -522,13 +507,11 @@
522507 PARPORT_STATUS_PAPEROUT,
523508 PARPORT_STATUS_PAPEROUT);
524509 if (r) {
525
- DPRINTK (KERN_INFO "%s: Timeout at event 31\n",
526
- port->name);
510
+ pr_debug("%s: Timeout at event 31\n", port->name);
527511 }
528512
529513 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
530
- DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n",
531
- port->name);
514
+ pr_debug("%s: ECP direction: forward\n", port->name);
532515 } else switch (mode) {
533516 case IEEE1284_MODE_NIBBLE:
534517 case IEEE1284_MODE_BYTE:
....@@ -573,7 +556,7 @@
573556 if (port->ieee1284.phase == IEEE1284_PH_REV_IDLE) {
574557 /* An interrupt in this phase means that data
575558 * is now available. */
576
- DPRINTK (KERN_DEBUG "%s: Data available\n", port->name);
559
+ pr_debug("%s: Data available\n", port->name);
577560 parport_ieee1284_ack_data_avail (port);
578561 }
579562 #endif /* IEEE1284 support */
....@@ -615,15 +598,14 @@
615598 case IEEE1284_MODE_NIBBLE:
616599 case IEEE1284_MODE_BYTE:
617600 parport_negotiate (port, IEEE1284_MODE_COMPAT);
618
- /* fall through */
601
+ fallthrough;
619602 case IEEE1284_MODE_COMPAT:
620
- DPRINTK (KERN_DEBUG "%s: Using compatibility mode\n",
621
- port->name);
603
+ pr_debug("%s: Using compatibility mode\n", port->name);
622604 fn = port->ops->compat_write_data;
623605 break;
624606
625607 case IEEE1284_MODE_EPP:
626
- DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name);
608
+ pr_debug("%s: Using EPP mode\n", port->name);
627609 if (addr) {
628610 fn = port->ops->epp_write_addr;
629611 } else {
....@@ -631,8 +613,7 @@
631613 }
632614 break;
633615 case IEEE1284_MODE_EPPSWE:
634
- DPRINTK (KERN_DEBUG "%s: Using software-emulated EPP mode\n",
635
- port->name);
616
+ pr_debug("%s: Using software-emulated EPP mode\n", port->name);
636617 if (addr) {
637618 fn = parport_ieee1284_epp_write_addr;
638619 } else {
....@@ -641,7 +622,7 @@
641622 break;
642623 case IEEE1284_MODE_ECP:
643624 case IEEE1284_MODE_ECPRLE:
644
- DPRINTK (KERN_DEBUG "%s: Using ECP mode\n", port->name);
625
+ pr_debug("%s: Using ECP mode\n", port->name);
645626 if (addr) {
646627 fn = port->ops->ecp_write_addr;
647628 } else {
....@@ -650,8 +631,7 @@
650631 break;
651632
652633 case IEEE1284_MODE_ECPSWE:
653
- DPRINTK (KERN_DEBUG "%s: Using software-emulated ECP mode\n",
654
- port->name);
634
+ pr_debug("%s: Using software-emulated ECP mode\n", port->name);
655635 /* The caller has specified that it must be emulated,
656636 * even if we have ECP hardware! */
657637 if (addr) {
....@@ -662,13 +642,13 @@
662642 break;
663643
664644 default:
665
- DPRINTK (KERN_DEBUG "%s: Unknown mode 0x%02x\n", port->name,
666
- port->ieee1284.mode);
645
+ pr_debug("%s: Unknown mode 0x%02x\n",
646
+ port->name, port->ieee1284.mode);
667647 return -ENOSYS;
668648 }
669649
670650 retval = (*fn) (port, buffer, len, 0);
671
- DPRINTK (KERN_DEBUG "%s: wrote %d/%d bytes\n", port->name, retval, len);
651
+ pr_debug("%s: wrote %zd/%zu bytes\n", port->name, retval, len);
672652 return retval;
673653 #endif /* IEEE1284 support */
674654 }
....@@ -694,7 +674,7 @@
694674 ssize_t parport_read (struct parport *port, void *buffer, size_t len)
695675 {
696676 #ifndef CONFIG_PARPORT_1284
697
- printk (KERN_ERR "parport: IEEE1284 not supported in this kernel\n");
677
+ pr_err("parport: IEEE1284 not supported in this kernel\n");
698678 return -ENODEV;
699679 #else
700680 int mode = port->physport->ieee1284.mode;
....@@ -715,26 +695,26 @@
715695 if ((port->physport->modes & PARPORT_MODE_TRISTATE) &&
716696 !parport_negotiate (port, IEEE1284_MODE_BYTE)) {
717697 /* got into BYTE mode OK */
718
- DPRINTK (KERN_DEBUG "%s: Using byte mode\n", port->name);
698
+ pr_debug("%s: Using byte mode\n", port->name);
719699 fn = port->ops->byte_read_data;
720700 break;
721701 }
722702 if (parport_negotiate (port, IEEE1284_MODE_NIBBLE)) {
723703 return -EIO;
724704 }
725
- /* fall through to NIBBLE */
705
+ fallthrough; /* to NIBBLE */
726706 case IEEE1284_MODE_NIBBLE:
727
- DPRINTK (KERN_DEBUG "%s: Using nibble mode\n", port->name);
707
+ pr_debug("%s: Using nibble mode\n", port->name);
728708 fn = port->ops->nibble_read_data;
729709 break;
730710
731711 case IEEE1284_MODE_BYTE:
732
- DPRINTK (KERN_DEBUG "%s: Using byte mode\n", port->name);
712
+ pr_debug("%s: Using byte mode\n", port->name);
733713 fn = port->ops->byte_read_data;
734714 break;
735715
736716 case IEEE1284_MODE_EPP:
737
- DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name);
717
+ pr_debug("%s: Using EPP mode\n", port->name);
738718 if (addr) {
739719 fn = port->ops->epp_read_addr;
740720 } else {
....@@ -742,8 +722,7 @@
742722 }
743723 break;
744724 case IEEE1284_MODE_EPPSWE:
745
- DPRINTK (KERN_DEBUG "%s: Using software-emulated EPP mode\n",
746
- port->name);
725
+ pr_debug("%s: Using software-emulated EPP mode\n", port->name);
747726 if (addr) {
748727 fn = parport_ieee1284_epp_read_addr;
749728 } else {
....@@ -752,19 +731,18 @@
752731 break;
753732 case IEEE1284_MODE_ECP:
754733 case IEEE1284_MODE_ECPRLE:
755
- DPRINTK (KERN_DEBUG "%s: Using ECP mode\n", port->name);
734
+ pr_debug("%s: Using ECP mode\n", port->name);
756735 fn = port->ops->ecp_read_data;
757736 break;
758737
759738 case IEEE1284_MODE_ECPSWE:
760
- DPRINTK (KERN_DEBUG "%s: Using software-emulated ECP mode\n",
761
- port->name);
739
+ pr_debug("%s: Using software-emulated ECP mode\n", port->name);
762740 fn = parport_ieee1284_ecp_read_data;
763741 break;
764742
765743 default:
766
- DPRINTK (KERN_DEBUG "%s: Unknown mode 0x%02x\n", port->name,
767
- port->physport->ieee1284.mode);
744
+ pr_debug("%s: Unknown mode 0x%02x\n",
745
+ port->name, port->physport->ieee1284.mode);
768746 return -ENOSYS;
769747 }
770748