diff mbox series

[3/4] platform/chrome: cros_ec_typec: Stash port driver info

Message ID 20220819190807.1275937-4-pmalani@chromium.org (mailing list archive)
State New, archived
Headers show
Series platform/chrome: cros_ec_typec: Altmode fixes | expand

Commit Message

Prashant Malani Aug. 19, 2022, 7:08 p.m. UTC
Stash port number and a pointer to the driver-specific struct in the
local Type-C port struct.

These can be useful to the port driver to figure out how to communicate
with the ChromeOS EC when an altmode driver related callback is invoked
from the Type-C class code.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
---
 drivers/platform/chrome/cros_ec_typec.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Tzung-Bi Shih Aug. 23, 2022, 4:43 a.m. UTC | #1
On Fri, Aug 19, 2022 at 07:08:04PM +0000, Prashant Malani wrote:
> Stash port number and a pointer to the driver-specific struct in the
> local Type-C port struct.
> 
> These can be useful to the port driver to figure out how to communicate
> with the ChromeOS EC when an altmode driver related callback is invoked
> from the Type-C class code.

The patch looks good to me.  But I would suggest to send it in later series
that uses the driver-specific struct (e.g. in altmode driver related callbacks)
to make the usage clear.
Heikki Krogerus Aug. 23, 2022, 8:17 a.m. UTC | #2
On Tue, Aug 23, 2022 at 04:43:41AM +0000, Tzung-Bi Shih wrote:
> On Fri, Aug 19, 2022 at 07:08:04PM +0000, Prashant Malani wrote:
> > Stash port number and a pointer to the driver-specific struct in the
> > local Type-C port struct.
> > 
> > These can be useful to the port driver to figure out how to communicate
> > with the ChromeOS EC when an altmode driver related callback is invoked
> > from the Type-C class code.
> 
> The patch looks good to me.  But I would suggest to send it in later series
> that uses the driver-specific struct (e.g. in altmode driver related callbacks)
> to make the usage clear.

I agree.

thanks,
Prashant Malani Aug. 23, 2022, 5:52 p.m. UTC | #3
Thanks for the reviews folks.

On Tue, Aug 23, 2022 at 1:17 AM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> On Tue, Aug 23, 2022 at 04:43:41AM +0000, Tzung-Bi Shih wrote:
> > On Fri, Aug 19, 2022 at 07:08:04PM +0000, Prashant Malani wrote:
> > > Stash port number and a pointer to the driver-specific struct in the
> > > local Type-C port struct.
> > >
> > > These can be useful to the port driver to figure out how to communicate
> > > with the ChromeOS EC when an altmode driver related callback is invoked
> > > from the Type-C class code.
> >
> > The patch looks good to me.  But I would suggest to send it in later series
> > that uses the driver-specific struct (e.g. in altmode driver related callbacks)
> > to make the usage clear.
>
> I agree.

Ok. I will resend this along with the alt mode series.

BR,

-Prashant
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index dc5722db2066..7daf4207c11e 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -44,6 +44,7 @@  struct cros_typec_altmode_node {
 /* Per port data. */
 struct cros_typec_port {
 	struct typec_port *port;
+	int port_num;
 	/* Initial capabilities for the port. */
 	struct typec_capability caps;
 	struct typec_partner *partner;
@@ -71,6 +72,8 @@  struct cros_typec_port {
 	struct ec_response_typec_discovery *disc_data;
 	struct list_head partner_mode_list;
 	struct list_head plug_mode_list;
+
+	struct cros_typec_data *typec_data;
 };
 
 /* Platform-specific data for the Chrome OS EC Type C controller. */
@@ -368,6 +371,8 @@  static int cros_typec_init_ports(struct cros_typec_data *typec)
 			goto unregister_ports;
 		}
 
+		cros_port->port_num = port_num;
+		cros_port->typec_data = typec;
 		typec->ports[port_num] = cros_port;
 		cap = &cros_port->caps;