aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/wd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/mei/wd.c')
-rw-r--r--drivers/misc/mei/wd.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c
index 40f46e4c2e9c..d28511b78eaa 100644
--- a/drivers/misc/mei/wd.c
+++ b/drivers/misc/mei/wd.c
@@ -42,7 +42,7 @@ const uuid_le mei_wd_guid = UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, 0x89,
42 42
43static void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout) 43static void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout)
44{ 44{
45 dev_dbg(&dev->pdev->dev, "wd: set timeout=%d.\n", timeout); 45 dev_dbg(dev->dev, "wd: set timeout=%d.\n", timeout);
46 memcpy(dev->wd_data, mei_start_wd_params, MEI_WD_HDR_SIZE); 46 memcpy(dev->wd_data, mei_start_wd_params, MEI_WD_HDR_SIZE);
47 memcpy(dev->wd_data + MEI_WD_HDR_SIZE, &timeout, sizeof(u16)); 47 memcpy(dev->wd_data + MEI_WD_HDR_SIZE, &timeout, sizeof(u16));
48} 48}
@@ -71,7 +71,7 @@ int mei_wd_host_init(struct mei_device *dev)
71 /* check for valid client id */ 71 /* check for valid client id */
72 me_cl = mei_me_cl_by_uuid(dev, &mei_wd_guid); 72 me_cl = mei_me_cl_by_uuid(dev, &mei_wd_guid);
73 if (!me_cl) { 73 if (!me_cl) {
74 dev_info(&dev->pdev->dev, "wd: failed to find the client\n"); 74 dev_info(dev->dev, "wd: failed to find the client\n");
75 return -ENOTTY; 75 return -ENOTTY;
76 } 76 }
77 77
@@ -81,14 +81,14 @@ int mei_wd_host_init(struct mei_device *dev)
81 ret = mei_cl_link(cl, MEI_WD_HOST_CLIENT_ID); 81 ret = mei_cl_link(cl, MEI_WD_HOST_CLIENT_ID);
82 82
83 if (ret < 0) { 83 if (ret < 0) {
84 dev_info(&dev->pdev->dev, "wd: failed link client\n"); 84 dev_info(dev->dev, "wd: failed link client\n");
85 return ret; 85 return ret;
86 } 86 }
87 87
88 ret = mei_cl_connect(cl, NULL); 88 ret = mei_cl_connect(cl, NULL);
89 89
90 if (ret) { 90 if (ret) {
91 dev_err(&dev->pdev->dev, "wd: failed to connect = %d\n", ret); 91 dev_err(dev->dev, "wd: failed to connect = %d\n", ret);
92 mei_cl_unlink(cl); 92 mei_cl_unlink(cl);
93 return ret; 93 return ret;
94 } 94 }
@@ -128,19 +128,19 @@ int mei_wd_send(struct mei_device *dev)
128 else if (!memcmp(dev->wd_data, mei_stop_wd_params, MEI_WD_HDR_SIZE)) 128 else if (!memcmp(dev->wd_data, mei_stop_wd_params, MEI_WD_HDR_SIZE))
129 hdr.length = MEI_WD_STOP_MSG_SIZE; 129 hdr.length = MEI_WD_STOP_MSG_SIZE;
130 else { 130 else {
131 dev_err(&dev->pdev->dev, "wd: invalid message is to be sent, aborting\n"); 131 dev_err(dev->dev, "wd: invalid message is to be sent, aborting\n");
132 return -EINVAL; 132 return -EINVAL;
133 } 133 }
134 134
135 ret = mei_write_message(dev, &hdr, dev->wd_data); 135 ret = mei_write_message(dev, &hdr, dev->wd_data);
136 if (ret) { 136 if (ret) {
137 dev_err(&dev->pdev->dev, "wd: write message failed\n"); 137 dev_err(dev->dev, "wd: write message failed\n");
138 return ret; 138 return ret;
139 } 139 }
140 140
141 ret = mei_cl_flow_ctrl_reduce(cl); 141 ret = mei_cl_flow_ctrl_reduce(cl);
142 if (ret) { 142 if (ret) {
143 dev_err(&dev->pdev->dev, "wd: flow_ctrl_reduce failed.\n"); 143 dev_err(dev->dev, "wd: flow_ctrl_reduce failed.\n");
144 return ret; 144 return ret;
145 } 145 }
146 146
@@ -193,11 +193,10 @@ int mei_wd_stop(struct mei_device *dev)
193 if (dev->wd_state != MEI_WD_IDLE) { 193 if (dev->wd_state != MEI_WD_IDLE) {
194 /* timeout */ 194 /* timeout */
195 ret = -ETIME; 195 ret = -ETIME;
196 dev_warn(&dev->pdev->dev, 196 dev_warn(dev->dev, "wd: stop failed to complete ret=%d\n", ret);
197 "wd: stop failed to complete ret=%d.\n", ret);
198 goto err; 197 goto err;
199 } 198 }
200 dev_dbg(&dev->pdev->dev, "wd: stop completed after %u msec\n", 199 dev_dbg(dev->dev, "wd: stop completed after %u msec\n",
201 MEI_WD_STOP_TIMEOUT - jiffies_to_msecs(ret)); 200 MEI_WD_STOP_TIMEOUT - jiffies_to_msecs(ret));
202 return 0; 201 return 0;
203err: 202err:
@@ -223,15 +222,13 @@ static int mei_wd_ops_start(struct watchdog_device *wd_dev)
223 mutex_lock(&dev->device_lock); 222 mutex_lock(&dev->device_lock);
224 223
225 if (dev->dev_state != MEI_DEV_ENABLED) { 224 if (dev->dev_state != MEI_DEV_ENABLED) {
226 dev_dbg(&dev->pdev->dev, 225 dev_dbg(dev->dev, "wd: dev_state != MEI_DEV_ENABLED dev_state = %s\n",
227 "wd: dev_state != MEI_DEV_ENABLED dev_state = %s\n",
228 mei_dev_state_str(dev->dev_state)); 226 mei_dev_state_str(dev->dev_state));
229 goto end_unlock; 227 goto end_unlock;
230 } 228 }
231 229
232 if (dev->wd_cl.state != MEI_FILE_CONNECTED) { 230 if (dev->wd_cl.state != MEI_FILE_CONNECTED) {
233 dev_dbg(&dev->pdev->dev, 231 dev_dbg(dev->dev, "MEI Driver is not connected to Watchdog Client\n");
234 "MEI Driver is not connected to Watchdog Client\n");
235 goto end_unlock; 232 goto end_unlock;
236 } 233 }
237 234
@@ -284,7 +281,7 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev)
284 mutex_lock(&dev->device_lock); 281 mutex_lock(&dev->device_lock);
285 282
286 if (dev->wd_cl.state != MEI_FILE_CONNECTED) { 283 if (dev->wd_cl.state != MEI_FILE_CONNECTED) {
287 dev_err(&dev->pdev->dev, "wd: not connected.\n"); 284 dev_err(dev->dev, "wd: not connected.\n");
288 ret = -ENODEV; 285 ret = -ENODEV;
289 goto end; 286 goto end;
290 } 287 }
@@ -297,7 +294,7 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev)
297 /* Check if we can send the ping to HW*/ 294 /* Check if we can send the ping to HW*/
298 if (ret && mei_hbuf_acquire(dev)) { 295 if (ret && mei_hbuf_acquire(dev)) {
299 296
300 dev_dbg(&dev->pdev->dev, "wd: sending ping\n"); 297 dev_dbg(dev->dev, "wd: sending ping\n");
301 298
302 ret = mei_wd_send(dev); 299 ret = mei_wd_send(dev);
303 if (ret) 300 if (ret)
@@ -380,13 +377,12 @@ int mei_watchdog_register(struct mei_device *dev)
380 ret = watchdog_register_device(&amt_wd_dev); 377 ret = watchdog_register_device(&amt_wd_dev);
381 mutex_lock(&dev->device_lock); 378 mutex_lock(&dev->device_lock);
382 if (ret) { 379 if (ret) {
383 dev_err(&dev->pdev->dev, "wd: unable to register watchdog device = %d.\n", 380 dev_err(dev->dev, "wd: unable to register watchdog device = %d.\n",
384 ret); 381 ret);
385 return ret; 382 return ret;
386 } 383 }
387 384
388 dev_dbg(&dev->pdev->dev, 385 dev_dbg(dev->dev, "wd: successfully register watchdog interface.\n");
389 "wd: successfully register watchdog interface.\n");
390 watchdog_set_drvdata(&amt_wd_dev, dev); 386 watchdog_set_drvdata(&amt_wd_dev, dev);
391 return 0; 387 return 0;
392} 388}