Skip to content

Commit 8408dc1

Browse files
author
Stefan Richter
committed
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>
1 parent 59759ff commit 8408dc1

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

‎drivers/firewire/net.c‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ static int fwnet_header_rebuild(struct sk_buff *skb)
256256
if (get_unaligned_be16(&h->h_proto) == ETH_P_IP)
257257
return arp_find((unsigned char *)&h->h_dest, skb);
258258

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));
261261
return 0;
262262
}
263263

@@ -369,7 +369,7 @@ static struct fwnet_fragment_info *fwnet_frag_new(
369369

370370
new = kmalloc(sizeof(*new), GFP_ATOMIC);
371371
if (!new) {
372-
fw_error("out of memory\n");
372+
dev_err(&pd->skb->dev->dev, "out of memory\n");
373373
return NULL;
374374
}
375375

@@ -414,7 +414,7 @@ static struct fwnet_partial_datagram *fwnet_pd_new(struct net_device *net,
414414
fail_w_new:
415415
kfree(new);
416416
fail:
417-
fw_error("out of memory\n");
417+
dev_err(&net->dev, "out of memory\n");
418418

419419
return NULL;
420420
}
@@ -554,7 +554,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
554554
sspd = arp1394->sspd;
555555
/* Sanity check. OS X 10.3 PPC reportedly sends 131. */
556556
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);
558558
sspd = SCODE_3200;
559559
}
560560
max_payload = fwnet_max_payload(arp1394->max_rec, sspd);
@@ -574,8 +574,9 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
574574
spin_unlock_irqrestore(&dev->lock, flags);
575575

576576
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);
579580
goto no_peer;
580581
}
581582

@@ -691,7 +692,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len,
691692

692693
skb = dev_alloc_skb(len + net->hard_header_len + 15);
693694
if (unlikely(!skb)) {
694-
fw_error("out of memory\n");
695+
dev_err(&net->dev, "out of memory\n");
695696
net->stats.rx_dropped++;
696697

697698
return -ENOMEM;
@@ -814,7 +815,7 @@ static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r,
814815
rcode = RCODE_TYPE_ERROR;
815816
else if (fwnet_incoming_packet(dev, payload, length,
816817
source, generation, false) != 0) {
817-
fw_error("Incoming packet failure\n");
818+
dev_err(&dev->netdev->dev, "incoming packet failure\n");
818819
rcode = RCODE_CONFLICT_ERROR;
819820
} else
820821
rcode = RCODE_COMPLETE;
@@ -881,7 +882,7 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context,
881882
if (retval >= 0)
882883
fw_iso_context_queue_flush(dev->broadcast_rcv_context);
883884
else
884-
fw_error("requeue failed\n");
885+
dev_err(&dev->netdev->dev, "requeue failed\n");
885886
}
886887

887888
static struct kmem_cache *fwnet_packet_task_cache;
@@ -936,9 +937,10 @@ static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask)
936937
case RFC2374_HDR_LASTFRAG:
937938
case RFC2374_HDR_UNFRAG:
938939
default:
939-
fw_error("Outstanding packet %x lf %x, header %x,%x\n",
940-
ptask->outstanding_pkts, lf, ptask->hdr.w0,
941-
ptask->hdr.w1);
940+
dev_err(&dev->netdev->dev,
941+
"outstanding packet %x lf %x, header %x,%x\n",
942+
ptask->outstanding_pkts, lf, ptask->hdr.w0,
943+
ptask->hdr.w1);
942944
BUG();
943945

944946
case RFC2374_HDR_FIRSTFRAG:
@@ -1010,8 +1012,9 @@ static void fwnet_write_complete(struct fw_card *card, int rcode,
10101012
fwnet_transmit_packet_failed(ptask);
10111013

10121014
if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) {
1013-
fw_error("fwnet_write_complete: "
1014-
"failed: %x (skipped %d)\n", rcode, errors_skipped);
1015+
dev_err(&ptask->dev->netdev->dev,
1016+
"fwnet_write_complete failed: %x (skipped %d)\n",
1017+
rcode, errors_skipped);
10151018

10161019
errors_skipped = 0;
10171020
last_rcode = rcode;
@@ -1539,14 +1542,12 @@ static int fwnet_probe(struct device *_dev)
15391542
put_unaligned_be64(card->guid, net->dev_addr);
15401543
put_unaligned_be64(~0ULL, net->broadcast);
15411544
ret = register_netdev(net);
1542-
if (ret) {
1543-
fw_error("Cannot register the driver\n");
1545+
if (ret)
15441546
goto out;
1545-
}
15461547

15471548
list_add_tail(&dev->dev_link, &fwnet_device_list);
1548-
fw_notify("%s: IPv4 over FireWire on device %016llx\n",
1549-
net->name, (unsigned long long)card->guid);
1549+
dev_notice(&net->dev, "IPv4 over IEEE 1394 on card %s\n",
1550+
dev_name(card->device));
15501551
have_dev:
15511552
ret = fwnet_add_peer(dev, unit, device);
15521553
if (ret && allocated_netdev) {

0 commit comments

Comments
 (0)