1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #include <linux/phy/phy.h> 2 #include <linux/phy/phy.h> 3 3 4 /** 4 /** 5 * Helper that registers PHY for a ULPI device 5 * Helper that registers PHY for a ULPI device and adds a lookup for binding it 6 * and it's controller, which is always the pa 6 * and it's controller, which is always the parent. 7 */ 7 */ 8 static inline struct phy 8 static inline struct phy 9 *ulpi_phy_create(struct ulpi *ulpi, const stru 9 *ulpi_phy_create(struct ulpi *ulpi, const struct phy_ops *ops) 10 { 10 { 11 struct phy *phy; 11 struct phy *phy; 12 int ret; 12 int ret; 13 13 14 phy = phy_create(&ulpi->dev, NULL, ops 14 phy = phy_create(&ulpi->dev, NULL, ops); 15 if (IS_ERR(phy)) 15 if (IS_ERR(phy)) 16 return phy; 16 return phy; 17 17 18 ret = phy_create_lookup(phy, "usb2-phy 18 ret = phy_create_lookup(phy, "usb2-phy", dev_name(ulpi->dev.parent)); 19 if (ret) { 19 if (ret) { 20 phy_destroy(phy); 20 phy_destroy(phy); 21 return ERR_PTR(ret); 21 return ERR_PTR(ret); 22 } 22 } 23 23 24 return phy; 24 return phy; 25 } 25 } 26 26 27 /* Remove a PHY that was created with ulpi_phy 27 /* Remove a PHY that was created with ulpi_phy_create() and it's lookup. */ 28 static inline void ulpi_phy_destroy(struct ulp 28 static inline void ulpi_phy_destroy(struct ulpi *ulpi, struct phy *phy) 29 { 29 { 30 phy_remove_lookup(phy, "usb2-phy", dev 30 phy_remove_lookup(phy, "usb2-phy", dev_name(ulpi->dev.parent)); 31 phy_destroy(phy); 31 phy_destroy(phy); 32 } 32 } 33 33
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.