From: Viresh Kumar Date: Mon, 13 Jun 2016 16:18:28 +0000 (+0530) Subject: greybus: svc: disable connection after all its users are gone X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d1a8c36ec10446c3584033b06beaa51bad188144;p=linux-beck.git greybus: svc: disable connection after all its users are gone gb_svc_del() can be called during removal of gb-es2.ko module as well, and in that case we would like to properly shutdown all modules and interfaces as USB is still alive. This requires that we don't disable the svc connection, at least for tx, as that will be used while removing modules and interfaces. Disable only rx to begin with, as we shouldn't be handling any requests from the SVC. Disable tx only after all the users of svc connection are gone. Tested on EVT 2.0 by remove gb-es2.ko module. There are still few errors, specially while quiescing the connections (-22), but not that many. Signed-off-by: Viresh Kumar Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index d467ceb0916d..e316f08ab756 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -1456,7 +1456,7 @@ static void gb_svc_remove_modules(struct gb_svc *svc) void gb_svc_del(struct gb_svc *svc) { - gb_connection_disable(svc->connection); + gb_connection_disable_rx(svc->connection); /* * The SVC device and input device may have been registered @@ -1473,6 +1473,8 @@ void gb_svc_del(struct gb_svc *svc) flush_workqueue(svc->wq); gb_svc_remove_modules(svc); + + gb_connection_disable(svc->connection); } void gb_svc_put(struct gb_svc *svc)