Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751206AbdH0FYW (ORCPT ); Sun, 27 Aug 2017 01:24:22 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:34107 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168AbdH0FYV (ORCPT ); Sun, 27 Aug 2017 01:24:21 -0400 X-Google-Smtp-Source: ADKCNb5KGB7HEiN2a2xfhWLvIhah11SE5AyFCRJQotHn4p5rX3pE2tAd04TtSPVJMZ0F27ZDjEMm4A== From: Badhri Jagan Sridharan X-Google-Original-From: Badhri Jagan Sridharan To: Guenter Roeck , Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Badhri Jagan Sridharan Subject: [PATCH 2/6] staging: usb: typec: Check for port type for Try.SRC/Try.SNK Date: Sat, 26 Aug 2017 22:24:12 -0700 Message-Id: <20170827052412.11967-1-Badhri@google.com> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1100 Lines: 30 Enable Try.SRC or Try.SNK only when port_type is DRP. Try.SRC or Try.SNK state machines are not valid for SRC only or SNK only ports. Signed-off-by: Badhri Jagan Sridharan --- drivers/staging/typec/tcpm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c index 6c045ac9c42a..1219e3bc13ef 100644 --- a/drivers/staging/typec/tcpm.c +++ b/drivers/staging/typec/tcpm.c @@ -328,10 +328,12 @@ struct pd_rx_event { (tcpm_cc_is_audio((port)->cc2) && tcpm_cc_is_open((port)->cc1))) #define tcpm_try_snk(port) \ - ((port)->try_snk_count == 0 && (port)->try_role == TYPEC_SINK) + ((port)->try_snk_count == 0 && (port)->try_role == TYPEC_SINK && \ + (port)->port_type == TYPEC_PORT_DRP) #define tcpm_try_src(port) \ - ((port)->try_src_count == 0 && (port)->try_role == TYPEC_SOURCE) + ((port)->try_src_count == 0 && (port)->try_role == TYPEC_SOURCE && \ + (port)->port_type == TYPEC_PORT_DRP) static enum tcpm_state tcpm_default_state(struct tcpm_port *port) { -- 2.14.1.342.g6490525c54-goog