[RFC PATCH 6/7] usb: typec: ucsi: Filter out spurious events

From: Heikki Krogerus
Date: Mon Jun 07 2021 - 09:14:39 EST


Ignoring events without changes.

Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
---
drivers/usb/typec/ucsi/ucsi.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index a4123f77d1f16..ce80a433ef9db 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -839,6 +839,11 @@ static void ucsi_handle_connector_change(struct work_struct *work)
goto out_ack;
}

+ if (!status.change) {
+ dev_dbg(con->ucsi->dev, "con%d: spurious event\n", con->num);
+ goto out_ack;
+ }
+
event = kzalloc(sizeof(*event), GFP_KERNEL);
if (!event)
goto out_ack;
--
2.30.2