From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EB0128F0 for ; Tue, 12 Jul 2022 08:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657614537; x=1689150537; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+XeOqU0GsgbobhhFBODuKDEdesvFbYh9RlThqOP3A6o=; b=YfT5MZgF1l5yyHw+hCcKiq4b7/FFxKYP0lE9M3IQV+5Digbu97BCTODS 9QCRndgjIfMnr6at9ysfniLa0sAFLa0o4Yx8KSNKX9yYyhm+4sYovs2bJ XkjMZXY06X+JIuzJDj0bix9FGXSWc82zY9VWewVyTKI8htWlKNBPnyLSe RymvxSX6YEbNkIfpJYc9kvSNjPBWBuJ0ZHv8QkrfHUi0hRXZIMMuSbpJo 2Lq+TIU4fM1EyQIBdANjN1rTVS4HmBuJSP0OyLhBAjqCWggX4I7eqOoNV iFQhkEcPMAE5QkuNVYxP8YY07xSOqkzZJqmbE5cInMNMpzH6WtHh4qeX/ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10405"; a="282426510" X-IronPort-AV: E=Sophos;i="5.92,265,1650956400"; d="scan'208";a="282426510" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2022 01:28:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,265,1650956400"; d="scan'208";a="737401342" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 12 Jul 2022 01:28:52 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 12 Jul 2022 11:28:51 +0300 Date: Tue, 12 Jul 2022 11:28:51 +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 , Tzung-Bi Shih Subject: Re: [PATCH v4 2/9] usb: typec: Add retimer handle to port Message-ID: References: <20220711072333.2064341-1-pmalani@chromium.org> <20220711072333.2064341-3-pmalani@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220711072333.2064341-3-pmalani@chromium.org> Mon, Jul 11, 2022 at 07:22:56AM +0000, Prashant Malani kirjoitti: > 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 Acked-by: Heikki Krogerus > --- > > Changes since v3: > - No changes. > > Changes since v2: > - No changes. > > Changes since v1: > - Relinquish retimer reference during typec_release. > > drivers/usb/typec/class.c | 9 +++++++++ > drivers/usb/typec/class.h | 1 + > 2 files changed, 10 insertions(+) > > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c > index 9062836bb638..f08e32d552b4 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" > @@ -1736,6 +1737,7 @@ static void typec_release(struct device *dev) > ida_destroy(&port->mode_ids); > typec_switch_put(port->sw); > typec_mux_put(port->mux); > + typec_retimer_put(port->retimer); > kfree(port->cap); > kfree(port); > } > @@ -2249,6 +2251,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); > diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h > index 43fcf9e37a8c..673b2952b074 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; > -- > 2.37.0.144.g8ac04bfd2-goog -- heikki