Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751294AbdH0RUa (ORCPT ); Sun, 27 Aug 2017 13:20:30 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:57315 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751182AbdH0RU3 (ORCPT ); Sun, 27 Aug 2017 13:20:29 -0400 Date: Sun, 27 Aug 2017 10:20:27 -0700 From: Guenter Roeck To: Badhri Jagan Sridharan Cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/6] staging: usb: typec: Check for port type for Try.SRC/Try.SNK Message-ID: <20170827172027.GL22819@roeck-us.net> References: <20170827052412.11967-1-Badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170827052412.11967-1-Badhri@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1285 Lines: 35 On Sat, Aug 26, 2017 at 10:24:12PM -0700, Badhri Jagan Sridharan wrote: > 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 Reviewed-by: Guenter Roeck > --- > 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 >