From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755370AbcKVIym (ORCPT ); Tue, 22 Nov 2016 03:54:42 -0500 Received: from mga14.intel.com ([192.55.52.115]:15981 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752126AbcKVIyk (ORCPT ); Tue, 22 Nov 2016 03:54:40 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,680,1473145200"; d="scan'208";a="7810698" Date: Tue, 22 Nov 2016 10:52:26 +0200 From: Heikki Krogerus To: Guenter Roeck Cc: Greg KH , Badhri Jagan Sridharan , Oliver Neukum , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCHv11 2/3] usb: USB Type-C connector class Message-ID: <20161122085226.GE18501@kuha.fi.intel.com> References: <20161117105036.133406-1-heikki.krogerus@linux.intel.com> <20161117105036.133406-3-heikki.krogerus@linux.intel.com> <20161121103528.GB2233@kroah.com> <20161121131103.GA18501@kuha.fi.intel.com> <20161121142306.GC18501@kuha.fi.intel.com> <5b2590bb-bae6-6765-f5e0-175f3471d43d@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5b2590bb-bae6-6765-f5e0-175f3471d43d@roeck-us.net> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 21, 2016 at 07:33:45AM -0800, Guenter Roeck wrote: > On 11/21/2016 06:23 AM, Heikki Krogerus wrote: > > On Mon, Nov 21, 2016 at 03:11:03PM +0200, Heikki Krogerus wrote: > > > Hi Greg, > > > > > > On Mon, Nov 21, 2016 at 11:35:28AM +0100, Greg KH wrote: > > > > > +static void typec_partner_release(struct device *dev) > > > > > +{ > > > > > + struct typec_port *port = to_typec_port(dev->parent); > > > > > + > > > > > + typec_unregister_altmodes(dev); > > > > > + port->partner = NULL; > > > > > +} > > > > > > > > This doesn't feel right, why are you both exporting > > > > typec_unregister_altmodes() and also calling it from release callbacks? > > > > That implies there is two way to clean stuff up, so what is a driver > > > > writer to use? Please simplify and force it to be one way or the other. > > > > > > OK. > > > > Guenter did you need to also remove the alternate modes in drivers, or > > can we just do it here? > > > > It is currently called explicitly on a data role change, when executing > a hard reset, on detach, and during error recovery. Most of those would > also unregister the partner, so I should be able to drop those calls > (or maybe I'll have to - I will see when testing), but I am not sure > how to handle data role changes. Let's keep this in the drivers. Actually, we can't unregister them here. The partner is the parent of the alternate modes devices. Sorry about the hassle. Thanks, -- heikki