diff mbox

[2/4] usb: typec: tcpm: Release the role mux when exiting

Message ID 20180430124158.45269-3-heikki.krogerus@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Heikki Krogerus April 30, 2018, 12:41 p.m. UTC
The ref count for the USB role switch device must be
released after we are done using the switch.

Fixes: c6962c29729c ("usb: typec: tcpm: Set USB role switch to device mode when configured as such")
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/tcpm.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Guenter Roeck April 30, 2018, 1:40 p.m. UTC | #1
On 04/30/2018 05:41 AM, Heikki Krogerus wrote:
> The ref count for the USB role switch device must be
> released after we are done using the switch.
> 
> Fixes: c6962c29729c ("usb: typec: tcpm: Set USB role switch to device mode when configured as such")
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/usb/typec/tcpm.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
> index 1ee259bc14a5..66dc0773b9bf 100644
> --- a/drivers/usb/typec/tcpm.c
> +++ b/drivers/usb/typec/tcpm.c
> @@ -4652,6 +4652,7 @@ void tcpm_unregister_port(struct tcpm_port *port)
>   	for (i = 0; i < ARRAY_SIZE(port->port_altmode); i++)
>   		typec_unregister_altmode(port->port_altmode[i]);
>   	typec_unregister_port(port->typec_port);
> +	usb_role_switch_put(port->role_sw);
>   	tcpm_debugfs_exit(port);
>   	destroy_workqueue(port->wq);
>   }
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans de Goede May 1, 2018, 9:54 a.m. UTC | #2
Hi,

On 30-04-18 14:41, Heikki Krogerus wrote:
> The ref count for the USB role switch device must be
> released after we are done using the switch.
> 
> Fixes: c6962c29729c ("usb: typec: tcpm: Set USB role switch to device mode when configured as such")
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Makes sense:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans

> ---
>   drivers/usb/typec/tcpm.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
> index 1ee259bc14a5..66dc0773b9bf 100644
> --- a/drivers/usb/typec/tcpm.c
> +++ b/drivers/usb/typec/tcpm.c
> @@ -4652,6 +4652,7 @@ void tcpm_unregister_port(struct tcpm_port *port)
>   	for (i = 0; i < ARRAY_SIZE(port->port_altmode); i++)
>   		typec_unregister_altmode(port->port_altmode[i]);
>   	typec_unregister_port(port->typec_port);
> +	usb_role_switch_put(port->role_sw);
>   	tcpm_debugfs_exit(port);
>   	destroy_workqueue(port->wq);
>   }
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 1ee259bc14a5..66dc0773b9bf 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -4652,6 +4652,7 @@  void tcpm_unregister_port(struct tcpm_port *port)
 	for (i = 0; i < ARRAY_SIZE(port->port_altmode); i++)
 		typec_unregister_altmode(port->port_altmode[i]);
 	typec_unregister_port(port->typec_port);
+	usb_role_switch_put(port->role_sw);
 	tcpm_debugfs_exit(port);
 	destroy_workqueue(port->wq);
 }