summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@st.com>2017-07-18 09:38:43 (GMT)
committerMarek Vasut <marex@denx.de>2017-07-28 21:34:05 (GMT)
commitb94888b4c051126b02770066ce1e7f4ea9a1ced8 (patch)
tree1380fe00b0433b1ad7e52475c968dbe3a4d37257
parentb9688df3cbf4bf92fa96e1cc9ff7be510e06b54b (diff)
downloadu-boot-fsl-qoriq-b94888b4c051126b02770066ce1e7f4ea9a1ced8.tar.xz
drivers: phy: add generic_phy_valid() method
This allow to check if a PHY has been correctly initialised and avoid to get access to phy struct. Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
-rw-r--r--include/generic-phy.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/generic-phy.h b/include/generic-phy.h
index 762704c..58cd2b2 100644
--- a/include/generic-phy.h
+++ b/include/generic-phy.h
@@ -220,4 +220,15 @@ int generic_phy_get_by_index(struct udevice *user, int index,
int generic_phy_get_by_name(struct udevice *user, const char *phy_name,
struct phy *phy);
+/**
+ * generic_phy_valid() - check if PHY port is valid
+ *
+ * @phy: the PHY port to check
+ * @return TRUE if valid, or FALSE
+ */
+static inline bool generic_phy_valid(struct phy *phy)
+{
+ return phy->dev != NULL;
+}
+
#endif /*__GENERIC_PHY_H */