History

nubus: Clean up printk calls

Some long forgotten changes from the linux-mac68k CVS: Fix swapped DrvrSW and DrvrHW values in printk message. Suppress debug printk messages. Avoid console_loglevel misuse. The original commits are these: http://linux-mac68k.cvs.sourceforge.net/viewvc/linux-mac68k/linux-mac68k/drivers/nubus/nubus.c?r1=1.22.2.1&r2=1.22.2.2&pathrev=linux-2_2 http://linux-mac68k.cvs.sourceforge.net/viewvc/linux-mac68k/linux-mac68k/drivers/nubus/nubus.c?r1=1.21&r2=1.22&pathrev=linux-2_2 The CVS commits fell short of removing all of the misuse of console_loglevel in nubus_add_board() so I finished the job. I've also added some missing message severity levels and converted a printk loop to the MAC address "%pM" format specifier.

David Huggins-Daines committed 9 years ago

Commit 71ae40e1 parent e36b9911 file · +65 −84Browse files

Unified · Split

drivers/nubus/nubus.c+65−84
@@ -103,7 +103,7 @@ static void nubus_rewind(unsigned char **ptr, int len, int map) · 102 unmodified lines
103103
104104 /* Sanity check */
105105 if(len > 65536)
106− printk(KERN_ERR "rewind of 0x%08x!\n", len);
106+ pr_err("rewind of 0x%08x!\n", len);
107107 while(len)
108108 {
109109 do
@@ -120,7 +120,7 @@ static void nubus_advance(unsigned char **ptr, int len, int map) · 10 unmodified lines
120120 {
121121 unsigned char *p = *ptr;
122122 if(len>65536)
123− printk(KERN_ERR "advance of 0x%08x!\n", len);
123+ pr_err("advance of 0x%08x!\n", len);
124124 while(len)
125125 {
126126 while(not_useful(p,map))
@@ -375,14 +375,14 @@ static int __init nubus_show_display_resource(struct nubus_dev* dev, · 248 unmodified lines
375375 {
376376 switch (ent->type) {
377377 case NUBUS_RESID_GAMMADIR:
378− printk(KERN_INFO " gamma directory offset: 0x%06x\n", ent->data);
378+ pr_info(" gamma directory offset: 0x%06x\n", ent->data);
379379 break;
380380 case 0x0080 ... 0x0085:
381− printk(KERN_INFO " mode %02X info offset: 0x%06x\n",
381+ pr_info(" mode %02X info offset: 0x%06x\n",
382382 ent->type, ent->data);
383383 break;
384384 default:
385− printk(KERN_INFO " unknown resource %02X, data 0x%06x\n",
385+ pr_info(" unknown resource %02X, data 0x%06x\n",
386386 ent->type, ent->data);
387387 }
388388 return 0;
@@ -395,18 +395,13 @@ static int __init nubus_show_network_resource(struct nubus_dev* dev, · 6 unmodified lines
395395 case NUBUS_RESID_MAC_ADDRESS:
396396 {
397397 char addr[6];
398− int i;
399398
400399 nubus_get_rsrc_mem(addr, ent, 6);
401− printk(KERN_INFO " MAC address: ");
402− for (i = 0; i < 6; i++)
403− printk("%02x%s", addr[i] & 0xff,
404− i == 5 ? "" : ":");
405− printk("\n");
400+ pr_info(" MAC address: %pM\n", addr);
406401 break;
407402 }
408403 default:
409− printk(KERN_INFO " unknown resource %02X, data 0x%06x\n",
404+ pr_info(" unknown resource %02X, data 0x%06x\n",
410405 ent->type, ent->data);
411406 }
412407 return 0;
@@ -420,7 +415,7 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev, · 7 unmodified lines
420415 {
421416 unsigned long meminfo[2];
422417 nubus_get_rsrc_mem(&meminfo, ent, 8);
423− printk(KERN_INFO " memory: [ 0x%08lx 0x%08lx ]\n",
418+ pr_info(" memory: [ 0x%08lx 0x%08lx ]\n",
424419 meminfo[0], meminfo[1]);
425420 break;
426421 }
@@ -428,12 +423,12 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev, · 1 unmodified line
428423 {
429424 unsigned long rominfo[2];
430425 nubus_get_rsrc_mem(&rominfo, ent, 8);
431− printk(KERN_INFO " ROM: [ 0x%08lx 0x%08lx ]\n",
426+ pr_info(" ROM: [ 0x%08lx 0x%08lx ]\n",
432427 rominfo[0], rominfo[1]);
433428 break;
434429 }
435430 default:
436− printk(KERN_INFO " unknown resource %02X, data 0x%06x\n",
431+ pr_info(" unknown resource %02X, data 0x%06x\n",
437432 ent->type, ent->data);
438433 }
439434 return 0;
@@ -453,7 +448,7 @@ static int __init nubus_show_private_resource(struct nubus_dev* dev, · 13 unmodified lines
453448 nubus_show_cpu_resource(dev, ent);
454449 break;
455450 default:
456− printk(KERN_INFO " unknown resource %02X, data 0x%06x\n",
451+ pr_info(" unknown resource %02X, data 0x%06x\n",
457452 ent->type, ent->data);
458453 }
459454 return 0;
@@ -468,16 +463,15 @@ static struct nubus_dev* __init · 8 unmodified lines
468463 struct nubus_dirent ent;
469464 struct nubus_dev* dev;
470465
471− printk(KERN_INFO " Function 0x%02x:\n", parent->type);
466+ pr_info(" Function 0x%02x:\n", parent->type);
472467 nubus_get_subdir(parent, &dir);
473468
474469 /* Apple seems to have botched the ROM on the IIx */
475470 if (slot == 0 && (unsigned long)dir.base % 2)
476471 dir.base += 1;
477472
478− if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG)
479− printk(KERN_DEBUG "nubus_get_functional_resource: parent is 0x%p, dir is 0x%p\n",
480− parent->base, dir.base);
473+ pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
474+ __func__, parent->base, dir.base);
481475
482476 /* Actually we should probably panic if this fails */
483477 if ((dev = kzalloc(sizeof(*dev), GFP_ATOMIC)) == NULL)
@@ -498,14 +492,14 @@ static struct nubus_dev* __init · 14 unmodified lines
498492 dev->type = nbtdata[1];
499493 dev->dr_sw = nbtdata[2];
500494 dev->dr_hw = nbtdata[3];
501− printk(KERN_INFO " type: [cat 0x%x type 0x%x hw 0x%x sw 0x%x]\n",
502− nbtdata[0], nbtdata[1], nbtdata[2], nbtdata[3]);
495+ pr_info(" type: [cat 0x%x type 0x%x sw 0x%x hw 0x%x]\n",
496+ nbtdata[0], nbtdata[1], nbtdata[2], nbtdata[3]);
503497 break;
504498 }
505499 case NUBUS_RESID_NAME:
506500 {
507501 nubus_get_rsrc_str(dev->name, &ent, 64);
508− printk(KERN_INFO " name: %s\n", dev->name);
502+ pr_info(" name: %s\n", dev->name);
509503 break;
510504 }
511505 case NUBUS_RESID_DRVRDIR:
@@ -517,8 +511,7 @@ static struct nubus_dev* __init · 5 unmodified lines
517511 nubus_get_subdir(&ent, &drvr_dir);
518512 nubus_readdir(&drvr_dir, &drvr_ent);
519513 dev->driver = nubus_dirptr(&drvr_ent);
520− printk(KERN_INFO " driver at: 0x%p\n",
521− dev->driver);
514+ pr_info(" driver at: 0x%p\n", dev->driver);
522515 break;
523516 }
524517 case NUBUS_RESID_MINOR_BASEOS:
@@ -526,22 +519,20 @@ static struct nubus_dev* __init · 1 unmodified line
526519 multiple framebuffers. It might be handy
527520 for Ethernet as well */
528521 nubus_get_rsrc_mem(&dev->iobase, &ent, 4);
529− printk(KERN_INFO " memory offset: 0x%08lx\n",
530− dev->iobase);
522+ pr_info(" memory offset: 0x%08lx\n", dev->iobase);
531523 break;
532524 case NUBUS_RESID_MINOR_LENGTH:
533525 /* Ditto */
534526 nubus_get_rsrc_mem(&dev->iosize, &ent, 4);
535− printk(KERN_INFO " memory length: 0x%08lx\n",
536− dev->iosize);
527+ pr_info(" memory length: 0x%08lx\n", dev->iosize);
537528 break;
538529 case NUBUS_RESID_FLAGS:
539530 dev->flags = ent.data;
540− printk(KERN_INFO " flags: 0x%06x\n", dev->flags);
531+ pr_info(" flags: 0x%06x\n", dev->flags);
541532 break;
542533 case NUBUS_RESID_HWDEVID:
543534 dev->hwdevid = ent.data;
544− printk(KERN_INFO " hwdevid: 0x%06x\n", dev->hwdevid);
535+ pr_info(" hwdevid: 0x%06x\n", dev->hwdevid);
545536 break;
546537 default:
547538 /* Local/Private resources have their own
@@ -568,11 +559,10 @@ static int __init nubus_get_vidnames(struct nubus_board* board, · 20 unmodified lines
568559 char name[32];
569560 };
570561
571− printk(KERN_INFO " video modes supported:\n");
562+ pr_info(" video modes supported:\n");
572563 nubus_get_subdir(parent, &dir);
573− if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG)
574− printk(KERN_DEBUG "nubus_get_vidnames: parent is 0x%p, dir is 0x%p\n",
575− parent->base, dir.base);
564+ pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
565+ __func__, parent->base, dir.base);
576566
577567 while(nubus_readdir(&dir, &ent) != -1)
578568 {
@@ -587,7 +577,7 @@ static int __init nubus_get_vidnames(struct nubus_board* board, · 8 unmodified lines
587577 size = sizeof(mode) - 1;
588578 memset(&mode, 0, sizeof(mode));
589579 nubus_get_rsrc_mem(&mode, &ent, size);
590− printk (KERN_INFO " %02X: (%02X) %s\n", ent.type,
580+ pr_info(" %02X: (%02X) %s\n", ent.type,
591581 mode.id, mode.name);
592582 }
593583 return 0;
@@ -602,21 +592,21 @@ static int __init nubus_get_icon(struct nubus_board* board, · 8 unmodified lines
602592 int x, y;
603593
604594 nubus_get_rsrc_mem(&icon, ent, 128);
605− printk(KERN_INFO " icon:\n");
595+ pr_info(" icon:\n");
606596
607597 /* We should actually plot these somewhere in the framebuffer
608598 init. This is just to demonstrate that they do, in fact,
609599 exist */
610600 for (y = 0; y < 32; y++) {
611− printk(KERN_INFO " ");
601+ pr_info(" ");
612602 for (x = 0; x < 32; x++) {
613603 if (icon[y*4 + x/8]
614604 & (0x80 >> (x%8)))
615− printk("*");
605+ pr_cont("*");
616606 else
617− printk(" ");
607+ pr_cont(" ");
618608 }
619− printk("\n");
609+ pr_cont("\n");
620610 }
621611 return 0;
622612 }
@@ -629,11 +619,10 @@ static int __init nubus_get_vendorinfo(struct nubus_board* board, · 6 unmodified lines
629619 static char* vendor_fields[6] = {"ID", "serial", "revision",
630620 "part", "date", "unknown field"};
631621
632− printk(KERN_INFO " vendor info:\n");
622+ pr_info(" vendor info:\n");
633623 nubus_get_subdir(parent, &dir);
634− if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG)
635− printk(KERN_DEBUG "nubus_get_vendorinfo: parent is 0x%p, dir is 0x%p\n",
636− parent->base, dir.base);
624+ pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
625+ __func__, parent->base, dir.base);
637626
638627 while(nubus_readdir(&dir, &ent) != -1)
639628 {
@@ -643,8 +632,7 @@ static int __init nubus_get_vendorinfo(struct nubus_board* board, · 3 unmodified lines
643632 nubus_get_rsrc_str(name, &ent, 64);
644633 if (ent.type > 5)
645634 ent.type = 5;
646− printk(KERN_INFO " %s: %s\n",
647− vendor_fields[ent.type-1], name);
635+ pr_info(" %s: %s\n", vendor_fields[ent.type - 1], name);
648636 }
649637 return 0;
650638 }
@@ -656,9 +644,8 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, · 5 unmodified lines
656644 struct nubus_dirent ent;
657645
658646 nubus_get_subdir(parent, &dir);
659− if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG)
660− printk(KERN_DEBUG "nubus_get_board_resource: parent is 0x%p, dir is 0x%p\n",
661− parent->base, dir.base);
647+ pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
648+ __func__, parent->base, dir.base);
662649
663650 while(nubus_readdir(&dir, &ent) != -1)
664651 {
@@ -670,38 +657,37 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, · 5 unmodified lines
670657 useful except insofar as it tells us that
671658 we really are looking at a board resource. */
672659 nubus_get_rsrc_mem(nbtdata, &ent, 8);
673− printk(KERN_INFO " type: [cat 0x%x type 0x%x hw 0x%x sw 0x%x]\n",
674− nbtdata[0], nbtdata[1], nbtdata[2],
675− nbtdata[3]);
660+ pr_info(" type: [cat 0x%x type 0x%x sw 0x%x hw 0x%x]\n",
661+ nbtdata[0], nbtdata[1], nbtdata[2], nbtdata[3]);
676662 if (nbtdata[0] != 1 || nbtdata[1] != 0 ||
677663 nbtdata[2] != 0 || nbtdata[3] != 0)
678− printk(KERN_ERR "this sResource is not a board resource!\n");
664+ pr_err("this sResource is not a board resource!\n");
679665 break;
680666 }
681667 case NUBUS_RESID_NAME:
682668 nubus_get_rsrc_str(board->name, &ent, 64);
683− printk(KERN_INFO " name: %s\n", board->name);
669+ pr_info(" name: %s\n", board->name);
684670 break;
685671 case NUBUS_RESID_ICON:
686672 nubus_get_icon(board, &ent);
687673 break;
688674 case NUBUS_RESID_BOARDID:
689− printk(KERN_INFO " board id: 0x%x\n", ent.data);
675+ pr_info(" board id: 0x%x\n", ent.data);
690676 break;
691677 case NUBUS_RESID_PRIMARYINIT:
692− printk(KERN_INFO " primary init offset: 0x%06x\n", ent.data);
678+ pr_info(" primary init offset: 0x%06x\n", ent.data);
693679 break;
694680 case NUBUS_RESID_VENDORINFO:
695681 nubus_get_vendorinfo(board, &ent);
696682 break;
697683 case NUBUS_RESID_FLAGS:
698− printk(KERN_INFO " flags: 0x%06x\n", ent.data);
684+ pr_info(" flags: 0x%06x\n", ent.data);
699685 break;
700686 case NUBUS_RESID_HWDEVID:
701− printk(KERN_INFO " hwdevid: 0x%06x\n", ent.data);
687+ pr_info(" hwdevid: 0x%06x\n", ent.data);
702688 break;
703689 case NUBUS_RESID_SECONDINIT:
704− printk(KERN_INFO " secondary init offset: 0x%06x\n", ent.data);
690+ pr_info(" secondary init offset: 0x%06x\n", ent.data);
705691 break;
706692 /* WTF isn't this in the functional resources? */
707693 case NUBUS_RESID_VIDNAMES:
@@ -709,11 +695,11 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, · 1 unmodified line
709695 break;
710696 /* Same goes for this */
711697 case NUBUS_RESID_VIDMODES:
712− printk(KERN_INFO " video mode parameter directory offset: 0x%06x\n",
698+ pr_info(" video mode parameter directory offset: 0x%06x\n",
713699 ent.data);
714700 break;
715701 default:
716− printk(KERN_INFO " unknown resource %02X, data 0x%06x\n",
702+ pr_info(" unknown resource %02X, data 0x%06x\n",
717703 ent.type, ent.data);
718704 }
719705 }
@@ -818,21 +804,17 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) · 98 unmodified lines
818804 board->fblock = rp;
819805
820806 /* Dump the format block for debugging purposes */
821− if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) {
822− int i;
823− printk(KERN_DEBUG "Slot %X, format block at 0x%p\n",
824− slot, rp);
825− printk(KERN_DEBUG "Format block: ");
826− for (i = 0; i < FORMAT_BLOCK_SIZE; i += 4) {
827− unsigned short foo, bar;
828− foo = nubus_get_rom(&rp, 2, bytelanes);
829− bar = nubus_get_rom(&rp, 2, bytelanes);
830− printk("%04x %04x ", foo, bar);
831− }
832− printk("\n");
833− rp = board->fblock;
834− }
835−
807+ pr_debug("Slot %X, format block at 0x%p:\n", slot, rp);
808+ pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes));
809+ pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes));
810+ pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes));
811+ pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes));
812+ pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes));
813+ pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes));
814+ pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes));
815+ pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes));
816+ rp = board->fblock;
817+
836818 board->slot = slot;
837819 board->slot_addr = (unsigned long) nubus_slot_addr(slot);
838820 board->doffset = nubus_get_rom(&rp, 4, bytelanes);
@@ -850,10 +832,10 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) · 11 unmodified lines
850832
851833 /* Directory offset should be small and negative... */
852834 if(!(board->doffset & 0x00FF0000))
853− printk(KERN_WARNING "Dodgy doffset!\n");
835+ pr_warn("Dodgy doffset!\n");
854836 dpat = nubus_get_rom(&rp, 4, bytelanes);
855837 if(dpat != NUBUS_TEST_PATTERN)
856− printk(KERN_WARNING "Wrong test pattern %08lx!\n", dpat);
838+ pr_warn("Wrong test pattern %08lx!\n", dpat);
857839
858840 /*
859841 * I wonder how the CRC is meant to work -
@@ -867,7 +849,7 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) · 7 unmodified lines
867849 nubus_get_root_dir(board, &dir);
868850
869851 /* We're ready to rock */
870− printk(KERN_INFO "Slot %X:\n", slot);
852+ pr_info("Slot %X:\n", slot);
871853
872854 /* Each slot should have one board resource and any number of
873855 functional resources. So we'll fill in some fields in the
@@ -876,10 +858,10 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) · 2 unmodified lines
876858 for each of them. */
877859 if (nubus_readdir(&dir, &ent) == -1) {
878860 /* We can't have this! */
879− printk(KERN_ERR "Board resource not found!\n");
861+ pr_err("Board resource not found!\n");
880862 return NULL;
881863 } else {
882− printk(KERN_INFO " Board resource:\n");
864+ pr_info(" Board resource:\n");
883865 nubus_get_board_resource(board, slot, &ent);
884866 }
885867
@@ -929,7 +911,6 @@ void __init nubus_probe_slot(int slot) · 43 unmodified lines
929911 if (!card_present)
930912 continue;
931913
932− printk(KERN_DEBUG "Now probing slot %X at %p\n", slot, rp);
933914 dp = *rp;
934915 if(dp == 0)
935916 continue;
@@ -984,7 +965,7 @@ static int __init nubus_init(void) · 48 unmodified lines
984965 #endif
985966
986967 /* And probe */
987− printk("NuBus: Scanning NuBus slots.\n");
968+ pr_info("NuBus: Scanning NuBus slots.\n");
988969 nubus_devices = NULL;
989970 nubus_boards = NULL;
990971 nubus_scan_bus();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t