[U-Boot] [PATCH v7 4/5] drivers: phy: add generic_phy_valid() method
Jean-Jacques Hiblot
jjhiblot at ti.com
Wed Jul 19 13:56:19 UTC 2017
On 18/07/2017 11:38, patrice.chotard at st.com wrote:
> From: Patrice Chotard <patrice.chotard at st.com>
>
> 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 at st.com>
> ---
> v7: _ declare bool generic_phy_valid(struct phy *phy) as static inline
> v6: _ none
> v5: _ none
> v4: _ none
>
>
> include/generic-phy.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> 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 */
Reviewed-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
More information about the U-Boot
mailing list