diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2015-09-21 04:14:34 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-09-27 11:54:31 -0400 |
commit | 06e7114f0d8297278eb24f4e9bee3393a94bd8ce (patch) | |
tree | 9a4759e115df3f93c04bccc2fc4ef42fa172af02 /drivers/usb/common/common.c | |
parent | 666472733b8ce20716037c0d866395db54aa8c1d (diff) |
usb: common: of_usb_get_dr_mode to usb_get_dr_mode
By using the unified device property interface, the function
can be made available for all platforms and not just the
ones using DT.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/common/common.c')
-rw-r--r-- | drivers/usb/common/common.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index b25a111903ab..673d53038ed2 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c | |||
@@ -99,7 +99,6 @@ const char *usb_state_string(enum usb_device_state state) | |||
99 | } | 99 | } |
100 | EXPORT_SYMBOL_GPL(usb_state_string); | 100 | EXPORT_SYMBOL_GPL(usb_state_string); |
101 | 101 | ||
102 | #ifdef CONFIG_OF | ||
103 | static const char *const usb_dr_modes[] = { | 102 | static const char *const usb_dr_modes[] = { |
104 | [USB_DR_MODE_UNKNOWN] = "", | 103 | [USB_DR_MODE_UNKNOWN] = "", |
105 | [USB_DR_MODE_HOST] = "host", | 104 | [USB_DR_MODE_HOST] = "host", |
@@ -107,19 +106,12 @@ static const char *const usb_dr_modes[] = { | |||
107 | [USB_DR_MODE_OTG] = "otg", | 106 | [USB_DR_MODE_OTG] = "otg", |
108 | }; | 107 | }; |
109 | 108 | ||
110 | /** | 109 | enum usb_dr_mode usb_get_dr_mode(struct device *dev) |
111 | * of_usb_get_dr_mode - Get dual role mode for given device_node | ||
112 | * @np: Pointer to the given device_node | ||
113 | * | ||
114 | * The function gets phy interface string from property 'dr_mode', | ||
115 | * and returns the correspondig enum usb_dr_mode | ||
116 | */ | ||
117 | enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) | ||
118 | { | 110 | { |
119 | const char *dr_mode; | 111 | const char *dr_mode; |
120 | int err, i; | 112 | int err, i; |
121 | 113 | ||
122 | err = of_property_read_string(np, "dr_mode", &dr_mode); | 114 | err = device_property_read_string(dev, "dr_mode", &dr_mode); |
123 | if (err < 0) | 115 | if (err < 0) |
124 | return USB_DR_MODE_UNKNOWN; | 116 | return USB_DR_MODE_UNKNOWN; |
125 | 117 | ||
@@ -129,8 +121,9 @@ enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) | |||
129 | 121 | ||
130 | return USB_DR_MODE_UNKNOWN; | 122 | return USB_DR_MODE_UNKNOWN; |
131 | } | 123 | } |
132 | EXPORT_SYMBOL_GPL(of_usb_get_dr_mode); | 124 | EXPORT_SYMBOL_GPL(usb_get_dr_mode); |
133 | 125 | ||
126 | #ifdef CONFIG_OF | ||
134 | /** | 127 | /** |
135 | * of_usb_host_tpl_support - to get if Targeted Peripheral List is supported | 128 | * of_usb_host_tpl_support - to get if Targeted Peripheral List is supported |
136 | * for given targeted hosts (non-PC hosts) | 129 | * for given targeted hosts (non-PC hosts) |