summaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy/phy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/phy/phy.c')
-rw-r--r--drivers/usb/phy/phy.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 89f4ac4cd93e..bceb2c9988dd 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -1,12 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
/*
* phy.c -- USB phy handling
*
* Copyright (C) 2004-2013 Texas Instruments
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
*/
#include <linux/kernel.h>
#include <linux/export.h>
@@ -327,6 +323,14 @@ static int devm_usb_phy_match(struct device *dev, void *res, void *match_data)
return *phy == match_data;
}
+static void usb_charger_init(struct usb_phy *usb_phy)
+{
+ usb_phy->chg_type = UNKNOWN_TYPE;
+ usb_phy->chg_state = USB_CHARGER_DEFAULT;
+ usb_phy_set_default_current(usb_phy);
+ INIT_WORK(&usb_phy->chg_work, usb_phy_notify_charger_work);
+}
+
static int usb_add_extcon(struct usb_phy *x)
{
int ret;
@@ -410,10 +414,6 @@ static int usb_add_extcon(struct usb_phy *x)
}
}
- usb_phy_set_default_current(x);
- INIT_WORK(&x->chg_work, usb_phy_notify_charger_work);
- x->chg_type = UNKNOWN_TYPE;
- x->chg_state = USB_CHARGER_DEFAULT;
if (x->type_nb.notifier_call)
__usb_phy_get_charger_type(x);
@@ -708,6 +708,7 @@ int usb_add_phy(struct usb_phy *x, enum usb_phy_type type)
return -EINVAL;
}
+ usb_charger_init(x);
ret = usb_add_extcon(x);
if (ret)
return ret;
@@ -753,6 +754,7 @@ int usb_add_phy_dev(struct usb_phy *x)
return -EINVAL;
}
+ usb_charger_init(x);
ret = usb_add_extcon(x);
if (ret)
return ret;