aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ks8851_mll.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-27 09:43:51 -0500
committerDavid S. Miller <davem@davemloft.net>2010-03-17 00:23:25 -0400
commit0dc7d2b3cbfcf4ff20bdc68f563a2e52e6a2178f (patch)
tree9f81abd6d5d494230a4d23b1a27f399f5832f9e7 /drivers/net/ks8851_mll.c
parentca50910185fcce694af0cc194de50d2374a7c7ef (diff)
drivers/net/ks*: Use netdev_<level>, netif_<level> and pr_<level>
I'm not sure this is correct. It changes logging macros from: dev_<level>(&ks->spidev->dev, to netdev_<level>(ks->netdev, Comments? Use netdev_<level> Use netif_<level> Use pr_<level> Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt Add missing line to message in ks8851_remove Change kmalloc/memset(,0) to kzalloc Remove ks_<level> macros Consolidation code into set_media_state Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ks8851_mll.c')
-rw-r--r--drivers/net/ks8851_mll.c50
1 files changed, 20 insertions, 30 deletions
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index 84b0e15831f..d3c6a77f7ec 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -21,6 +21,8 @@
21 * KS8851 16bit MLL chip from Micrel Inc. 21 * KS8851 16bit MLL chip from Micrel Inc.
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <linux/module.h> 26#include <linux/module.h>
25#include <linux/kernel.h> 27#include <linux/kernel.h>
26#include <linux/netdevice.h> 28#include <linux/netdevice.h>
@@ -458,11 +460,6 @@ struct ks_net {
458 460
459static int msg_enable; 461static int msg_enable;
460 462
461#define ks_info(_ks, _msg...) dev_info(&(_ks)->pdev->dev, _msg)
462#define ks_warn(_ks, _msg...) dev_warn(&(_ks)->pdev->dev, _msg)
463#define ks_dbg(_ks, _msg...) dev_dbg(&(_ks)->pdev->dev, _msg)
464#define ks_err(_ks, _msg...) dev_err(&(_ks)->pdev->dev, _msg)
465
466#define BE3 0x8000 /* Byte Enable 3 */ 463#define BE3 0x8000 /* Byte Enable 3 */
467#define BE2 0x4000 /* Byte Enable 2 */ 464#define BE2 0x4000 /* Byte Enable 2 */
468#define BE1 0x2000 /* Byte Enable 1 */ 465#define BE1 0x2000 /* Byte Enable 1 */
@@ -624,8 +621,7 @@ static void ks_set_powermode(struct ks_net *ks, unsigned pwrmode)
624{ 621{
625 unsigned pmecr; 622 unsigned pmecr;
626 623
627 if (netif_msg_hw(ks)) 624 netif_dbg(ks, hw, ks->netdev, "setting power mode %d\n", pwrmode);
628 ks_dbg(ks, "setting power mode %d\n", pwrmode);
629 625
630 ks_rdreg16(ks, KS_GRR); 626 ks_rdreg16(ks, KS_GRR);
631 pmecr = ks_rdreg16(ks, KS_PMECR); 627 pmecr = ks_rdreg16(ks, KS_PMECR);
@@ -809,7 +805,7 @@ static void ks_rcv(struct ks_net *ks, struct net_device *netdev)
809 skb->protocol = eth_type_trans(skb, netdev); 805 skb->protocol = eth_type_trans(skb, netdev);
810 netif_rx(skb); 806 netif_rx(skb);
811 } else { 807 } else {
812 printk(KERN_ERR "%s: err:skb alloc\n", __func__); 808 pr_err("%s: err:skb alloc\n", __func__);
813 ks_wrreg16(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_RRXEF)); 809 ks_wrreg16(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_RRXEF));
814 if (skb) 810 if (skb)
815 dev_kfree_skb_irq(skb); 811 dev_kfree_skb_irq(skb);
@@ -836,9 +832,8 @@ static void ks_update_link_status(struct net_device *netdev, struct ks_net *ks)
836 netif_carrier_off(netdev); 832 netif_carrier_off(netdev);
837 link_up_status = false; 833 link_up_status = false;
838 } 834 }
839 if (netif_msg_link(ks)) 835 netif_dbg(ks, link, ks->netdev,
840 ks_dbg(ks, "%s: %s\n", 836 "%s: %s\n", __func__, link_up_status ? "UP" : "DOWN");
841 __func__, link_up_status ? "UP" : "DOWN");
842} 837}
843 838
844/** 839/**
@@ -908,15 +903,13 @@ static int ks_net_open(struct net_device *netdev)
908 * else at the moment. 903 * else at the moment.
909 */ 904 */
910 905
911 if (netif_msg_ifup(ks)) 906 netif_dbg(ks, ifup, ks->netdev, "%s - entry\n", __func__);
912 ks_dbg(ks, "%s - entry\n", __func__);
913 907
914 /* reset the HW */ 908 /* reset the HW */
915 err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev); 909 err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev);
916 910
917 if (err) { 911 if (err) {
918 printk(KERN_ERR "Failed to request IRQ: %d: %d\n", 912 pr_err("Failed to request IRQ: %d: %d\n", ks->irq, err);
919 ks->irq, err);
920 return err; 913 return err;
921 } 914 }
922 915
@@ -929,8 +922,7 @@ static int ks_net_open(struct net_device *netdev)
929 ks_enable_qmu(ks); 922 ks_enable_qmu(ks);
930 netif_start_queue(ks->netdev); 923 netif_start_queue(ks->netdev);
931 924
932 if (netif_msg_ifup(ks)) 925 netif_dbg(ks, ifup, ks->netdev, "network device up\n");
933 ks_dbg(ks, "network device %s up\n", netdev->name);
934 926
935 return 0; 927 return 0;
936} 928}
@@ -947,8 +939,7 @@ static int ks_net_stop(struct net_device *netdev)
947{ 939{
948 struct ks_net *ks = netdev_priv(netdev); 940 struct ks_net *ks = netdev_priv(netdev);
949 941
950 if (netif_msg_ifdown(ks)) 942 netif_info(ks, ifdown, netdev, "shutting down\n");
951 ks_info(ks, "%s: shutting down\n", netdev->name);
952 943
953 netif_stop_queue(netdev); 944 netif_stop_queue(netdev);
954 945
@@ -1429,21 +1420,21 @@ static int ks_read_selftest(struct ks_net *ks)
1429 rd = ks_rdreg16(ks, KS_MBIR); 1420 rd = ks_rdreg16(ks, KS_MBIR);
1430 1421
1431 if ((rd & both_done) != both_done) { 1422 if ((rd & both_done) != both_done) {
1432 ks_warn(ks, "Memory selftest not finished\n"); 1423 netdev_warn(ks->netdev, "Memory selftest not finished\n");
1433 return 0; 1424 return 0;
1434 } 1425 }
1435 1426
1436 if (rd & MBIR_TXMBFA) { 1427 if (rd & MBIR_TXMBFA) {
1437 ks_err(ks, "TX memory selftest fails\n"); 1428 netdev_err(ks->netdev, "TX memory selftest fails\n");
1438 ret |= 1; 1429 ret |= 1;
1439 } 1430 }
1440 1431
1441 if (rd & MBIR_RXMBFA) { 1432 if (rd & MBIR_RXMBFA) {
1442 ks_err(ks, "RX memory selftest fails\n"); 1433 netdev_err(ks->netdev, "RX memory selftest fails\n");
1443 ret |= 2; 1434 ret |= 2;
1444 } 1435 }
1445 1436
1446 ks_info(ks, "the selftest passes\n"); 1437 netdev_info(ks->netdev, "the selftest passes\n");
1447 return ret; 1438 return ret;
1448} 1439}
1449 1440
@@ -1514,7 +1505,7 @@ static int ks_hw_init(struct ks_net *ks)
1514 ks->frame_head_info = (struct type_frame_head *) \ 1505 ks->frame_head_info = (struct type_frame_head *) \
1515 kmalloc(MHEADER_SIZE, GFP_KERNEL); 1506 kmalloc(MHEADER_SIZE, GFP_KERNEL);
1516 if (!ks->frame_head_info) { 1507 if (!ks->frame_head_info) {
1517 printk(KERN_ERR "Error: Fail to allocate frame memory\n"); 1508 pr_err("Error: Fail to allocate frame memory\n");
1518 return false; 1509 return false;
1519 } 1510 }
1520 1511
@@ -1580,7 +1571,7 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
1580 ks->mii.mdio_read = ks_phy_read; 1571 ks->mii.mdio_read = ks_phy_read;
1581 ks->mii.mdio_write = ks_phy_write; 1572 ks->mii.mdio_write = ks_phy_write;
1582 1573
1583 ks_info(ks, "message enable is %d\n", msg_enable); 1574 netdev_info(netdev, "message enable is %d\n", msg_enable);
1584 /* set the default message enable */ 1575 /* set the default message enable */
1585 ks->msg_enable = netif_msg_init(msg_enable, (NETIF_MSG_DRV | 1576 ks->msg_enable = netif_msg_init(msg_enable, (NETIF_MSG_DRV |
1586 NETIF_MSG_PROBE | 1577 NETIF_MSG_PROBE |
@@ -1589,13 +1580,13 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
1589 1580
1590 /* simple check for a valid chip being connected to the bus */ 1581 /* simple check for a valid chip being connected to the bus */
1591 if ((ks_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { 1582 if ((ks_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) {
1592 ks_err(ks, "failed to read device ID\n"); 1583 netdev_err(netdev, "failed to read device ID\n");
1593 err = -ENODEV; 1584 err = -ENODEV;
1594 goto err_register; 1585 goto err_register;
1595 } 1586 }
1596 1587
1597 if (ks_read_selftest(ks)) { 1588 if (ks_read_selftest(ks)) {
1598 ks_err(ks, "failed to read device ID\n"); 1589 netdev_err(netdev, "failed to read device ID\n");
1599 err = -ENODEV; 1590 err = -ENODEV;
1600 goto err_register; 1591 goto err_register;
1601 } 1592 }
@@ -1626,9 +1617,8 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
1626 1617
1627 id = ks_rdreg16(ks, KS_CIDER); 1618 id = ks_rdreg16(ks, KS_CIDER);
1628 1619
1629 printk(KERN_INFO DRV_NAME 1620 netdev_info(netdev, "Found chip, family: 0x%x, id: 0x%x, rev: 0x%x\n",
1630 " Found chip, family: 0x%x, id: 0x%x, rev: 0x%x\n", 1621 (id >> 8) & 0xff, (id >> 4) & 0xf, (id >> 1) & 0x7);
1631 (id >> 8) & 0xff, (id >> 4) & 0xf, (id >> 1) & 0x7);
1632 return 0; 1622 return 0;
1633 1623
1634err_register: 1624err_register: