From 50de6be7561bb1890cb5ad43be6414d2000f8205 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 30 Sep 2023 15:44:37 +0000 Subject: [PATCH] Revert "usb: typec: bus: verify partner exists in typec_altmode_attention" This reverts commit 5f71716772b88cbe0e1788f6a38d7871aff2120b which is commit f23643306430f86e2f413ee2b986e0773e79da31 upstream. It breaks the Android abi. It will be brought back later, in an ABI-safe way, but for now drop it. Bug: 161946584 Change-Id: I5cc20208598b89d9a80d2b0cbaaa6492e35392bf Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/bus.c | 12 ++---------- drivers/usb/typec/tcpm/tcpm.c | 3 +-- include/linux/usb/typec_altmode.h | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c index 052b8fb21344..0369ad92a1c8 100644 --- a/drivers/usb/typec/bus.c +++ b/drivers/usb/typec/bus.c @@ -146,20 +146,12 @@ EXPORT_SYMBOL_GPL(typec_altmode_exit); * * Notifies the partner of @adev about Attention command. */ -int typec_altmode_attention(struct typec_altmode *adev, u32 vdo) +void typec_altmode_attention(struct typec_altmode *adev, u32 vdo) { - struct altmode *partner = to_altmode(adev)->partner; - struct typec_altmode *pdev; - - if (!partner) - return -ENODEV; - - pdev = &partner->adev; + struct typec_altmode *pdev = &to_altmode(adev)->partner->adev; if (pdev->ops && pdev->ops->attention) pdev->ops->attention(pdev, vdo); - - return 0; } EXPORT_SYMBOL_GPL(typec_altmode_attention); diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 3d72c88e000e..446d09d89860 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -1246,8 +1246,7 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port, } break; case ADEV_ATTENTION: - if (typec_altmode_attention(adev, p[1])) - tcpm_log(port, "typec_altmode_attention no port partner altmode"); + typec_altmode_attention(adev, p[1]); break; } } diff --git a/include/linux/usb/typec_altmode.h b/include/linux/usb/typec_altmode.h index 969b7c504087..9a88c74a1d0d 100644 --- a/include/linux/usb/typec_altmode.h +++ b/include/linux/usb/typec_altmode.h @@ -67,7 +67,7 @@ struct typec_altmode_ops { int typec_altmode_enter(struct typec_altmode *altmode); int typec_altmode_exit(struct typec_altmode *altmode); -int typec_altmode_attention(struct typec_altmode *altmode, u32 vdo); +void typec_altmode_attention(struct typec_altmode *altmode, u32 vdo); int typec_altmode_vdm(struct typec_altmode *altmode, const u32 header, const u32 *vdo, int count); int typec_altmode_notify(struct typec_altmode *altmode, unsigned long conf,