From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1945912AbcHRKpB (ORCPT ); Thu, 18 Aug 2016 06:45:01 -0400 Received: from mga03.intel.com ([134.134.136.65]:35190 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753560AbcHRKpA (ORCPT ); Thu, 18 Aug 2016 06:45:00 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,539,1464678000"; d="scan'208";a="1037763165" Date: Thu, 18 Aug 2016 13:44:56 +0300 From: Heikki Krogerus To: Guenter Roeck Cc: Greg KH , Oliver Neukum , Felipe Balbi , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH v5 1/2] usb: USB Type-C connector class Message-ID: <20160818104456.GW9927@kuha.fi.intel.com> References: <1471430081-12860-1-git-send-email-heikki.krogerus@linux.intel.com> <1471430081-12860-2-git-send-email-heikki.krogerus@linux.intel.com> <20160817175840.GA4764@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160817175840.GA4764@roeck-us.net> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 17, 2016 at 10:58:40AM -0700, Guenter Roeck wrote: > On Wed, Aug 17, 2016 at 01:34:40PM +0300, Heikki Krogerus wrote: > > The purpose of USB Type-C connector class is to provide > > unified interface for the user space to get the status and > > basic information about USB Type-C connectors on a system, > > control over data role swapping, and when the port supports > > USB Power Delivery, also control over power role swapping > > and Alternate Modes. > > > > Signed-off-by: Heikki Krogerus > > --- > [ ... ] > > > + > > +static ssize_t current_power_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 = size; > > + > > + if (!port->cap->usb_pd) { > > + dev_dbg(dev, "power role swap only supported with USB PD\n"); > > + return -EOPNOTSUPP; > > + } > > + > > + if (!port->cap->pr_set) { > > + dev_dbg(dev, "power role swapping not supported\n"); > > + return -EOPNOTSUPP; > > + } > > + > > + if (port->pwr_opmode != TYPEC_PWR_MODE_PD) { > > + dev_dbg(dev, "partner unable to swap power role\n"); > > + return -EIO; > > + } > > + > > + if (!port->connected) > > + return size; > > + > > + ret = sysfs_strmatch(typec_roles, ARRAY_SIZE(typec_roles), buf); > > + if (ret < 0) > > + return ret; > > + > > + role = ret; > > + > > + ret = port->cap->pr_set(port->cap, role); > > if (ret) > missing. It also seems to be missing from current_vconn_role_store().. How have I managed to do that? Thanks for catching this. -- heikki