diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2015-03-27 00:27:58 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-03 16:18:56 +0200 |
commit | f3de9b635d93a3d268adda428e1df94091506a42 (patch) | |
tree | 6b58047776ca5c84302360cc82ca5c874ef0528c /drivers/misc/mei/wd.c | |
parent | 1d9013f09203c694e2cba478b05afc6484d55180 (diff) | |
download | linux-f3de9b635d93a3d268adda428e1df94091506a42.tar.bz2 |
mei: use mei_cl_is_connected consistently
Replace open coded check for cl->state !=/== MEI_FILE_CONNECTED
with mei_cl_is_connected function.
Note that cl->state != MEI_FILE_CONNECTED is not the same
as cl->state == MEI_FILE_DISCONNECTED
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/wd.c')
-rw-r--r-- | drivers/misc/mei/wd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c index ac1e6235692d..2725f865c3d6 100644 --- a/drivers/misc/mei/wd.c +++ b/drivers/misc/mei/wd.c @@ -160,9 +160,10 @@ int mei_wd_send(struct mei_device *dev) */ int mei_wd_stop(struct mei_device *dev) { + struct mei_cl *cl = &dev->wd_cl; int ret; - if (dev->wd_cl.state != MEI_FILE_CONNECTED || + if (!mei_cl_is_connected(cl) || dev->wd_state != MEI_WD_RUNNING) return 0; @@ -170,7 +171,7 @@ int mei_wd_stop(struct mei_device *dev) dev->wd_state = MEI_WD_STOPPING; - ret = mei_cl_flow_ctrl_creds(&dev->wd_cl); + ret = mei_cl_flow_ctrl_creds(cl); if (ret < 0) goto err; @@ -211,13 +212,16 @@ err: */ static int mei_wd_ops_start(struct watchdog_device *wd_dev) { - int err = -ENODEV; struct mei_device *dev; + struct mei_cl *cl; + int err = -ENODEV; dev = watchdog_get_drvdata(wd_dev); if (!dev) return -ENODEV; + cl = &dev->wd_cl; + mutex_lock(&dev->device_lock); if (dev->dev_state != MEI_DEV_ENABLED) { @@ -226,8 +230,8 @@ static int mei_wd_ops_start(struct watchdog_device *wd_dev) goto end_unlock; } - if (dev->wd_cl.state != MEI_FILE_CONNECTED) { - dev_dbg(dev->dev, "MEI Driver is not connected to Watchdog Client\n"); + if (!mei_cl_is_connected(cl)) { + cl_dbg(dev, cl, "MEI Driver is not connected to Watchdog Client\n"); goto end_unlock; } @@ -282,8 +286,8 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev) mutex_lock(&dev->device_lock); - if (cl->state != MEI_FILE_CONNECTED) { - dev_err(dev->dev, "wd: not connected.\n"); + if (!mei_cl_is_connected(cl)) { + cl_err(dev, cl, "wd: not connected.\n"); ret = -ENODEV; goto end; } |