From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965185AbcFMHtq (ORCPT ); Mon, 13 Jun 2016 03:49:46 -0400 Received: from mga09.intel.com ([134.134.136.24]:28141 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964793AbcFMHto (ORCPT ); Mon, 13 Jun 2016 03:49:44 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,466,1459839600"; d="scan'208";a="974393892" Date: Mon, 13 Jun 2016 10:49:39 +0300 From: Heikki Krogerus To: Guenter Roeck Cc: Oliver Neukum , Felipe Balbi , Greg KH , Pavel Machek , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [RFC PATCHv3] usb: USB Type-C Connector Class Message-ID: <20160613074939.GB13291@kuha.fi.intel.com> References: <1463661894-22820-1-git-send-email-heikki.krogerus@linux.intel.com> <1465569269-63856-1-git-send-email-heikki.krogerus@linux.intel.com> <1465628746.3339.3.camel@suse.com> <575C5289.3020009@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <575C5289.3020009@roeck-us.net> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 11, 2016 at 11:03:53AM -0700, Guenter Roeck wrote: > On 06/11/2016 12:05 AM, Oliver Neukum wrote: > > On Fri, 2016-06-10 at 17:34 +0300, Heikki Krogerus wrote: > > > +static ssize_t > > > +preferred_role_store(struct device *dev, struct device_attribute > > > *attr, > > > + const char *buf, size_t size) > > > +{ > > > + struct typec_port *port = to_typec_port(dev); > > > + enum typec_role role; > > > + int ret; > > > + > > > + mutex_lock(&port->lock); > > > + > > > + if (port->cap->type != TYPEC_PORT_DRP) { > > > + dev_dbg(dev, "Try.SRC/SNK only supported with DRP > > > ports\n"); > > > + ret = -EOPNOTSUPP; > > > + goto out; > > > + } > > > > I think Try.SNK with an UFP should fail differently from > > Try.SRC and vice versa. > > > > I think the message should not even mention Try.src or Try.snk > in the first place, since both are optional and really orthogonal > to how the role is set (it can also be changed with pd messages). > On top of that, the specification states that Try.{src/snk} are > optional if there is no PD support, and NA if PD is supported > (see table 4.10). Kind of interesting, and I wonder how this > is supposed to be implemented in practice, since Try.{src/snk} > runs before it is established that/if the partner supports PD. > > A better message would be something like "Setting preferred > role only supported with DRP ports", and leave implementation > details to the port driver. Works for me. Thanks, -- heikki