swh:1:snp:3c665ee4f67729f27f2e40193ab88e7298cf0fef
Raw File
Tip revision: cbfe8fa6cd672011c755c3cd85c9ffd4e2d10a6f authored by Linus Torvalds on 26 July 2015, 19:26:21 UTC
Linux 4.2-rc4
Tip revision: cbfe8fa
ulpi_phy.h
#include <linux/phy/phy.h>

/**
 * Helper that registers PHY for a ULPI device and adds a lookup for binding it
 * and it's controller, which is always the parent.
 */
static inline struct phy
*ulpi_phy_create(struct ulpi *ulpi, struct phy_ops *ops)
{
	struct phy *phy;
	int ret;

	phy = phy_create(&ulpi->dev, NULL, ops);
	if (IS_ERR(phy))
		return phy;

	ret = phy_create_lookup(phy, "usb2-phy", dev_name(ulpi->dev.parent));
	if (ret) {
		phy_destroy(phy);
		return ERR_PTR(ret);
	}

	return phy;
}

/* Remove a PHY that was created with ulpi_phy_create() and it's lookup. */
static inline void ulpi_phy_destroy(struct ulpi *ulpi, struct phy *phy)
{
	phy_remove_lookup(phy, "usb2-phy", dev_name(ulpi->dev.parent));
	phy_destroy(phy);
}
back to top