netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev <netdev@vger.kernel.org>, Andrew Lunn <andrew@lunn.ch>
Subject: [RFC PATCH net-next 04/24] phy: Add phydev_err() and phydev_dbg() macros
Date: Mon,  4 Jan 2016 18:36:42 +0100	[thread overview]
Message-ID: <1451929022-5580-5-git-send-email-andrew@lunn.ch> (raw)
In-Reply-To: <1451929022-5580-1-git-send-email-andrew@lunn.ch>

In preparation for moving some of the phy_device structure members,
add macros for printing errors and debug information.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/at803x.c  |  4 ++--
 drivers/net/phy/bcm87xx.c |  5 +++--
 drivers/net/phy/micrel.c  | 16 +++++++++-------
 drivers/net/phy/phy.c     |  5 +++--
 include/linux/phy.h       |  6 ++++++
 5 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 2d020a3ec0b5..62361f8af375 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -281,8 +281,8 @@ static void at803x_link_change_notify(struct phy_device *phydev)
 
 				at803x_context_restore(phydev, &context);
 
-				dev_dbg(&phydev->dev, "%s(): phy was reset\n",
-					__func__);
+				phydev_dbg(phydev, "%s(): phy was reset\n",
+					   __func__);
 				priv->phy_reset = true;
 			}
 		} else {
diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
index 1eca20452f03..71b491c7bf96 100644
--- a/drivers/net/phy/bcm87xx.c
+++ b/drivers/net/phy/bcm87xx.c
@@ -163,8 +163,9 @@ static int bcm87xx_did_interrupt(struct phy_device *phydev)
 	reg = phy_read(phydev, BCM87XX_LASI_STATUS);
 
 	if (reg < 0) {
-		dev_err(&phydev->dev,
-			"Error: Read of BCM87XX_LASI_STATUS failed: %d\n", reg);
+		phydev_err(phydev,
+			   "Error: Read of BCM87XX_LASI_STATUS failed: %d\n",
+			   reg);
 		return 0;
 	}
 	return (reg & 1) != 0;
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 1a6048a8c29d..bf72365e90bc 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -224,7 +224,7 @@ static int kszphy_setup_led(struct phy_device *phydev, u32 reg, int val)
 	rc = phy_write(phydev, reg, temp);
 out:
 	if (rc < 0)
-		dev_err(&phydev->dev, "failed to set led mode\n");
+		phydev_err(phydev, "failed to set led mode\n");
 
 	return rc;
 }
@@ -243,7 +243,7 @@ static int kszphy_broadcast_disable(struct phy_device *phydev)
 	ret = phy_write(phydev, MII_KSZPHY_OMSO, ret | KSZPHY_OMSO_B_CAST_OFF);
 out:
 	if (ret)
-		dev_err(&phydev->dev, "failed to disable broadcast address\n");
+		phydev_err(phydev, "failed to disable broadcast address\n");
 
 	return ret;
 }
@@ -263,7 +263,7 @@ static int kszphy_nand_tree_disable(struct phy_device *phydev)
 			ret & ~KSZPHY_OMSO_NAND_TREE_ON);
 out:
 	if (ret)
-		dev_err(&phydev->dev, "failed to disable NAND tree mode\n");
+		phydev_err(phydev, "failed to disable NAND tree mode\n");
 
 	return ret;
 }
@@ -288,7 +288,8 @@ static int kszphy_config_init(struct phy_device *phydev)
 	if (priv->rmii_ref_clk_sel) {
 		ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val);
 		if (ret) {
-			dev_err(&phydev->dev, "failed to set rmii reference clock\n");
+			phydev_err(phydev,
+				   "failed to set rmii reference clock\n");
 			return ret;
 		}
 	}
@@ -649,8 +650,8 @@ static int kszphy_probe(struct phy_device *phydev)
 			priv->led_mode = -1;
 
 		if (priv->led_mode > 3) {
-			dev_err(&phydev->dev, "invalid led mode: 0x%02x\n",
-					priv->led_mode);
+			phydev_err(phydev, "invalid led mode: 0x%02x\n",
+				   priv->led_mode);
 			priv->led_mode = -1;
 		}
 	} else {
@@ -672,7 +673,8 @@ static int kszphy_probe(struct phy_device *phydev)
 		} else if (rate > 49500000 && rate < 50500000) {
 			priv->rmii_ref_clk_sel_val = !rmii_ref_clk_sel_25_mhz;
 		} else {
-			dev_err(&phydev->dev, "Clock rate out of range: %ld\n", rate);
+			phydev_err(phydev, "Clock rate out of range: %ld\n",
+				   rate);
 			return -EINVAL;
 		}
 	}
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 67a77956ae6f..287e3682fd58 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -993,8 +993,9 @@ void phy_state_machine(struct work_struct *work)
 	if (err < 0)
 		phy_error(phydev);
 
