Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52facc5d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: pd: Drop ATTENTION command if no SVID handler is discovered"

parents 550c9fb0 2dec2b26
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1562,6 +1562,18 @@ static void handle_vdm_rx(struct usbpd *pd, struct rx_msg *rx_msg)

	/* if this interrupts a previous exchange, abort queued response */
	if (cmd_type == SVDM_CMD_TYPE_INITIATOR && pd->vdm_tx) {
		/*
		 * Drop ATTENTION command unless atleast one SVID handler is
		 * discovered/connected.
		 */
		if (cmd == USBPD_SVDM_ATTENTION && handler &&
						!handler->discovered) {
			usbpd_dbg(&pd->dev, "Send vdm command again queued SVDM tx (SVID:0x%04x)\n",
				VDM_HDR_SVID(pd->vdm_tx->data[0]));
			kick_sm(pd, 0);
			return;
		}

		usbpd_dbg(&pd->dev, "Discarding previously queued SVDM tx (SVID:0x%04x)\n",
				VDM_HDR_SVID(pd->vdm_tx->data[0]));