public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux•intel.com>
To: "David S. Miller" <davem@davemloft•net>, netdev@vger•kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux•intel.com>
Subject: [PATCH v2 07/13] enc28j60: Switch to dev_<level> from pr_<level>
Date: Mon, 18 Mar 2019 18:10:56 +0200	[thread overview]
Message-ID: <20190318161102.27711-7-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20190318161102.27711-1-andriy.shevchenko@linux.intel.com>

Instead of using open coded printk(KERN_<LEVEL>) switch the driver to use
dev_<level> macros.

Note, the device name will be printed in full, which is beneficial when
more than one card installed on the system.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux•intel.com>
---
 drivers/net/ethernet/microchip/enc28j60.c | 29 +++++++++++++----------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c
index 273e69c84291..2e63569fa743 100644
--- a/drivers/net/ethernet/microchip/enc28j60.c
+++ b/drivers/net/ethernet/microchip/enc28j60.c
@@ -419,14 +419,14 @@ enc28j60_packet_write(struct enc28j60_net *priv, int len, const u8 *data)
 
 static int poll_ready(struct enc28j60_net *priv, u8 reg, u8 mask, u8 val)
 {
+	struct device *dev = &priv->spi->dev;
 	unsigned long timeout = jiffies + msecs_to_jiffies(20);
 
 	/* 20 msec timeout read */
 	while ((nolock_regb_read(priv, reg) & mask) != val) {
 		if (time_after(jiffies, timeout)) {
 			if (netif_msg_drv(priv))
-				dev_dbg(&priv->spi->dev,
-					"reg %02x ready timeout!\n", reg);
+				dev_dbg(dev, "reg %02x ready timeout!\n", reg);
 			return -ETIMEDOUT;
 		}
 		cpu_relax();
@@ -489,13 +489,13 @@ static int enc28j60_set_hw_macaddr(struct net_device *ndev)
 {
 	int ret;
 	struct enc28j60_net *priv = netdev_priv(ndev);
+	struct device *dev = &priv->spi->dev;
 
 	mutex_lock(&priv->lock);
 	if (!priv->hw_enable) {
 		if (netif_msg_drv(priv))
-			printk(KERN_INFO DRV_NAME
-				": %s: Setting MAC address to %pM\n",
-				ndev->name, ndev->dev_addr);
+			dev_info(dev, "%s: Setting MAC address to %pM\n",
+				 ndev->name, ndev->dev_addr);
 		/* NOTE: MAC address in ENC28J60 is byte-backward */
 		nolock_regb_write(priv, MAADR5, ndev->dev_addr[0]);
 		nolock_regb_write(priv, MAADR4, ndev->dev_addr[1]);
@@ -594,12 +594,13 @@ static u16 rx_packet_start(u16 ptr)
 
 static void nolock_rxfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
 {
+	struct device *dev = &priv->spi->dev;
 	u16 erxrdpt;
 
 	if (start > 0x1FFF || end > 0x1FFF || start > end) {
 		if (netif_msg_drv(priv))
-			printk(KERN_ERR DRV_NAME ": %s(%d, %d) RXFIFO "
-				"bad parameters!\n", __func__, start, end);
+			dev_err(dev, "%s(%d, %d) RXFIFO bad parameters!\n",
+				__func__, start, end);
 		return;
 	}
 	/* set receive buffer start + end */
@@ -612,10 +613,12 @@ static void nolock_rxfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
 
 static void nolock_txfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
 {
+	struct device *dev = &priv->spi->dev;
+
 	if (start > 0x1FFF || end > 0x1FFF || start > end) {
 		if (netif_msg_drv(priv))
-			printk(KERN_ERR DRV_NAME ": %s(%d, %d) TXFIFO "
-				"bad parameters!\n", __func__, start, end);
+			dev_err(dev, "%s(%d, %d) TXFIFO bad parameters!\n",
+				__func__, start, end);
 		return;
 	}
 	/* set transmit buffer start + end */
@@ -630,9 +633,10 @@ static void nolock_txfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
  */
 static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
 {
+	struct device *dev = &priv->spi->dev;
+
 	if (netif_msg_drv(priv))
-		dev_dbg(&priv->spi->dev, "%s power...\n",
-				is_low ? "low" : "high");
+		dev_dbg(dev, "%s power...\n", is_low ? "low" : "high");
 
 	mutex_lock(&priv->lock);
 	if (is_low) {
@@ -651,6 +655,7 @@ static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
 
 static int enc28j60_hw_init(struct enc28j60_net *priv)
 {
+	struct device *dev = &priv->spi->dev;
 	u8 reg;
 
 	if (netif_msg_drv(priv))
@@ -681,7 +686,7 @@ static int enc28j60_hw_init(struct enc28j60_net *priv)
 	 */
 	reg = locked_regb_read(priv, EREVID);
 	if (netif_msg_drv(priv))
-		printk(KERN_INFO DRV_NAME ": chip RevID: 0x%02x\n", reg);
+		dev_info(dev, "chip RevID: 0x%02x\n", reg);
 	if (reg == 0x00 || reg == 0xff) {
 		if (netif_msg_drv(priv))
 			printk(KERN_DEBUG DRV_NAME ": %s() Invalid RevId %d\n",
-- 
2.20.1


  parent reply	other threads:[~2019-03-18 16:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 16:10 [PATCH v2 01/13] enc28j60: Use device_get_mac_address() Andy Shevchenko
2019-03-18 16:10 ` [PATCH v2 02/13] enc28j60: Remove duplicate messaging Andy Shevchenko
2019-03-18 16:10 ` [PATCH v2 03/13] enc28j60: Replace dev_*(&netdev->dev, ...) with netdev_*() Andy Shevchenko
2019-03-18 16:10 ` [PATCH v2 04/13] enc28j60: Drop driver name duplication from messages Andy Shevchenko
2019-03-18 16:10 ` [PATCH v2 05/13] enc28j60: Switch to use module_spi_driver() macro Andy Shevchenko
2019-03-18 16:10 ` [PATCH v2 06/13] enc28j60: Use ether_addr_copy() in enc28j60_set_mac_address() Andy Shevchenko
2019-03-18 16:10 ` Andy Shevchenko [this message]
2019-03-18 16:10 ` [PATCH v2 08/13] enc28j60: Convert HW related printk() to dev_printk() Andy Shevchenko
2019-03-18 16:10 ` [PATCH v2 09/13] enc28j60: Convert printk() to netdev_printk() Andy Shevchenko
2019-03-18 16:10 ` [PATCH v2 10/13] enc28j60: Remove linux/init.h Andy Shevchenko
2019-03-18 16:11 ` [PATCH v2 11/13] enc28j60: Amend comments by fixing typos, adding periods, etc Andy Shevchenko
2019-03-18 16:11 ` [PATCH v2 12/13] enc28j60: Fix indentation splats Andy Shevchenko
2019-03-18 16:11 ` [PATCH v2 13/13] enc28j60: Convert to use SPDX identifier Andy Shevchenko
2019-03-19  5:23 ` [PATCH v2 01/13] enc28j60: Use device_get_mac_address() David Miller
2019-03-19 10:17   ` Andy Shevchenko
2019-03-19 17:55     ` David Miller
2019-03-19 18:49       ` Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2019-03-19 18:49 [PATCH v2 00/13] enc28j60: messaging clean up and ACPI improvements Andy Shevchenko
2019-03-19 18:49 ` [PATCH v2 07/13] enc28j60: Switch to dev_<level> from pr_<level> Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190318161102.27711-7-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux$(echo .)intel.com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox