Re: [PATCH 1/3] usb: typec: tcpm: Export the logging function so it can be used by tcpci

From: Guenter Roeck
Date: Mon May 06 2019 - 11:29:39 EST


On Mon, May 06, 2019 at 08:08:28AM -0600, Angus Ainslie (Purism) wrote:
> Give the rest of the tcpm stack access to the logging function.
>

Those functions are not intended to be exported. I would be open to extracting
the loging code into its own file and make it generic/usable for all tcpm
drivers, but the tcpm log itself should be limited to tcpm, and remain so.

Guenter

> Signed-off-by: Angus Ainslie (Purism) <angus@xxxxxxxx>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 3 ++-
> include/linux/usb/tcpm.h | 2 ++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index fba32d84e578..7c35cc1accae 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -465,7 +465,7 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
> }
>
> __printf(2, 3)
> -static void tcpm_log(struct tcpm_port *port, const char *fmt, ...)
> +void tcpm_log(struct tcpm_port *port, const char *fmt, ...)
> {
> va_list args;
>
> @@ -479,6 +479,7 @@ static void tcpm_log(struct tcpm_port *port, const char *fmt, ...)
> _tcpm_log(port, fmt, args);
> va_end(args);
> }
> +EXPORT_SYMBOL_GPL(tcpm_log);
>
> __printf(2, 3)
> static void tcpm_log_force(struct tcpm_port *port, const char *fmt, ...)
> diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
> index 36a15dcadc53..70bfffdf5760 100644
> --- a/include/linux/usb/tcpm.h
> +++ b/include/linux/usb/tcpm.h
> @@ -169,4 +169,6 @@ void tcpm_pd_transmit_complete(struct tcpm_port *port,
> void tcpm_pd_hard_reset(struct tcpm_port *port);
> void tcpm_tcpc_reset(struct tcpm_port *port);
>
> +void tcpm_log(struct tcpm_port *port, const char *fmt, ...);
> +
> #endif /* __LINUX_USB_TCPM_H */
> --
> 2.17.1
>