-	dev_dbg(&phydev->dev, "PHY state change %s -> %s\n",
-		phy_state_to_str(old_state), phy_state_to_str(phydev->state));
+	phydev_dbg(phydev, "PHY state change %s -> %s\n",
+		   phy_state_to_str(old_state),
+		   phy_state_to_str(phydev->state));
 
 	queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
 			   PHY_STATE_TIME * HZ);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 8ca161a37e8a..dbcf9fdd960c 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -777,6 +777,12 @@ static inline int phy_read_status(struct phy_device *phydev)
 	return phydev->drv->read_status(phydev);
 }
 
+#define phydev_err(_phydev, format, args...)	\
+	dev_err(&_phydev->dev, format, ##args)
+
+#define phydev_dbg(_phydev, format, args...)	\
+	dev_dbg(&_phydev->dev, format, ##args)
+
 int genphy_config_init(struct phy_device *phydev);
 int genphy_setup_forced(struct phy_device *phydev);
 int genphy_restart_aneg(struct phy_device *phydev);
-- 
2.6.4

  parent reply	other threads:[~2016-01-04 17:38 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 17:36 [RFC PATCH net-next 00/24] Support MDIO devices Andrew Lunn
2016-01-04 17:36 ` [RFC PATCH net-next 01/24] phy: Consistently use addr for address on an MII bus Andrew Lunn
2016-01-04 20:01   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 02/24] mdio: Move mdiobus_read/write operatings into mdio.h Andrew Lunn
2016-01-04 20:02   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 03/24] phy: Use phy_read() instead of mdiobus_read() Andrew Lunn
2016-01-04 20:07   ` Florian Fainelli
2016-01-05 13:40     ` Andrew Lunn
2016-01-04 17:36 ` Andrew Lunn [this message]
2016-01-04 20:08   ` [RFC PATCH net-next 04/24] phy: Add phydev_err() and phydev_dbg() macros Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 05/24] phy: add phydev_name() macro Andrew Lunn
2016-01-04 17:48   ` Joe Perches
2016-01-04 17:36 ` [RFC PATCH net-next 06/24] net: dnet: Use phy_find_first() helper Andrew Lunn
2016-01-04 20:08   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 07/24] phy: phy_{read|write}_mmd_indirect: get addr from phydev Andrew Lunn
2016-01-04 20:10   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 08/24] phy: Centralise print about attached phy Andrew Lunn
2016-01-04 20:15   ` Florian Fainelli
2016-01-04 21:16     ` Andrew Lunn
2016-01-04 17:36 ` [RFC PATCH net-next 09/24] phy: mdio-octeon: Use devm_mdiobus_alloc_size() Andrew Lunn
2016-01-04 20:18   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 10/24] mdio: Move allocation of interrupts into core Andrew Lunn
2016-01-04 20:17   ` Florian Fainelli
2016-01-06 14:07   ` Shaohui Xie
2016-01-04 17:36 ` [RFC PATCH net-next 11/24] phy: Add an mdio_device structure Andrew Lunn
2016-01-05  1:53   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 12/24] of: phy: Only register a phy device for phys Andrew Lunn
2016-01-04 20:01   ` Florian Fainelli
2016-01-04 21:04     ` Andrew Lunn
2016-01-04 17:36 ` [RFC PATCH net-next 13/24] phy: Add API for {un{registering an mdio device to a bus Andrew Lunn
2016-01-05  1:55   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 14/24] phy_device: Move phy attributes into phy_device Andrew Lunn
2016-01-05  1:57   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 15/24] dsa: Register netdev before phy Andrew Lunn
2016-01-05  1:59   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 16/24] phy: Move PHY PM operations into phy_device Andrew Lunn
2016-01-05  2:00   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 17/24] phy: Centralize setting driver module owner Andrew Lunn
2016-01-05  2:00   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 18/24] phy: Move phy specific bus match into phy_device Andrew Lunn
2016-01-05  2:01   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 19/24] mdio_bus: Generalise of_mdiobus_link_phydev() Andrew Lunn
2016-01-05  2:01   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 20/24] mdio_bus: Add comment to mdiobus_scan() and __mdiobus_register() Andrew Lunn
2016-01-05  2:02   ` Florian Fainelli
2016-01-04 17:36 ` [RFC PATCH net-next 21/24] mdio: Add support for mdio drivers Andrew Lunn
2016-01-05  2:03   ` Florian Fainelli
2016-01-04 17:37 ` [RFC PATCH net-next 22/24] mdio: Abstract device_remove() and device_free() Andrew Lunn
2016-01-05  2:04   ` Florian Fainelli
2016-01-04 17:37 ` [RFC PATCH net-next 23/24] mdio: mdio-nop: Dummy driver to testing Andrew Lunn
2016-01-04 17:37 ` [RFC PATCH net-next 24/24] Add linux,mdio-nop support for testing Andrew Lunn
2016-01-05  2:21 ` [RFC PATCH net-next 00/24] Support MDIO devices Florian Fainelli
2016-01-05  2:57   ` Andrew Lunn

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=1451929022-5580-5-git-send-email-andrew@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).