From abbebf1a3e6ab5a14cf34a2fe03dba7e10c2cf2c Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Sat, 20 Mar 2021 23:25:13 -0700 Subject: [PATCH] ANDROID: usb: typec: tcpci: Migrate restricted vendor hook Since the callbacks can potentially execute i2c transactions, use restricted vendor hook instead of vendor hook. BUG: scheduling while atomic: 6-0025/306/0x00000002 .. Call trace: dump_backtrace+0x0/0x1d4 show_stack+0x1c/0x2c dump_stack+0xd0/0x154 __schedule_bug+0x74/0xb0 __schedule+0x524/0x7bc schedule+0xa0/0xe8 schedule_preempt_disabled+0x28/0x48 __mutex_lock+0x2e8/0x6c4 __mutex_lock_slowpath+0x18/0x28 mutex_lock+0x40/0x64 regmap_lock_mutex+0x14/0x24 regmap_raw_read+0xcc/0x264 __traceiter_android_vh_typec_tcpci_get_vbus+0x50/0x78 tcpci_get_vbus+0x100/0x128 OOT_bug: Bug: 183149028 Bug: 168245874 Bug: 173252019 Signed-off-by: Badhri Jagan Sridharan Change-Id: Ia61bd2b6a01b50e73e7a6d4e398146b819181e15 --- drivers/android/vendor_hooks.c | 4 ++-- drivers/usb/typec/tcpm/tcpci.c | 4 ++-- include/trace/hooks/typec.h | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 8ba5e8c9642b..64079e850f2e 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -213,5 +213,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_mem); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_print_slabinfo_header); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cache_show); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_override_toggling); -EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_check_contaminant); -EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_get_vbus); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_typec_tcpci_chk_contaminant); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_typec_tcpci_get_vbus); diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 372a5fb0baf4..f337a6cf115e 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -419,7 +419,7 @@ static int tcpci_get_vbus(struct tcpc_dev *tcpc) unsigned int reg; int ret, vbus, bypass = 0; - trace_android_vh_typec_tcpci_get_vbus(tcpci, tcpci->data, &vbus, &bypass); + trace_android_rvh_typec_tcpci_get_vbus(tcpci, tcpci->data, &vbus, &bypass); if (bypass) return vbus; @@ -435,7 +435,7 @@ static int tcpci_check_contaminant(struct tcpc_dev *tcpc) struct tcpci *tcpci = tcpc_to_tcpci(tcpc); int ret = 0; - trace_android_vh_typec_tcpci_check_contaminant(tcpci, tcpci->data, &ret); + trace_android_rvh_typec_tcpci_chk_contaminant(tcpci, tcpci->data, &ret); return ret; } diff --git a/include/trace/hooks/typec.h b/include/trace/hooks/typec.h index 127a16b440c1..8252dab49b98 100644 --- a/include/trace/hooks/typec.h +++ b/include/trace/hooks/typec.h @@ -17,9 +17,9 @@ DECLARE_HOOK(android_vh_typec_tcpci_override_toggling, TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *override_toggling), TP_ARGS(tcpci, data, override_toggling)); -DECLARE_HOOK(android_vh_typec_tcpci_check_contaminant, +DECLARE_RESTRICTED_HOOK(android_rvh_typec_tcpci_chk_contaminant, TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *ret), - TP_ARGS(tcpci, data, ret)); + TP_ARGS(tcpci, data, ret), 1); /* * This hook is for addressing hardware anomalies where TCPC_POWER_STATUS_VBUS_PRES bit can return 0 @@ -28,9 +28,9 @@ DECLARE_HOOK(android_vh_typec_tcpci_check_contaminant, * function. * Handler can set vbus or clear vbus to indicate vbus present or absent */ -DECLARE_HOOK(android_vh_typec_tcpci_get_vbus, +DECLARE_RESTRICTED_HOOK(android_rvh_typec_tcpci_get_vbus, TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *vbus, int *bypass), - TP_ARGS(tcpci, data, vbus, bypass)); + TP_ARGS(tcpci, data, vbus, bypass), 1); #endif /* _TRACE_HOOK_UFSHCD_H */ /* This part must be outside protection */