diff options
author | Alexander Usyskin <alexander.usyskin@intel.com> | 2017-01-27 16:32:39 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-31 11:07:43 +0100 |
commit | 5d88246090c5e9b178eb05bcfb52bbaad2ae48f3 (patch) | |
tree | 35fba5dcc29e9a348d925ab900e2b69ee1346f69 /drivers/misc/mei/client.c | |
parent | 9ecb839f16a353e71175981a098842fda4ddc7f1 (diff) |
mei: bus: prevent hardware module unload if device on bus is active
The hardware module should not be unloaded if the bus
has active devices.
Get get_/put_ bus parent module upon client device
connection/disconnection, to prevent the hardware managing
module to disappear underneath.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/client.c')
-rw-r--r-- | drivers/misc/mei/client.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index da1c0703910a..619b4702347f 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c @@ -774,6 +774,8 @@ static void mei_cl_set_disconnected(struct mei_cl *cl) cl->tx_flow_ctrl_creds = 0; cl->timer_count = 0; + mei_cl_bus_module_put(cl); + if (!cl->me_cl) return; @@ -1077,13 +1079,17 @@ int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl, dev = cl->dev; + if (!mei_cl_bus_module_get(cl)) + return -ENODEV; + rets = mei_cl_set_connecting(cl, me_cl); if (rets) - return rets; + goto nortpm; if (mei_cl_is_fixed_address(cl)) { cl->state = MEI_FILE_CONNECTED; - return 0; + rets = 0; + goto nortpm; } rets = pm_runtime_get(dev->dev); |