diff options
Diffstat (limited to 'drivers/misc/mei/wd.c')
-rw-r--r-- | drivers/misc/mei/wd.c | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c index a84a664dfcc..b836dfffceb 100644 --- a/drivers/misc/mei/wd.c +++ b/drivers/misc/mei/wd.c @@ -17,7 +17,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/device.h> -#include <linux/pci.h> #include <linux/sched.h> #include <linux/watchdog.h> @@ -42,7 +41,7 @@ const uuid_le mei_wd_guid = UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, 0x89, static void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout) { - dev_dbg(&dev->pdev->dev, "wd: set timeout=%d.\n", timeout); + dev_dbg(dev->dev, "wd: set timeout=%d.\n", timeout); memcpy(dev->wd_data, mei_start_wd_params, MEI_WD_HDR_SIZE); memcpy(dev->wd_data + MEI_WD_HDR_SIZE, &timeout, sizeof(u16)); } @@ -52,14 +51,14 @@ static void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout) * * @dev: the device structure * - * returns -ENOTTY if wd client cannot be found + * Return: -ENOTTY if wd client cannot be found * -EIO if write has failed * 0 on success */ int mei_wd_host_init(struct mei_device *dev) { struct mei_cl *cl = &dev->wd_cl; - int id; + struct mei_me_client *me_cl; int ret; mei_cl_init(cl, dev); @@ -69,25 +68,26 @@ int mei_wd_host_init(struct mei_device *dev) /* check for valid client id */ - id = mei_me_cl_by_uuid(dev, &mei_wd_guid); - if (id < 0) { - dev_info(&dev->pdev->dev, "wd: failed to find the client\n"); + me_cl = mei_me_cl_by_uuid(dev, &mei_wd_guid); + if (!me_cl) { + dev_info(dev->dev, "wd: failed to find the client\n"); return -ENOTTY; } - cl->me_client_id = dev->me_clients[id].client_id; + cl->me_client_id = me_cl->client_id; + cl->cl_uuid = me_cl->props.protocol_name; ret = mei_cl_link(cl, MEI_WD_HOST_CLIENT_ID); if (ret < 0) { - dev_info(&dev->pdev->dev, "wd: failed link client\n"); + dev_info(dev->dev, "wd: failed link client\n"); return ret; } ret = mei_cl_connect(cl, NULL); if (ret) { - dev_err(&dev->pdev->dev, "wd: failed to connect = %d\n", ret); + dev_err(dev->dev, "wd: failed to connect = %d\n", ret); mei_cl_unlink(cl); return ret; } @@ -105,7 +105,7 @@ int mei_wd_host_init(struct mei_device *dev) * * @dev: the device structure * - * returns 0 if success, + * Return: 0 if success, * -EIO when message send fails * -EINVAL when invalid message is to be sent * -ENODEV on flow control failure @@ -127,19 +127,19 @@ int mei_wd_send(struct mei_device *dev) else if (!memcmp(dev->wd_data, mei_stop_wd_params, MEI_WD_HDR_SIZE)) hdr.length = MEI_WD_STOP_MSG_SIZE; else { - dev_err(&dev->pdev->dev, "wd: invalid message is to be sent, aborting\n"); + dev_err(dev->dev, "wd: invalid message is to be sent, aborting\n"); return -EINVAL; } ret = mei_write_message(dev, &hdr, dev->wd_data); if (ret) { - dev_err(&dev->pdev->dev, "wd: write message failed\n"); + dev_err(dev->dev, "wd: write message failed\n"); return ret; } ret = mei_cl_flow_ctrl_reduce(cl); if (ret) { - dev_err(&dev->pdev->dev, "wd: flow_ctrl_reduce failed.\n"); + dev_err(dev->dev, "wd: flow_ctrl_reduce failed.\n"); return ret; } @@ -150,9 +150,8 @@ int mei_wd_send(struct mei_device *dev) * mei_wd_stop - sends watchdog stop message to fw. * * @dev: the device structure - * @preserve: indicate if to keep the timeout value * - * returns 0 if success + * Return: 0 if success * on error: * -EIO when message send fails * -EINVAL when invalid message is to be sent @@ -192,11 +191,10 @@ int mei_wd_stop(struct mei_device *dev) if (dev->wd_state != MEI_WD_IDLE) { /* timeout */ ret = -ETIME; - dev_warn(&dev->pdev->dev, - "wd: stop failed to complete ret=%d.\n", ret); + dev_warn(dev->dev, "wd: stop failed to complete ret=%d\n", ret); goto err; } - dev_dbg(&dev->pdev->dev, "wd: stop completed after %u msec\n", + dev_dbg(dev->dev, "wd: stop completed after %u msec\n", MEI_WD_STOP_TIMEOUT - jiffies_to_msecs(ret)); return 0; err: @@ -208,7 +206,7 @@ err: * * @wd_dev - watchdog device struct * - * returns 0 if success, negative errno code for failure + * Return: 0 if success, negative errno code for failure */ static int mei_wd_ops_start(struct watchdog_device *wd_dev) { @@ -222,15 +220,13 @@ static int mei_wd_ops_start(struct watchdog_device *wd_dev) mutex_lock(&dev->device_lock); if (dev->dev_state != MEI_DEV_ENABLED) { - dev_dbg(&dev->pdev->dev, - "wd: dev_state != MEI_DEV_ENABLED dev_state = %s\n", + dev_dbg(dev->dev, "wd: dev_state != MEI_DEV_ENABLED dev_state = %s\n", mei_dev_state_str(dev->dev_state)); goto end_unlock; } if (dev->wd_cl.state != MEI_FILE_CONNECTED) { - dev_dbg(&dev->pdev->dev, - "MEI Driver is not connected to Watchdog Client\n"); + dev_dbg(dev->dev, "MEI Driver is not connected to Watchdog Client\n"); goto end_unlock; } @@ -247,7 +243,7 @@ end_unlock: * * @wd_dev - watchdog device struct * - * returns 0 if success, negative errno code for failure + * Return: 0 if success, negative errno code for failure */ static int mei_wd_ops_stop(struct watchdog_device *wd_dev) { @@ -269,7 +265,7 @@ static int mei_wd_ops_stop(struct watchdog_device *wd_dev) * * @wd_dev - watchdog device struct * - * returns 0 if success, negative errno code for failure + * Return: 0 if success, negative errno code for failure */ static int mei_wd_ops_ping(struct watchdog_device *wd_dev) { @@ -283,7 +279,7 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev) mutex_lock(&dev->device_lock); if (dev->wd_cl.state != MEI_FILE_CONNECTED) { - dev_err(&dev->pdev->dev, "wd: not connected.\n"); + dev_err(dev->dev, "wd: not connected.\n"); ret = -ENODEV; goto end; } @@ -296,7 +292,7 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev) /* Check if we can send the ping to HW*/ if (ret && mei_hbuf_acquire(dev)) { - dev_dbg(&dev->pdev->dev, "wd: sending ping\n"); + dev_dbg(dev->dev, "wd: sending ping\n"); ret = mei_wd_send(dev); if (ret) @@ -317,7 +313,7 @@ end: * @wd_dev - watchdog device struct * @timeout - timeout value to set * - * returns 0 if success, negative errno code for failure + * Return: 0 if success, negative errno code for failure */ static int mei_wd_ops_set_timeout(struct watchdog_device *wd_dev, unsigned int timeout) @@ -379,13 +375,12 @@ int mei_watchdog_register(struct mei_device *dev) ret = watchdog_register_device(&amt_wd_dev); mutex_lock(&dev->device_lock); if (ret) { - dev_err(&dev->pdev->dev, "wd: unable to register watchdog device = %d.\n", + dev_err(dev->dev, "wd: unable to register watchdog device = %d.\n", ret); return ret; } - dev_dbg(&dev->pdev->dev, - "wd: successfully register watchdog interface.\n"); + dev_dbg(dev->dev, "wd: successfully register watchdog interface.\n"); watchdog_set_drvdata(&amt_wd_dev, dev); return 0; } |