summaryrefslogtreecommitdiffstats
path: root/drivers/phy/phy-sun4i-usb.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-07-31 10:01:41 +0200
committerKishon Vijay Abraham I <kishon@ti.com>2015-08-03 15:05:08 +0200
commit3d772c4adbf94ce6971be2e9272157f831bccb8f (patch)
tree9f29d12dff5156233ebe5772eb1b7b64e903a675 /drivers/phy/phy-sun4i-usb.c
parentphy: Drop owner assignment from platform_driver (diff)
downloadlinux-3d772c4adbf94ce6971be2e9272157f831bccb8f.tar.xz
linux-3d772c4adbf94ce6971be2e9272157f831bccb8f.zip
phy-sun4i-sub: Move vbus-detect helper functions up in the file
Move vbus-detect helper functions up in the file, just moving some code around, no functional changes what so ever. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy/phy-sun4i-usb.c')
-rw-r--r--drivers/phy/phy-sun4i-usb.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
index 5138843ec42d..27ae89e0d3ca 100644
--- a/drivers/phy/phy-sun4i-usb.c
+++ b/drivers/phy/phy-sun4i-usb.c
@@ -294,6 +294,30 @@ static int sun4i_usb_phy_exit(struct phy *_phy)
return 0;
}
+static int sun4i_usb_phy0_get_vbus_det(struct sun4i_usb_phy_data *data)
+{
+ if (data->vbus_det_gpio)
+ return gpiod_get_value_cansleep(data->vbus_det_gpio);
+
+ if (data->vbus_power_supply) {
+ union power_supply_propval val;
+ int r;
+
+ r = power_supply_get_property(data->vbus_power_supply,
+ POWER_SUPPLY_PROP_PRESENT, &val);
+ if (r == 0)
+ return val.intval;
+ }
+
+ /* Fallback: report vbus as high */
+ return 1;
+}
+
+static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)
+{
+ return data->vbus_det_gpio || data->vbus_power_supply;
+}
+
static int sun4i_usb_phy_power_on(struct phy *_phy)
{
struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
@@ -356,30 +380,6 @@ static struct phy_ops sun4i_usb_phy_ops = {
.owner = THIS_MODULE,
};
-static int sun4i_usb_phy0_get_vbus_det(struct sun4i_usb_phy_data *data)
-{
- if (data->vbus_det_gpio)
- return gpiod_get_value_cansleep(data->vbus_det_gpio);
-
- if (data->vbus_power_supply) {
- union power_supply_propval val;
- int r;
-
- r = power_supply_get_property(data->vbus_power_supply,
- POWER_SUPPLY_PROP_PRESENT, &val);
- if (r == 0)
- return val.intval;
- }
-
- /* Fallback: report vbus as high */
- return 1;
-}
-
-static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)
-{
- return data->vbus_det_gpio || data->vbus_power_supply;
-}
-
static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
{
struct sun4i_usb_phy_data *data =