Patchwork usb: typec: tcpm: Remove unused functions

login
register
mail settings
Submitter Guenter Roeck
Date Feb. 12, 2019, 3:58 p.m.
Message ID <1549987097-27937-1-git-send-email-linux@roeck-us.net>
Download mbox | patch
Permalink /patch/724079/
State New
Headers show

Comments

Guenter Roeck - Feb. 12, 2019, 3:58 p.m.
tcpm_update_source_capabilities() and tcpm_update_sink_capabilities()
are not used anywhere, and I don't recall why I introduced those functions
in the first place. Effectively that means that we don't know if they even
work, or ever did. Lets remove them.

Reported-by: Kyle Tso <kyletso@google.com>
Cc: Kyle Tso <kyletso@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/usb/typec/tcpm/tcpm.c | 60 -------------------------------------------
 include/linux/usb/tcpm.h      |  6 -----
 2 files changed, 66 deletions(-)
Kyle Tso - Feb. 13, 2019, 3:30 a.m.
On Tue, Feb 12, 2019 at 11:58 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> tcpm_update_source_capabilities() and tcpm_update_sink_capabilities()
> are not used anywhere, and I don't recall why I introduced those functions
> in the first place. Effectively that means that we don't know if they even
> work, or ever did. Lets remove them.
>
> Reported-by: Kyle Tso <kyletso@google.com>
> Cc: Kyle Tso <kyletso@google.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Kyle Tso <kyletso@google.com>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 60 -------------------------------------------
>  include/linux/usb/tcpm.h      |  6 -----
>  2 files changed, 66 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index f1c39a3c7534..a6b2413c59a6 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -4435,66 +4435,6 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
>         return 0;
>  }
>
> -int tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo,
> -                                   unsigned int nr_pdo)
> -{
> -       if (tcpm_validate_caps(port, pdo, nr_pdo))
> -               return -EINVAL;
> -
> -       mutex_lock(&port->lock);
> -       port->nr_src_pdo = tcpm_copy_pdos(port->src_pdo, pdo, nr_pdo);
> -       switch (port->state) {
> -       case SRC_UNATTACHED:
> -       case SRC_ATTACH_WAIT:
> -       case SRC_TRYWAIT:
> -               tcpm_set_cc(port, tcpm_rp_cc(port));
> -               break;
> -       case SRC_SEND_CAPABILITIES:
> -       case SRC_NEGOTIATE_CAPABILITIES:
> -       case SRC_READY:
> -       case SRC_WAIT_NEW_CAPABILITIES:
> -               tcpm_set_cc(port, tcpm_rp_cc(port));
> -               tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0);
> -               break;
> -       default:
> -               break;
> -       }
> -       mutex_unlock(&port->lock);
> -       return 0;
> -}
> -EXPORT_SYMBOL_GPL(tcpm_update_source_capabilities);
> -
> -int tcpm_update_sink_capabilities(struct tcpm_port *port, const u32 *pdo,
> -                                 unsigned int nr_pdo,
> -                                 unsigned int operating_snk_mw)
> -{
> -       if (tcpm_validate_caps(port, pdo, nr_pdo))
> -               return -EINVAL;
> -
> -       mutex_lock(&port->lock);
> -       port->nr_snk_pdo = tcpm_copy_pdos(port->snk_pdo, pdo, nr_pdo);
> -       port->operating_snk_mw = operating_snk_mw;
> -       port->update_sink_caps = true;
> -
> -       switch (port->state) {
> -       case SNK_NEGOTIATE_CAPABILITIES:
> -       case SNK_NEGOTIATE_PPS_CAPABILITIES:
> -       case SNK_READY:
> -       case SNK_TRANSITION_SINK:
> -       case SNK_TRANSITION_SINK_VBUS:
> -               if (port->pps_data.active)
> -                       tcpm_set_state(port, SNK_NEGOTIATE_PPS_CAPABILITIES, 0);
> -               else
> -                       tcpm_set_state(port, SNK_NEGOTIATE_CAPABILITIES, 0);
> -               break;
> -       default:
> -               break;
> -       }
> -       mutex_unlock(&port->lock);
> -       return 0;
> -}
> -EXPORT_SYMBOL_GPL(tcpm_update_sink_capabilities);
> -
>  /* Power Supply access to expose source power information */
>  enum tcpm_psy_online_states {
>         TCPM_PSY_OFFLINE = 0,
> diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
> index 50c74a77db55..0c532ca3f079 100644
> --- a/include/linux/usb/tcpm.h
> +++ b/include/linux/usb/tcpm.h
> @@ -159,12 +159,6 @@ struct tcpm_port;
>  struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc);
>  void tcpm_unregister_port(struct tcpm_port *port);
>
> -int tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo,
> -                                   unsigned int nr_pdo);
> -int tcpm_update_sink_capabilities(struct tcpm_port *port, const u32 *pdo,
> -                                 unsigned int nr_pdo,
> -                                 unsigned int operating_snk_mw);
> -
>  void tcpm_vbus_change(struct tcpm_port *port);
>  void tcpm_cc_change(struct tcpm_port *port);
>  void tcpm_pd_receive(struct tcpm_port *port,
> --
> 2.7.4
>

Patch

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index f1c39a3c7534..a6b2413c59a6 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -4435,66 +4435,6 @@  static int tcpm_fw_get_caps(struct tcpm_port *port,
 	return 0;
 }
 
-int tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo,
-				    unsigned int nr_pdo)
-{
-	if (tcpm_validate_caps(port, pdo, nr_pdo))
-		return -EINVAL;
-
-	mutex_lock(&port->lock);
-	port->nr_src_pdo = tcpm_copy_pdos(port->src_pdo, pdo, nr_pdo);
-	switch (port->state) {
-	case SRC_UNATTACHED:
-	case SRC_ATTACH_WAIT:
-	case SRC_TRYWAIT:
-		tcpm_set_cc(port, tcpm_rp_cc(port));
-		break;
-	case SRC_SEND_CAPABILITIES:
-	case SRC_NEGOTIATE_CAPABILITIES:
-	case SRC_READY:
-	case SRC_WAIT_NEW_CAPABILITIES:
-		tcpm_set_cc(port, tcpm_rp_cc(port));
-		tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0);
-		break;
-	default:
-		break;
-	}
-	mutex_unlock(&port->lock);
-	return 0;
-}
-EXPORT_SYMBOL_GPL(tcpm_update_source_capabilities);
-
-int tcpm_update_sink_capabilities(struct tcpm_port *port, const u32 *pdo,
-				  unsigned int nr_pdo,
-				  unsigned int operating_snk_mw)
-{
-	if (tcpm_validate_caps(port, pdo, nr_pdo))
-		return -EINVAL;
-
-	mutex_lock(&port->lock);
-	port->nr_snk_pdo = tcpm_copy_pdos(port->snk_pdo, pdo, nr_pdo);
-	port->operating_snk_mw = operating_snk_mw;
-	port->update_sink_caps = true;
-
-	switch (port->state) {
-	case SNK_NEGOTIATE_CAPABILITIES:
-	case SNK_NEGOTIATE_PPS_CAPABILITIES:
-	case SNK_READY:
-	case SNK_TRANSITION_SINK:
-	case SNK_TRANSITION_SINK_VBUS:
-		if (port->pps_data.active)
-			tcpm_set_state(port, SNK_NEGOTIATE_PPS_CAPABILITIES, 0);
-		else
-			tcpm_set_state(port, SNK_NEGOTIATE_CAPABILITIES, 0);
-		break;
-	default:
-		break;
-	}
-	mutex_unlock(&port->lock);
-	return 0;
-}
-EXPORT_SYMBOL_GPL(tcpm_update_sink_capabilities);
-
 /* Power Supply access to expose source power information */
 enum tcpm_psy_online_states {
 	TCPM_PSY_OFFLINE = 0,
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index 50c74a77db55..0c532ca3f079 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -159,12 +159,6 @@  struct tcpm_port;
 struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc);
 void tcpm_unregister_port(struct tcpm_port *port);
 
-int tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo,
-				    unsigned int nr_pdo);
-int tcpm_update_sink_capabilities(struct tcpm_port *port, const u32 *pdo,
-				  unsigned int nr_pdo,
-				  unsigned int operating_snk_mw);
-
 void tcpm_vbus_change(struct tcpm_port *port);
 void tcpm_cc_change(struct tcpm_port *port);
 void tcpm_pd_receive(struct tcpm_port *port,