Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp335384iog; Thu, 30 Jun 2022 01:35:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vXVKTTL7lfbkW7ZccNxK5SLVtFbF+tYGNIW0fhHdy0adn1Z244wmnAasfOjzfDciowIeIc X-Received: by 2002:a17:906:2001:b0:6f3:bd7f:d878 with SMTP id 1-20020a170906200100b006f3bd7fd878mr7433199ejo.133.1656578113001; Thu, 30 Jun 2022 01:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656578112; cv=none; d=google.com; s=arc-20160816; b=iUp+q0Xlrx254Okv9tX0HzxKUNupWMO0CaIEcUhKTKt+kbo+UzAnr7f+BO24bdY9N4 wK3Pdtu1ldhT7uJM7PEULTwf2hWVQATZQwW+ZSjCQR08RtibQuu1g4RrHvc9dt89w0SN GPjeNk/LAGm4b2TL7CEExK0BxddxXFY+IdvM2d+/ZIfuxCqpeiTMywiq5kqnSPh5s7h0 5lInkKTr0SMQMoFv/h2FweCQPELqiPaEUnytOji/8t+RIxCYTzlDW4tchyJi6fwsLVuV dLbB94zmV9GFXEC0X0PWUN2g4AbSl8awjspWoJElxUWPtCO4Ce2Zm1T7wGI+sGJ7miE7 skIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xPssXdE9JpUvLL42M7c4hxpfE9Z6x+rfw19ZTPU90gc=; b=n2e7Rgmm0rHQ1fLReJbccrQVjuE9WB9Zun2FSEUOKNGukXf5Qm/V4uXTJPPPoMrus/ lW41ry5Zu0jPtkTGskU0LLdhsMGqii/O31PA4smXWSs76UFoPTrDylYRAfJrycx3rXMQ S49gfkXuiUhxqU3QJ5FyDJAucM1P8/QfrnJ+oNdM2ID61aUWb8figThRoN/F2X1aoHfz /4PGZ6yFVdfWibRZG8MyewZw4soBqy82Ih1qCt0kceY24UBLWxbz4gFuUSMlyV+KtLox 3reyPux2bbiLFOz4UwzpUIdvY2AcuJi1utxCjF829sl8ZANap72p60b9CkNcFeucaefr u2tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OnUxFdSh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a50fc10000000b004358f6a3329si2616637edr.506.2022.06.30.01.34.48; Thu, 30 Jun 2022 01:35:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OnUxFdSh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233130AbiF3I1P (ORCPT + 99 others); Thu, 30 Jun 2022 04:27:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiF3I1N (ORCPT ); Thu, 30 Jun 2022 04:27:13 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDDE9102; Thu, 30 Jun 2022 01:27:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656577632; x=1688113632; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Qi9li/NCV765ItXQMioKvs0Czkex9a7+A1S0LgmtYeY=; b=OnUxFdSh68jlzHUMuxr/eV9mcd0Y5QGcazevQslFlWMhRGz4l5imyq0n aHEgou5CL8XDv7ktRLpg4Sqh7lCknXfcg77pYoTqvJURkmSxyfJAKUAWR tODc+4a8H7G72v7H7KcuJpbXHQUVBnVyB+aXnB8R/evA4fZisBwVZfe8f CgMtAuQC+0k2UoObRlvXhEC2adjzb2b09EkeK9OMDOeOTOLQNmOH73ego zPd3iz+UYAvaupZ3xF9+1tD0u0GBa8nrZjiLI+lw4KNADoXoeukM/YzNr 5nUhNDKINTouFvKip6JhR8BQ2rVUfXM0vAY3wFmHeye1dhE9w9D4ewiyH w==; X-IronPort-AV: E=McAfee;i="6400,9594,10393"; a="262083040" X-IronPort-AV: E=Sophos;i="5.92,233,1650956400"; d="scan'208";a="262083040" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2022 01:27:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,233,1650956400"; d="scan'208";a="733545706" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 30 Jun 2022 01:27:08 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 30 Jun 2022 11:27:07 +0300 Date: Thu, 30 Jun 2022 11:27:07 +0300 From: Heikki Krogerus To: Prashant Malani Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev, bleung@chromium.org, Daisuke Nojiri , "Dustin L. Howett" , Greg Kroah-Hartman , Guenter Roeck , "Gustavo A. R. Silva" , Kees Cook , Sebastian Reichel Subject: Re: [PATCH 2/9] usb: typec: Add retimer handle to port Message-ID: References: <20220629233314.3540377-1-pmalani@chromium.org> <20220629233314.3540377-3-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220629233314.3540377-3-pmalani@chromium.org> X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Jun 29, 2022 at 11:32:20PM +0000, Prashant Malani wrote: > Similar to mux and orientation switch, add a handle for registered > retimer to the port, so that it has handles to the various switches > connected to it. > > Signed-off-by: Prashant Malani > --- > drivers/usb/typec/class.c | 8 ++++++++ > drivers/usb/typec/class.h | 1 + > 2 files changed, 9 insertions(+) > > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c > index 2fa0b3718d23..2bc5fbdb25dd 100644 > --- a/drivers/usb/typec/class.c > +++ b/drivers/usb/typec/class.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > > #include "bus.h" > #include "class.h" > @@ -2249,6 +2250,13 @@ struct typec_port *typec_register_port(struct device *parent, > return ERR_PTR(ret); > } > > + port->retimer = typec_retimer_get(&port->dev); > + if (IS_ERR(port->retimer)) { > + ret = PTR_ERR(port->retimer); > + put_device(&port->dev); > + return ERR_PTR(ret); > + } > + > ret = device_add(&port->dev); > if (ret) { > dev_err(parent, "failed to register port (%d)\n", ret); I think you need to release the reference with typec_retimer_put() in typec_release(). I guess we can look handle this later, but there can actually be two onboard retimers for each connector. thanks, > diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h > index 1bb1da124109..97520406929e 100644 > --- a/drivers/usb/typec/class.h > +++ b/drivers/usb/typec/class.h > @@ -55,6 +55,7 @@ struct typec_port { > enum typec_orientation orientation; > struct typec_switch *sw; > struct typec_mux *mux; > + struct typec_retimer *retimer; > > const struct typec_capability *cap; > const struct typec_operations *ops; -- heikki