Message ID | 20200901025927.3596190-5-badhri@google.com |
---|---|
State | New |
Headers | show |
Series | TCPM support for FRS and AutoDischarge Disconnect | expand |
On Mon, Aug 31, 2020 at 07:59:17PM -0700, Badhri Jagan Sridharan wrote: > Allow chip level drivers to retrieve reference to tcpm_port. > > Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> I'm still wondering if this is the right way. Ideally the glue drivers should not need to deal with the tcpm_port at all directly, only with the tcpci handle they have. But FWIW: Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > Change since v1: > - Changing patch version to v6 to fix version number confusion. > --- > drivers/usb/typec/tcpm/tcpci.c | 6 ++++++ > drivers/usb/typec/tcpm/tcpci.h | 2 ++ > 2 files changed, 8 insertions(+) > > diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c > index 7d9491ba62fb..b960fe5a0f28 100644 > --- a/drivers/usb/typec/tcpm/tcpci.c > +++ b/drivers/usb/typec/tcpm/tcpci.c > @@ -38,6 +38,12 @@ struct tcpci_chip { > struct tcpci_data data; > }; > > +struct tcpm_port *tcpci_get_tcpm_port(struct tcpci *tcpci) > +{ > + return tcpci->port; > +} > +EXPORT_SYMBOL_GPL(tcpci_get_tcpm_port); > + > static inline struct tcpci *tcpc_to_tcpci(struct tcpc_dev *tcpc) > { > return container_of(tcpc, struct tcpci, tcpc); > diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h > index cf9d8b63adcb..04c49a0b0368 100644 > --- a/drivers/usb/typec/tcpm/tcpci.h > +++ b/drivers/usb/typec/tcpm/tcpci.h > @@ -150,4 +150,6 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data); > void tcpci_unregister_port(struct tcpci *tcpci); > irqreturn_t tcpci_irq(struct tcpci *tcpci); > > +struct tcpm_port; > +struct tcpm_port *tcpci_get_tcpm_port(struct tcpci *tcpci); > #endif /* __LINUX_USB_TCPCI_H */ > -- > 2.28.0.402.g5ffc5be6b7-goog -- heikki
diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 7d9491ba62fb..b960fe5a0f28 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -38,6 +38,12 @@ struct tcpci_chip { struct tcpci_data data; }; +struct tcpm_port *tcpci_get_tcpm_port(struct tcpci *tcpci) +{ + return tcpci->port; +} +EXPORT_SYMBOL_GPL(tcpci_get_tcpm_port); + static inline struct tcpci *tcpc_to_tcpci(struct tcpc_dev *tcpc) { return container_of(tcpc, struct tcpci, tcpc); diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h index cf9d8b63adcb..04c49a0b0368 100644 --- a/drivers/usb/typec/tcpm/tcpci.h +++ b/drivers/usb/typec/tcpm/tcpci.h @@ -150,4 +150,6 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data); void tcpci_unregister_port(struct tcpci *tcpci); irqreturn_t tcpci_irq(struct tcpci *tcpci); +struct tcpm_port; +struct tcpm_port *tcpci_get_tcpm_port(struct tcpci *tcpci); #endif /* __LINUX_USB_TCPCI_H */
Allow chip level drivers to retrieve reference to tcpm_port. Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> --- Change since v1: - Changing patch version to v6 to fix version number confusion. --- drivers/usb/typec/tcpm/tcpci.c | 6 ++++++ drivers/usb/typec/tcpm/tcpci.h | 2 ++ 2 files changed, 8 insertions(+)