aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/usb/mtu3/mtu3.h
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2018-05-23 16:53:20 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-24 18:09:37 +0200
commit681e9485241463e1e8d8cfd0a11fb252f49c997f (patch)
tree8c28668617df61b5bf0be60f3773f601a27299c2 /drivers/usb/mtu3/mtu3.h
parentusb: mtu3: reset gadget when VBUS_FALL interrupt arises (diff)
downloadwireguard-linux-681e9485241463e1e8d8cfd0a11fb252f49c997f.tar.xz
wireguard-linux-681e9485241463e1e8d8cfd0a11fb252f49c997f.zip
usb: mtu3: fix warning of sleep in atomic context in notifier callback
The notifier callbacks of extcon are called in atomic context, but the callbacks will call regulator_enable()/regulator_disable() which may sleep caused by mutex, so use work queue to call the sleep functions. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/mtu3/mtu3.h')
-rw-r--r--drivers/usb/mtu3/mtu3.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h
index a56fee05b04d..87823ac0d120 100644
--- a/drivers/usb/mtu3/mtu3.h
+++ b/drivers/usb/mtu3/mtu3.h
@@ -196,7 +196,12 @@ struct mtu3_gpd_ring {
* @vbus: vbus 5V used by host mode
* @edev: external connector used to detect vbus and iddig changes
* @vbus_nb: notifier for vbus detection
-* @vbus_nb: notifier for iddig(idpin) detection
+* @vbus_work : work of vbus detection notifier, used to avoid sleep in
+* notifier callback which is atomic context
+* @vbus_event : event of vbus detecion notifier
+* @id_nb : notifier for iddig(idpin) detection
+* @id_work : work of iddig detection notifier
+* @id_event : event of iddig detecion notifier
* @is_u3_drd: whether port0 supports usb3.0 dual-role device or not
* @manual_drd_enabled: it's true when supports dual-role device by debugfs
* to switch host/device modes depending on user input.
@@ -205,7 +210,11 @@ struct otg_switch_mtk {
struct regulator *vbus;
struct extcon_dev *edev;
struct notifier_block vbus_nb;
+ struct work_struct vbus_work;
+ unsigned long vbus_event;
struct notifier_block id_nb;
+ struct work_struct id_work;
+ unsigned long id_event;
bool is_u3_drd;
bool manual_drd_enabled;
};