@@ -228,21 +228,20 @@ static void cpmac_dump_regs(struct net_device *dev)
228
228
if (i % 16 == 0 ) {
229
229
if (i )
230
230
pr_cont ("\n" );
231
- printk (KERN_DEBUG "%s: reg[%p]:" , dev -> name ,
232
- priv -> regs + i );
231
+ netdev_dbg (dev , "reg[%p]:" , priv -> regs + i );
233
232
}
234
- printk (" %08x" , cpmac_read (priv -> regs , i ));
233
+ pr_debug (" %08x" , cpmac_read (priv -> regs , i ));
235
234
}
236
- printk ("\n" );
235
+ pr_debug ("\n" );
237
236
}
238
237
239
238
static void cpmac_dump_desc (struct net_device * dev , struct cpmac_desc * desc )
240
239
{
241
240
int i ;
242
- printk ( KERN_DEBUG "%s: desc[%p]:", dev -> name , desc );
241
+ netdev_dbg ( dev , " desc[%p]:" , desc );
243
242
for (i = 0 ; i < sizeof (* desc ) / 4 ; i ++ )
244
- printk (" %08x" , ((u32 * )desc )[i ]);
245
- printk ("\n" );
243
+ pr_debug (" %08x" , ((u32 * )desc )[i ]);
244
+ pr_debug ("\n" );
246
245
}
247
246
248
247
static void cpmac_dump_all_desc (struct net_device * dev )
@@ -258,17 +257,16 @@ static void cpmac_dump_all_desc(struct net_device *dev)
258
257
static void cpmac_dump_skb (struct net_device * dev , struct sk_buff * skb )
259
258
{
260
259
int i ;
261
- printk ( KERN_DEBUG "%s: skb 0x%p, len=%d\n", dev -> name , skb , skb -> len );
260
+ netdev_dbg ( dev , " skb 0x%p, len=%d\n" , skb , skb -> len );
262
261
for (i = 0 ; i < skb -> len ; i ++ ) {
263
262
if (i % 16 == 0 ) {
264
263
if (i )
265
264
pr_cont ("\n" );
266
- printk (KERN_DEBUG "%s: data[%p]:" , dev -> name ,
267
- skb -> data + i );
265
+ netdev_dbg (dev , "data[%p]:" , skb -> data + i );
268
266
}
269
- printk (" %02x" , ((u8 * )skb -> data )[i ]);
267
+ pr_debug (" %02x" , ((u8 * )skb -> data )[i ]);
270
268
}
271
- printk ("\n" );
269
+ pr_debug ("\n" );
272
270
}
273
271
274
272
static int cpmac_mdio_read (struct mii_bus * bus , int phy_id , int reg )
@@ -300,7 +298,7 @@ static int cpmac_mdio_reset(struct mii_bus *bus)
300
298
301
299
cpmac_clk = clk_get (& bus -> dev , "cpmac" );
302
300
if (IS_ERR (cpmac_clk )) {
303
- printk ( KERN_ERR "unable to get cpmac clock\n" );
301
+ pr_err ( "unable to get cpmac clock\n" );
304
302
return -1 ;
305
303
}
306
304
ar7_device_reset (AR7_RESET_BIT_MDIO );
@@ -368,8 +366,8 @@ static struct sk_buff *cpmac_rx_one(struct cpmac_priv *priv,
368
366
cpmac_write (priv -> regs , CPMAC_RX_ACK (0 ), (u32 )desc -> mapping );
369
367
if (unlikely (!desc -> datalen )) {
370
368
if (netif_msg_rx_err (priv ) && net_ratelimit ())
371
- printk ( KERN_WARNING "%s: rx: spurious interrupt\n",
372
- priv -> dev -> name );
369
+ netdev_warn ( priv -> dev , " rx: spurious interrupt\n");
370
+
373
371
return NULL ;
374
372
}
375
373
@@ -389,15 +387,14 @@ static struct sk_buff *cpmac_rx_one(struct cpmac_priv *priv,
389
387
DMA_FROM_DEVICE );
390
388
desc -> hw_data = (u32 )desc -> data_mapping ;
391
389
if (unlikely (netif_msg_pktdata (priv ))) {
392
- printk (KERN_DEBUG "%s: received packet:\n" ,
393
- priv -> dev -> name );
390
+ netdev_dbg (priv -> dev , "received packet:\n" );
394
391
cpmac_dump_skb (priv -> dev , result );
395
392
}
396
393
} else {
397
394
if (netif_msg_rx_err (priv ) && net_ratelimit ())
398
- printk ( KERN_WARNING
399
- "%s: low on skbs, dropping packet\n",
400
- priv -> dev -> name );
395
+ netdev_warn ( priv -> dev ,
396
+ " low on skbs, dropping packet\n");
397
+
401
398
priv -> dev -> stats .rx_dropped ++ ;
402
399
}
403
400
@@ -417,8 +414,8 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
417
414
spin_lock (& priv -> rx_lock );
418
415
if (unlikely (!priv -> rx_head )) {
419
416
if (netif_msg_rx_err (priv ) && net_ratelimit ())
420
- printk ( KERN_WARNING "%s: rx: polling, but no queue\n",
421
- priv -> dev -> name );
417
+ netdev_warn ( priv -> dev , " rx: polling, but no queue\n");
418
+
422
419
spin_unlock (& priv -> rx_lock );
423
420
napi_complete (napi );
424
421
return 0 ;
@@ -437,9 +434,9 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
437
434
*/
438
435
if (unlikely (restart )) {
439
436
if (netif_msg_rx_err (priv ))
440
- printk ( KERN_ERR "%s: poll found a"
441
- " duplicate EOQ: %p and %p\n" ,
442
- priv -> dev -> name , restart , desc );
437
+ netdev_err ( priv -> dev , " poll found a"
438
+ " duplicate EOQ: %p and %p\n" ,
439
+ restart , desc );
443
440
goto fatal_error ;
444
441
}
445
442
@@ -485,15 +482,13 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
485
482
priv -> dev -> stats .rx_errors ++ ;
486
483
priv -> dev -> stats .rx_fifo_errors ++ ;
487
484
if (netif_msg_rx_err (priv ) && net_ratelimit ())
488
- printk (KERN_WARNING "%s: rx dma ring overrun\n" ,
489
- priv -> dev -> name );
485
+ netdev_warn (priv -> dev , "rx dma ring overrun\n" );
490
486
491
487
if (unlikely ((restart -> dataflags & CPMAC_OWN ) == 0 )) {
492
488
if (netif_msg_drv (priv ))
493
- printk (KERN_ERR "%s: cpmac_poll is trying to "
494
- "restart rx from a descriptor that's "
495
- "not free: %p\n" ,
496
- priv -> dev -> name , restart );
489
+ netdev_err (priv -> dev , "cpmac_poll is trying "
490
+ "to restart rx from a descriptor "
491
+ "that's not free: %p\n" , restart );
497
492
goto fatal_error ;
498
493
}
499
494
@@ -503,8 +498,8 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
503
498
priv -> rx_head = desc ;
504
499
spin_unlock (& priv -> rx_lock );
505
500
if (unlikely (netif_msg_rx_status (priv )))
506
- printk ( KERN_DEBUG "%s: poll processed %d packets\n" ,
507
- priv -> dev -> name , received );
501
+ netdev_dbg ( priv -> dev , " poll processed %d packets\n" , received );
502
+
508
503
if (processed == 0 ) {
509
504
/* we ran out of packets to read,
510
505
* revert to interrupt-driven mode
@@ -521,13 +516,12 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
521
516
* Reset hardware to try to recover rather than wedging.
522
517
*/
523
518
if (netif_msg_drv (priv )) {
524
- printk ( KERN_ERR "%s: cpmac_poll is confused. "
525
- "Resetting hardware\n" , priv -> dev -> name );
519
+ netdev_err ( priv -> dev , " cpmac_poll is confused. "
520
+ "Resetting hardware\n" );
526
521
cpmac_dump_all_desc (priv -> dev );
527
- printk (KERN_DEBUG "%s: RX_PTR(0)=0x%08x RX_ACK(0)=0x%08x\n" ,
528
- priv -> dev -> name ,
529
- cpmac_read (priv -> regs , CPMAC_RX_PTR (0 )),
530
- cpmac_read (priv -> regs , CPMAC_RX_ACK (0 )));
522
+ netdev_dbg (priv -> dev , "RX_PTR(0)=0x%08x RX_ACK(0)=0x%08x\n" ,
523
+ cpmac_read (priv -> regs , CPMAC_RX_PTR (0 )),
524
+ cpmac_read (priv -> regs , CPMAC_RX_ACK (0 )));
531
525
}
532
526
533
527
spin_unlock (& priv -> rx_lock );
@@ -562,8 +556,8 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
562
556
desc = & priv -> desc_ring [queue ];
563
557
if (unlikely (desc -> dataflags & CPMAC_OWN )) {
564
558
if (netif_msg_tx_err (priv ) && net_ratelimit ())
565
- printk ( KERN_WARNING "%s: tx dma ring full\n",
566
- dev -> name );
559
+ netdev_warn ( dev , " tx dma ring full\n");
560
+
567
561
return NETDEV_TX_BUSY ;
568
562
}
569
563
@@ -577,8 +571,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
577
571
desc -> datalen = len ;
578
572
desc -> buflen = len ;
579
573
if (unlikely (netif_msg_tx_queued (priv )))
580
- printk (KERN_DEBUG "%s: sending 0x%p, len=%d\n" , dev -> name , skb ,
581
- skb -> len );
574
+ netdev_dbg (dev , "sending 0x%p, len=%d\n" , skb , skb -> len );
582
575
if (unlikely (netif_msg_hw (priv )))
583
576
cpmac_dump_desc (dev , desc );
584
577
if (unlikely (netif_msg_pktdata (priv )))
@@ -604,17 +597,16 @@ static void cpmac_end_xmit(struct net_device *dev, int queue)
604
597
DMA_TO_DEVICE );
605
598
606
599
if (unlikely (netif_msg_tx_done (priv )))
607
- printk ( KERN_DEBUG "%s: sent 0x%p, len=%d\n", dev -> name ,
608
- desc -> skb , desc -> skb -> len );
600
+ netdev_dbg ( dev , " sent 0x%p, len=%d\n" ,
601
+ desc -> skb , desc -> skb -> len );
609
602
610
603
dev_kfree_skb_irq (desc -> skb );
611
604
desc -> skb = NULL ;
612
605
if (__netif_subqueue_stopped (dev , queue ))
613
606
netif_wake_subqueue (dev , queue );
614
607
} else {
615
608
if (netif_msg_tx_err (priv ) && net_ratelimit ())
616
- printk (KERN_WARNING
617
- "%s: end_xmit: spurious interrupt\n" , dev -> name );
609
+ netdev_warn (dev , "end_xmit: spurious interrupt\n" );
618
610
if (__netif_subqueue_stopped (dev , queue ))
619
611
netif_wake_subqueue (dev , queue );
620
612
}
@@ -695,8 +687,7 @@ static void cpmac_clear_rx(struct net_device *dev)
695
687
for (i = 0 ; i < priv -> ring_size ; i ++ ) {
696
688
if ((desc -> dataflags & CPMAC_OWN ) == 0 ) {
697
689
if (netif_msg_rx_err (priv ) && net_ratelimit ())
698
- printk (KERN_WARNING "%s: packet dropped\n" ,
699
- dev -> name );
690
+ netdev_warn (dev , "packet dropped\n" );
700
691
if (unlikely (netif_msg_hw (priv )))
701
692
cpmac_dump_desc (dev , desc );
702
693
desc -> dataflags = CPMAC_OWN ;
@@ -756,13 +747,13 @@ static void cpmac_check_status(struct net_device *dev)
756
747
* error codes actually are. So just log them and hope..
757
748
*/
758
749
if (rx_code )
759
- printk ( KERN_WARNING "%s: host error %d on rx "
760
- "channel %d (macstatus %08x), resetting\n" ,
761
- dev -> name , rx_code , rx_channel , macstatus );
750
+ netdev_warn ( dev , " host error %d on rx "
751
+ "channel %d (macstatus %08x), resetting\n" ,
752
+ rx_code , rx_channel , macstatus );
762
753
if (tx_code )
763
- printk ( KERN_WARNING "%s: host error %d on tx "
764
- "channel %d (macstatus %08x), resetting\n" ,
765
- dev -> name , tx_code , tx_channel , macstatus );
754
+ netdev_warn ( dev , " host error %d on tx "
755
+ "channel %d (macstatus %08x), resetting\n" ,
756
+ tx_code , tx_channel , macstatus );
766
757
}
767
758
768
759
netif_tx_stop_all_queues (dev );
@@ -787,8 +778,7 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id)
787
778
status = cpmac_read (priv -> regs , CPMAC_MAC_INT_VECTOR );
788
779
789
780
if (unlikely (netif_msg_intr (priv )))
790
- printk (KERN_DEBUG "%s: interrupt status: 0x%08x\n" , dev -> name ,
791
- status );
781
+ netdev_dbg (dev , "interrupt status: 0x%08x\n" , status );
792
782
793
783
if (status & MAC_INT_TX )
794
784
cpmac_end_xmit (dev , (status & 7 ));
@@ -817,7 +807,7 @@ static void cpmac_tx_timeout(struct net_device *dev)
817
807
dev -> stats .tx_errors ++ ;
818
808
spin_unlock (& priv -> lock );
819
809
if (netif_msg_tx_err (priv ) && net_ratelimit ())
820
- printk ( KERN_WARNING "%s: transmit timeout\n", dev -> name );
810
+ netdev_warn ( dev , " transmit timeout\n" );
821
811
822
812
atomic_inc (& priv -> reset_pending );
823
813
barrier ();
@@ -953,17 +943,17 @@ static int cpmac_open(struct net_device *dev)
953
943
mem = platform_get_resource_byname (priv -> pdev , IORESOURCE_MEM , "regs" );
954
944
if (!request_mem_region (mem -> start , resource_size (mem ), dev -> name )) {
955
945
if (netif_msg_drv (priv ))
956
- printk ( KERN_ERR "%s: failed to request registers\n",
957
- dev -> name );
946
+ netdev_err ( dev , " failed to request registers\n");
947
+
958
948
res = - ENXIO ;
959
949
goto fail_reserve ;
960
950
}
961
951
962
952
priv -> regs = ioremap (mem -> start , resource_size (mem ));
963
953
if (!priv -> regs ) {
964
954
if (netif_msg_drv (priv ))
965
- printk ( KERN_ERR "%s: failed to remap registers\n",
966
- dev -> name );
955
+ netdev_err ( dev , " failed to remap registers\n");
956
+
967
957
res = - ENXIO ;
968
958
goto fail_remap ;
969
959
}
@@ -1005,8 +995,8 @@ static int cpmac_open(struct net_device *dev)
1005
995
res = request_irq (dev -> irq , cpmac_irq , IRQF_SHARED , dev -> name , dev );
1006
996
if (res ) {
1007
997
if (netif_msg_drv (priv ))
1008
- printk ( KERN_ERR "%s: failed to obtain irq\n",
1009
- dev -> name );
998
+ netdev_err ( dev , " failed to obtain irq\n");
999
+
1010
1000
goto fail_irq ;
1011
1001
}
1012
1002
@@ -1123,7 +1113,7 @@ static int cpmac_probe(struct platform_device *pdev)
1123
1113
1124
1114
if (phy_id == PHY_MAX_ADDR ) {
1125
1115
dev_err (& pdev -> dev , "no PHY present, falling back "
1126
- "to switch on MDIO bus 0\n" );
1116
+ "to switch on MDIO bus 0\n" );
1127
1117
strncpy (mdio_bus_id , "fixed-0" , MII_BUS_ID_SIZE ); /* fixed phys bus */
1128
1118
phy_id = pdev -> id ;
1129
1119
}
@@ -1164,24 +1154,22 @@ static int cpmac_probe(struct platform_device *pdev)
1164
1154
1165
1155
if (IS_ERR (priv -> phy )) {
1166
1156
if (netif_msg_drv (priv ))
1167
- printk ( KERN_ERR "%s: Could not attach to PHY\n",
1168
- dev -> name );
1157
+ dev_err ( & pdev -> dev , " Could not attach to PHY\n");
1158
+
1169
1159
rc = PTR_ERR (priv -> phy );
1170
1160
goto fail ;
1171
1161
}
1172
1162
1173
1163
rc = register_netdev (dev );
1174
1164
if (rc ) {
1175
- printk (KERN_ERR "cpmac: error %i registering device %s\n" , rc ,
1176
- dev -> name );
1165
+ dev_err (& pdev -> dev , "Could not register net device\n" );
1177
1166
goto fail ;
1178
1167
}
1179
1168
1180
1169
if (netif_msg_probe (priv )) {
1181
- printk (KERN_INFO
1182
- "cpmac: device %s (regs: %p, irq: %d, phy: %s, "
1183
- "mac: %pM)\n" , dev -> name , (void * )mem -> start , dev -> irq ,
1184
- priv -> phy_name , dev -> dev_addr );
1170
+ dev_info (& pdev -> dev , "regs: %p, irq: %d, phy: %s, "
1171
+ "mac: %pM\n" , (void * )mem -> start , dev -> irq ,
1172
+ priv -> phy_name , dev -> dev_addr );
1185
1173
}
1186
1174
return 0 ;
1187
1175
@@ -1223,7 +1211,7 @@ int cpmac_init(void)
1223
1211
cpmac_mii -> priv = ioremap (AR7_REGS_MDIO , 256 );
1224
1212
1225
1213
if (!cpmac_mii -> priv ) {
1226
- printk ( KERN_ERR "Can't ioremap mdio registers\n" );
1214
+ pr_err ( "Can't ioremap mdio registers\n" );
1227
1215
res = - ENXIO ;
1228
1216
goto fail_alloc ;
1229
1217
}
0 commit comments