Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp800513iog; Thu, 30 Jun 2022 10:19:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sl4l9KeTCSWa+xKT7Isj1d01V6blWt67mdF90oXlRSUVrTTKZYthS1GLctLwjSvjKs+35t X-Received: by 2002:a17:903:48b:b0:16a:555:414a with SMTP id jj11-20020a170903048b00b0016a0555414amr15854068plb.67.1656609559573; Thu, 30 Jun 2022 10:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656609559; cv=none; d=google.com; s=arc-20160816; b=IXGCwEyK94vx5l1ocMCChI/1Uql/RZ8K480M4dzEYUn+R+QaUafXqC82SHbe9RPbcO v9w0OLTkenA4opsLNV8z+K2gXqFqex4yGteA8in6cPMNx6ZLsT0C6UW+4LXhSwc6pWNU rlmUGa5dI+IodTX6Ykn9gdcrdCscQeS4Mlrsv3xMH2wc3cHf1bZa39By4EHGBYYsdwxj AvC1EXYKKEj61ualfUKwJx1LdjHUGpVlWCCe9JLK7TTVaFjyCo7HaewsGxHRiT5owpYJ swyNAupA+uI25uqyaX2kMI9n0dyrDYmL9woCDo/ncv0c6+kOlYBE3RwPv4lupD0ck9mm M62w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=o8689H0UAxz4K3OeSIRtr+YJ/Xi+oP67C+537YTthgw=; b=ip5kY+T0IbZ6T+qZ+Ef9/Lp7vEzqN7oW+aOnogWdAaZNgV/BIWdN8dHBRneiNhav6M zyL3wpqKG/dRQmLiyxyMyAZkOpupUX2Et9eBvqwb1pCxUZjm56uVgmI7sHRoUX4qOSNU Gwz5S1I9oX38ejrSl027wtS7/WdnZsLUA0BSU/zppQRcbmv1CguQKIBH/fcp04zM1ADC TzsN21EWyaiI+82r4uYKOhfwPi/wcWFXJNcCfI1OlxbMav2Q+8WcGzHjGgiTHQNQpYG9 Z8yNvF5Fy0FeLFBgSA849g7Eh7bRANxryygjgAv8pjhATMua70fXoNTEWJHhD1ZyoEqK aMHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j9La2LdE; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h12-20020a170902f54c00b0016a4ca6516asi26367742plf.406.2022.06.30.10.19.03; Thu, 30 Jun 2022 10:19:19 -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=@chromium.org header.s=google header.b=j9La2LdE; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235754AbiF3RQQ (ORCPT + 99 others); Thu, 30 Jun 2022 13:16:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235518AbiF3RQN (ORCPT ); Thu, 30 Jun 2022 13:16:13 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F583E5CB for ; Thu, 30 Jun 2022 10:16:12 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id r3so34939818ybr.6 for ; Thu, 30 Jun 2022 10:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=o8689H0UAxz4K3OeSIRtr+YJ/Xi+oP67C+537YTthgw=; b=j9La2LdEFflVgzA2Rowu6dp2UY6aqc8v3FgtGD451eUdnEGBi8rD/KNhAXxKLJrRpc /GnohVyDXhKFZlxjAyiN07Ulvf4ZV21iDtYe2inkkIohq4Z/yKlaUyW9jep0T7UdwBe3 /0GmkgbHF5cpsJgpAVcNHmWeAGYebStTf2AB0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o8689H0UAxz4K3OeSIRtr+YJ/Xi+oP67C+537YTthgw=; b=3awzHPWR69gZRhS1ic2ahAddfDcEg2WLdC+PII1ElRMbCOpkceQHcBEjNihisJYgBK 4mjzH3Yf2xy6wXYFNofCMrEXGyQ4mjtC6gRdWQE5uCoE40ja0mDMjdY24JbkTTwIEyOJ 1cF7gstDyXpNl8ZR9HW2mx8eCz1fezKcEKwcH5EtdeRiCoqF3bKxD490RWAd2Bh8xYt+ lwtFS0biDcQzCsJQGj3mW0xCS/EgOPiAIjl/hDeEI6X9UIJ1D/4A5Jm3f94xRgE0WM6Q 2kM+OeX12l2h++DfVlDGN9aqA27sgO7+ODx9LxeGD0p/N15sOpFiY0Jq9DFB8BNnycIO 0CUg== X-Gm-Message-State: AJIora98PPUgMxEnpzBR4juV5jmph2AHnvIEgVw1SbLV9BpIPcviehxK AWtbJ+Q4IIxjqAJPSr9PA8iuPXxENqWRrUSgMQ8rdg== X-Received: by 2002:a25:b9c7:0:b0:66c:e02d:9749 with SMTP id y7-20020a25b9c7000000b0066ce02d9749mr10919746ybj.494.1656609371601; Thu, 30 Jun 2022 10:16:11 -0700 (PDT) MIME-Version: 1.0 References: <20220629233314.3540377-1-pmalani@chromium.org> <20220629233314.3540377-3-pmalani@chromium.org> In-Reply-To: From: Prashant Malani Date: Thu, 30 Jun 2022 10:16:00 -0700 Message-ID: Subject: Re: [PATCH 2/9] usb: typec: Add retimer handle to port To: Heikki Krogerus 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Heikki, On Thu, Jun 30, 2022 at 1:27 AM Heikki Krogerus wrote: > > 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 knew I was forgetting something... I'll fix this in v2. > > I guess we can look handle this later, but there can actually be two > onboard retimers for each connector. You're referring to the cascaded case right? OK, I'll bear this in mind for later series (right now the EC exposes just 1 interface for retimer). Thanks, -Prashant