mirror of https://gitee.com/openkylin/linux.git
usb: typec: ucsi: Optimise ucsi_unregister()
There is no need to reset the PPM when the interface is unregistered. Quietly silencing the notifications and then unregistering everything is enough. This speeds up ucsi_unregister() a lot. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Tested-by: Ajay Gupta <ajayg@nvidia.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20191104142435.29960-19-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e716bb38ed
commit
74ce3e4127
|
@ -1045,15 +1045,14 @@ EXPORT_SYMBOL_GPL(ucsi_register);
|
||||||
*/
|
*/
|
||||||
void ucsi_unregister(struct ucsi *ucsi)
|
void ucsi_unregister(struct ucsi *ucsi)
|
||||||
{
|
{
|
||||||
u64 command;
|
u64 cmd = UCSI_SET_NOTIFICATION_ENABLE;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Make sure that we are not in the middle of driver initialization */
|
/* Make sure that we are not in the middle of driver initialization */
|
||||||
cancel_work_sync(&ucsi->work);
|
cancel_work_sync(&ucsi->work);
|
||||||
|
|
||||||
/* Disable everything except command complete notification */
|
/* Disable notifications */
|
||||||
command = UCSI_SET_NOTIFICATION_ENABLE | UCSI_ENABLE_NTFY_CMD_COMPLETE;
|
ucsi->ops->async_write(ucsi, UCSI_CONTROL, &cmd, sizeof(cmd));
|
||||||
ucsi_send_command(ucsi, command, NULL, 0);
|
|
||||||
|
|
||||||
for (i = 0; i < ucsi->cap.num_connectors; i++) {
|
for (i = 0; i < ucsi->cap.num_connectors; i++) {
|
||||||
cancel_work_sync(&ucsi->connector[i].work);
|
cancel_work_sync(&ucsi->connector[i].work);
|
||||||
|
@ -1063,8 +1062,6 @@ void ucsi_unregister(struct ucsi *ucsi)
|
||||||
typec_unregister_port(ucsi->connector[i].port);
|
typec_unregister_port(ucsi->connector[i].port);
|
||||||
}
|
}
|
||||||
|
|
||||||
ucsi_reset_ppm(ucsi);
|
|
||||||
|
|
||||||
kfree(ucsi->connector);
|
kfree(ucsi->connector);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ucsi_unregister);
|
EXPORT_SYMBOL_GPL(ucsi_unregister);
|
||||||
|
|
Loading…
Reference in New Issue