diff options
| author | Andrew Lunn <andrew@lunn.ch> | 2014-02-04 12:33:12 -0500 |
|---|---|---|
| committer | Jason Cooper <jason@lakedaemon.net> | 2014-02-05 00:48:43 -0500 |
| commit | 788a4d56ff378bff0b8e685d03a962b36903a149 (patch) | |
| tree | d22d5b9e750448fb0d7695bf4c9360b326668a95 /include/linux/phy | |
| parent | 04c2facad8fee66c981a51852806d8923336f362 (diff) | |
drivers: phy: Add support for optional phys
Add devm_phy_optional_get and phy_optional_get, which should be used
when the phy is optional. They does not return an error when the phy
does not exist, rather they returns NULL, which is considered as a valid
phy, but results in NOPs when used with the consumer API.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'include/linux/phy')
| -rw-r--r-- | include/linux/phy/phy.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index e273e5ac19c9..3f83459dbb20 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h | |||
| @@ -146,7 +146,9 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width) | |||
| 146 | phy->attrs.bus_width = bus_width; | 146 | phy->attrs.bus_width = bus_width; |
| 147 | } | 147 | } |
| 148 | struct phy *phy_get(struct device *dev, const char *string); | 148 | struct phy *phy_get(struct device *dev, const char *string); |
| 149 | struct phy *phy_optional_get(struct device *dev, const char *string); | ||
| 149 | struct phy *devm_phy_get(struct device *dev, const char *string); | 150 | struct phy *devm_phy_get(struct device *dev, const char *string); |
| 151 | struct phy *devm_phy_optional_get(struct device *dev, const char *string); | ||
| 150 | void phy_put(struct phy *phy); | 152 | void phy_put(struct phy *phy); |
| 151 | void devm_phy_put(struct device *dev, struct phy *phy); | 153 | void devm_phy_put(struct device *dev, struct phy *phy); |
| 152 | struct phy *of_phy_simple_xlate(struct device *dev, | 154 | struct phy *of_phy_simple_xlate(struct device *dev, |
| @@ -232,11 +234,23 @@ static inline struct phy *phy_get(struct device *dev, const char *string) | |||
| 232 | return ERR_PTR(-ENOSYS); | 234 | return ERR_PTR(-ENOSYS); |
| 233 | } | 235 | } |
| 234 | 236 | ||
| 237 | static inline struct phy *phy_optional_get(struct device *dev, | ||
| 238 | const char *string) | ||
| 239 | { | ||
| 240 | return ERR_PTR(-ENOSYS); | ||
| 241 | } | ||
| 242 | |||
| 235 | static inline struct phy *devm_phy_get(struct device *dev, const char *string) | 243 | static inline struct phy *devm_phy_get(struct device *dev, const char *string) |
| 236 | { | 244 | { |
| 237 | return ERR_PTR(-ENOSYS); | 245 | return ERR_PTR(-ENOSYS); |
| 238 | } | 246 | } |
| 239 | 247 | ||
| 248 | static inline struct phy *devm_phy_optional_get(struct device *dev, | ||
| 249 | const char *string) | ||
| 250 | { | ||
| 251 | return ERR_PTR(-ENOSYS); | ||
| 252 | } | ||
| 253 | |||
| 240 | static inline void phy_put(struct phy *phy) | 254 | static inline void phy_put(struct phy *phy) |
| 241 | { | 255 | { |
| 242 | } | 256 | } |
