Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

firewire: net: use dev_printk API

Change the log line prefix from "firewire_net: " to "net firewire0: "
etc. for the case that several RFC 2734 interfaces are being used in the
same machine.

Note, the netdev_printk API is not very useful to firewire-net.
netdev_notice(net, "abc\n") would result in irritating messages like
"firewire_ohci 0000:0a:00.0: firewire0: abc". Nor would a dev_printk on
the fw_unit.device to which firewire-net is being bound be useful,
because there are generally multiple ones of those per interface (from
all RFC 2734 peers on the bus, the local node being only one of them).

In the initialization message of each interface, log the PCI device
name of the card which is parent of the netdevice instead of the GUID
of the peer which was semi-randomly used to establish the netdevice.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+21 -20
+21 -20
drivers/firewire/net.c
··· 256 256 if (get_unaligned_be16(&h->h_proto) == ETH_P_IP) 257 257 return arp_find((unsigned char *)&h->h_dest, skb); 258 258 259 - fw_notify("%s: unable to resolve type %04x addresses\n", 260 - skb->dev->name, be16_to_cpu(h->h_proto)); 259 + dev_notice(&skb->dev->dev, "unable to resolve type %04x addresses\n", 260 + be16_to_cpu(h->h_proto)); 261 261 return 0; 262 262 } 263 263 ··· 369 369 370 370 new = kmalloc(sizeof(*new), GFP_ATOMIC); 371 371 if (!new) { 372 - fw_error("out of memory\n"); 372 + dev_err(&pd->skb->dev->dev, "out of memory\n"); 373 373 return NULL; 374 374 } 375 375 ··· 414 414 fail_w_new: 415 415 kfree(new); 416 416 fail: 417 - fw_error("out of memory\n"); 417 + dev_err(&net->dev, "out of memory\n"); 418 418 419 419 return NULL; 420 420 } ··· 554 554 sspd = arp1394->sspd; 555 555 /* Sanity check. OS X 10.3 PPC reportedly sends 131. */ 556 556 if (sspd > SCODE_3200) { 557 - fw_notify("sspd %x out of range\n", sspd); 557 + dev_notice(&net->dev, "sspd %x out of range\n", sspd); 558 558 sspd = SCODE_3200; 559 559 } 560 560 max_payload = fwnet_max_payload(arp1394->max_rec, sspd); ··· 574 574 spin_unlock_irqrestore(&dev->lock, flags); 575 575 576 576 if (!peer) { 577 - fw_notify("No peer for ARP packet from %016llx\n", 578 - (unsigned long long)peer_guid); 577 + dev_notice(&net->dev, 578 + "no peer for ARP packet from %016llx\n", 579 + (unsigned long long)peer_guid); 579 580 goto no_peer; 580 581 } 581 582 ··· 692 691 693 692 skb = dev_alloc_skb(len + net->hard_header_len + 15); 694 693 if (unlikely(!skb)) { 695 - fw_error("out of memory\n"); 694 + dev_err(&net->dev, "out of memory\n"); 696 695 net->stats.rx_dropped++; 697 696 698 697 return -ENOMEM; ··· 815 814 rcode = RCODE_TYPE_ERROR; 816 815 else if (fwnet_incoming_packet(dev, payload, length, 817 816 source, generation, false) != 0) { 818 - fw_error("Incoming packet failure\n"); 817 + dev_err(&dev->netdev->dev, "incoming packet failure\n"); 819 818 rcode = RCODE_CONFLICT_ERROR; 820 819 } else 821 820 rcode = RCODE_COMPLETE; ··· 882 881 if (retval >= 0) 883 882 fw_iso_context_queue_flush(dev->broadcast_rcv_context); 884 883 else 885 - fw_error("requeue failed\n"); 884 + dev_err(&dev->netdev->dev, "requeue failed\n"); 886 885 } 887 886 888 887 static struct kmem_cache *fwnet_packet_task_cache; ··· 937 936 case RFC2374_HDR_LASTFRAG: 938 937 case RFC2374_HDR_UNFRAG: 939 938 default: 940 - fw_error("Outstanding packet %x lf %x, header %x,%x\n", 941 - ptask->outstanding_pkts, lf, ptask->hdr.w0, 942 - ptask->hdr.w1); 939 + dev_err(&dev->netdev->dev, 940 + "outstanding packet %x lf %x, header %x,%x\n", 941 + ptask->outstanding_pkts, lf, ptask->hdr.w0, 942 + ptask->hdr.w1); 943 943 BUG(); 944 944 945 945 case RFC2374_HDR_FIRSTFRAG: ··· 1012 1010 fwnet_transmit_packet_failed(ptask); 1013 1011 1014 1012 if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { 1015 - fw_error("fwnet_write_complete: " 1016 - "failed: %x (skipped %d)\n", rcode, errors_skipped); 1013 + dev_err(&ptask->dev->netdev->dev, 1014 + "fwnet_write_complete failed: %x (skipped %d)\n", 1015 + rcode, errors_skipped); 1017 1016 1018 1017 errors_skipped = 0; 1019 1018 last_rcode = rcode; ··· 1542 1539 put_unaligned_be64(card->guid, net->dev_addr); 1543 1540 put_unaligned_be64(~0ULL, net->broadcast); 1544 1541 ret = register_netdev(net); 1545 - if (ret) { 1546 - fw_error("Cannot register the driver\n"); 1542 + if (ret) 1547 1543 goto out; 1548 - } 1549 1544 1550 1545 list_add_tail(&dev->dev_link, &fwnet_device_list); 1551 - fw_notify("%s: IPv4 over FireWire on device %016llx\n", 1552 - net->name, (unsigned long long)card->guid); 1546 + dev_notice(&net->dev, "IPv4 over IEEE 1394 on card %s\n", 1547 + dev_name(card->device)); 1553 1548 have_dev: 1554 1549 ret = fwnet_add_peer(dev, unit, device); 1555 1550 if (ret && allocated_netdev) {