From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754633AbcEXT2f (ORCPT ); Tue, 24 May 2016 15:28:35 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:34943 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754337AbcEXT2d (ORCPT ); Tue, 24 May 2016 15:28:33 -0400 Date: Tue, 24 May 2016 12:28:26 -0700 From: Guenter Roeck To: Heikki Krogerus Cc: Greg KH , Mathias Nyman , Felipe Balbi , Oliver Neukum , Rajaram R , Andy Shevchenko , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [RFC PATCHv2] usb: USB Type-C Connector Class Message-ID: <20160524192826.GA28453@roeck-us.net> References: <1463661894-22820-1-git-send-email-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1463661894-22820-1-git-send-email-heikki.krogerus@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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 On Thu, May 19, 2016 at 03:44:54PM +0300, Heikki Krogerus wrote: > The purpose of this class is to provide unified interface for user > space to get the status and basic information about USB Type-C > Connectors in the system, control data role swapping, and when USB PD > is available, also power role swapping and Alternate Modes. > > Signed-off-by: Heikki Krogerus [ ... ] > + > +static void typec_remove_partner(struct typec_port *port) > +{ > + sysfs_remove_link(&port->dev.kobj, "partner"); > + typec_unregister_altmodes(port->partner->alt_modes); This only unregisters alternate modes registered through typec_add_partner(), but not alternate modes registered separately. Or is the calling code expected to set port->partner->alt_modes when calling typec_register_altmodes() directly ? [ ... ] > + > +void typec_unregister_altmodes(struct typec_altmode *alt_modes) > +{ > + struct typec_altmode *alt; > + This will crash if alt_modes is NULL, which will happen if partner->alt_modes is NULL at connection time. Semantically this is different to typec_register_altmodes(), which does have a NULL check. Guenter