aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/amthif.c68
-rw-r--r--drivers/misc/mei/bus.c10
-rw-r--r--drivers/misc/mei/client.c46
-rw-r--r--drivers/misc/mei/client.h4
-rw-r--r--drivers/misc/mei/debugfs.c6
-rw-r--r--drivers/misc/mei/hbm.c66
-rw-r--r--drivers/misc/mei/hw-me.c30
-rw-r--r--drivers/misc/mei/hw-txe.c53
-rw-r--r--drivers/misc/mei/init.c42
-rw-r--r--drivers/misc/mei/interrupt.c44
-rw-r--r--drivers/misc/mei/main.c40
-rw-r--r--drivers/misc/mei/nfc.c43
-rw-r--r--drivers/misc/mei/pci-me.c2
-rw-r--r--drivers/misc/mei/pci-txe.c2
-rw-r--r--drivers/misc/mei/wd.c34
15 files changed, 239 insertions, 251 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index 1f80873c8fe9..5d47d1b36ccf 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -78,7 +78,7 @@ int mei_amthif_host_init(struct mei_device *dev)
78 78
79 me_cl = mei_me_cl_by_uuid(dev, &mei_amthif_guid); 79 me_cl = mei_me_cl_by_uuid(dev, &mei_amthif_guid);
80 if (!me_cl) { 80 if (!me_cl) {
81 dev_info(&dev->pdev->dev, "amthif: failed to find the client"); 81 dev_info(dev->dev, "amthif: failed to find the client");
82 return -ENOTTY; 82 return -ENOTTY;
83 } 83 }
84 84
@@ -88,7 +88,7 @@ int mei_amthif_host_init(struct mei_device *dev)
88 /* Assign iamthif_mtu to the value received from ME */ 88 /* Assign iamthif_mtu to the value received from ME */
89 89
90 dev->iamthif_mtu = me_cl->props.max_msg_length; 90 dev->iamthif_mtu = me_cl->props.max_msg_length;
91 dev_dbg(&dev->pdev->dev, "IAMTHIF_MTU = %d\n", dev->iamthif_mtu); 91 dev_dbg(dev->dev, "IAMTHIF_MTU = %d\n", dev->iamthif_mtu);
92 92
93 kfree(dev->iamthif_msg_buf); 93 kfree(dev->iamthif_msg_buf);
94 dev->iamthif_msg_buf = NULL; 94 dev->iamthif_msg_buf = NULL;
@@ -104,7 +104,7 @@ int mei_amthif_host_init(struct mei_device *dev)
104 ret = mei_cl_link(cl, MEI_IAMTHIF_HOST_CLIENT_ID); 104 ret = mei_cl_link(cl, MEI_IAMTHIF_HOST_CLIENT_ID);
105 105
106 if (ret < 0) { 106 if (ret < 0) {
107 dev_err(&dev->pdev->dev, 107 dev_err(dev->dev,
108 "amthif: failed link client %d\n", ret); 108 "amthif: failed link client %d\n", ret);
109 return ret; 109 return ret;
110 } 110 }
@@ -164,11 +164,11 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
164 164
165 /* Only possible if we are in timeout */ 165 /* Only possible if we are in timeout */
166 if (!cl) { 166 if (!cl) {
167 dev_err(&dev->pdev->dev, "bad file ext.\n"); 167 dev_err(dev->dev, "bad file ext.\n");
168 return -ETIME; 168 return -ETIME;
169 } 169 }
170 170
171 dev_dbg(&dev->pdev->dev, "checking amthif data\n"); 171 dev_dbg(dev->dev, "checking amthif data\n");
172 cb = mei_amthif_find_read_list_entry(dev, file); 172 cb = mei_amthif_find_read_list_entry(dev, file);
173 173
174 /* Check for if we can block or not*/ 174 /* Check for if we can block or not*/
@@ -176,7 +176,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
176 return -EAGAIN; 176 return -EAGAIN;
177 177
178 178
179 dev_dbg(&dev->pdev->dev, "waiting for amthif data\n"); 179 dev_dbg(dev->dev, "waiting for amthif data\n");
180 while (cb == NULL) { 180 while (cb == NULL) {
181 /* unlock the Mutex */ 181 /* unlock the Mutex */
182 mutex_unlock(&dev->device_lock); 182 mutex_unlock(&dev->device_lock);
@@ -190,21 +190,21 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
190 if (wait_ret) 190 if (wait_ret)
191 return -ERESTARTSYS; 191 return -ERESTARTSYS;
192 192
193 dev_dbg(&dev->pdev->dev, "woke up from sleep\n"); 193 dev_dbg(dev->dev, "woke up from sleep\n");
194 } 194 }
195 195
196 196
197 dev_dbg(&dev->pdev->dev, "Got amthif data\n"); 197 dev_dbg(dev->dev, "Got amthif data\n");
198 dev->iamthif_timer = 0; 198 dev->iamthif_timer = 0;
199 199
200 if (cb) { 200 if (cb) {
201 timeout = cb->read_time + 201 timeout = cb->read_time +
202 mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER); 202 mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER);
203 dev_dbg(&dev->pdev->dev, "amthif timeout = %lud\n", 203 dev_dbg(dev->dev, "amthif timeout = %lud\n",
204 timeout); 204 timeout);
205 205
206 if (time_after(jiffies, timeout)) { 206 if (time_after(jiffies, timeout)) {
207 dev_dbg(&dev->pdev->dev, "amthif Time out\n"); 207 dev_dbg(dev->dev, "amthif Time out\n");
208 /* 15 sec for the message has expired */ 208 /* 15 sec for the message has expired */
209 list_del(&cb->list); 209 list_del(&cb->list);
210 rets = -ETIME; 210 rets = -ETIME;
@@ -224,16 +224,16 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
224 * remove message from deletion list 224 * remove message from deletion list
225 */ 225 */
226 226
227 dev_dbg(&dev->pdev->dev, "amthif cb->response_buffer size - %d\n", 227 dev_dbg(dev->dev, "amthif cb->response_buffer size - %d\n",
228 cb->response_buffer.size); 228 cb->response_buffer.size);
229 dev_dbg(&dev->pdev->dev, "amthif cb->buf_idx - %lu\n", cb->buf_idx); 229 dev_dbg(dev->dev, "amthif cb->buf_idx - %lu\n", cb->buf_idx);
230 230
231 /* length is being truncated to PAGE_SIZE, however, 231 /* length is being truncated to PAGE_SIZE, however,
232 * the buf_idx may point beyond */ 232 * the buf_idx may point beyond */
233 length = min_t(size_t, length, (cb->buf_idx - *offset)); 233 length = min_t(size_t, length, (cb->buf_idx - *offset));
234 234
235 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) { 235 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) {
236 dev_dbg(&dev->pdev->dev, "failed to copy data to userland\n"); 236 dev_dbg(dev->dev, "failed to copy data to userland\n");
237 rets = -EFAULT; 237 rets = -EFAULT;
238 } else { 238 } else {
239 rets = length; 239 rets = length;
@@ -243,7 +243,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
243 } 243 }
244 } 244 }
245free: 245free:
246 dev_dbg(&dev->pdev->dev, "free amthif cb memory.\n"); 246 dev_dbg(dev->dev, "free amthif cb memory.\n");
247 *offset = 0; 247 *offset = 0;
248 mei_io_cb_free(cb); 248 mei_io_cb_free(cb);
249out: 249out:
@@ -267,7 +267,7 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
267 if (!dev || !cb) 267 if (!dev || !cb)
268 return -ENODEV; 268 return -ENODEV;
269 269
270 dev_dbg(&dev->pdev->dev, "write data to amthif client.\n"); 270 dev_dbg(dev->dev, "write data to amthif client.\n");
271 271
272 dev->iamthif_state = MEI_IAMTHIF_WRITING; 272 dev->iamthif_state = MEI_IAMTHIF_WRITING;
273 dev->iamthif_current_cb = cb; 273 dev->iamthif_current_cb = cb;
@@ -306,12 +306,12 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
306 return -EIO; 306 return -EIO;
307 dev->iamthif_flow_control_pending = true; 307 dev->iamthif_flow_control_pending = true;
308 dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; 308 dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
309 dev_dbg(&dev->pdev->dev, "add amthif cb to write waiting list\n"); 309 dev_dbg(dev->dev, "add amthif cb to write waiting list\n");
310 dev->iamthif_current_cb = cb; 310 dev->iamthif_current_cb = cb;
311 dev->iamthif_file_object = cb->file_object; 311 dev->iamthif_file_object = cb->file_object;
312 list_add_tail(&cb->list, &dev->write_waiting_list.list); 312 list_add_tail(&cb->list, &dev->write_waiting_list.list);
313 } else { 313 } else {
314 dev_dbg(&dev->pdev->dev, "message does not complete, so add amthif cb to write list.\n"); 314 dev_dbg(dev->dev, "message does not complete, so add amthif cb to write list.\n");
315 list_add_tail(&cb->list, &dev->write_list.list); 315 list_add_tail(&cb->list, &dev->write_list.list);
316 } 316 }
317 } else { 317 } else {
@@ -344,9 +344,9 @@ int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb)
344 344
345 if (!list_empty(&dev->amthif_cmd_list.list) || 345 if (!list_empty(&dev->amthif_cmd_list.list) ||
346 dev->iamthif_state != MEI_IAMTHIF_IDLE) { 346 dev->iamthif_state != MEI_IAMTHIF_IDLE) {
347 dev_dbg(&dev->pdev->dev, 347 dev_dbg(dev->dev,
348 "amthif state = %d\n", dev->iamthif_state); 348 "amthif state = %d\n", dev->iamthif_state);
349 dev_dbg(&dev->pdev->dev, "AMTHIF: add cb to the wait list\n"); 349 dev_dbg(dev->dev, "AMTHIF: add cb to the wait list\n");
350 list_add_tail(&cb->list, &dev->amthif_cmd_list.list); 350 list_add_tail(&cb->list, &dev->amthif_cmd_list.list);
351 return 0; 351 return 0;
352 } 352 }
@@ -376,7 +376,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev)
376 dev->iamthif_timer = 0; 376 dev->iamthif_timer = 0;
377 dev->iamthif_file_object = NULL; 377 dev->iamthif_file_object = NULL;
378 378
379 dev_dbg(&dev->pdev->dev, "complete amthif cmd_list cb.\n"); 379 dev_dbg(dev->dev, "complete amthif cmd_list cb.\n");
380 380
381 list_for_each_entry_safe(cb, next, &dev->amthif_cmd_list.list, list) { 381 list_for_each_entry_safe(cb, next, &dev->amthif_cmd_list.list, list) {
382 list_del(&cb->list); 382 list_del(&cb->list);
@@ -384,7 +384,7 @@ void mei_amthif_run_next_cmd(struct mei_device *dev)
384 continue; 384 continue;
385 status = mei_amthif_send_cmd(dev, cb); 385 status = mei_amthif_send_cmd(dev, cb);
386 if (status) 386 if (status)
387 dev_warn(&dev->pdev->dev, "amthif write failed status = %d\n", 387 dev_warn(dev->dev, "amthif write failed status = %d\n",
388 status); 388 status);
389 break; 389 break;
390 } 390 }
@@ -407,7 +407,7 @@ unsigned int mei_amthif_poll(struct mei_device *dev,
407 dev->iamthif_file_object == file) { 407 dev->iamthif_file_object == file) {
408 408
409 mask |= (POLLIN | POLLRDNORM); 409 mask |= (POLLIN | POLLRDNORM);
410 dev_dbg(&dev->pdev->dev, "run next amthif cb\n"); 410 dev_dbg(dev->dev, "run next amthif cb\n");
411 mei_amthif_run_next_cmd(dev); 411 mei_amthif_run_next_cmd(dev);
412 } 412 }
413 mutex_unlock(&dev->device_lock); 413 mutex_unlock(&dev->device_lock);
@@ -467,7 +467,7 @@ int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
467 return 0; 467 return 0;
468 } 468 }
469 469
470 dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr)); 470 dev_dbg(dev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr));
471 471
472 rets = mei_write_message(dev, &mei_hdr, 472 rets = mei_write_message(dev, &mei_hdr,
473 dev->iamthif_msg_buf + dev->iamthif_msg_buf_index); 473 dev->iamthif_msg_buf + dev->iamthif_msg_buf_index);
@@ -529,10 +529,10 @@ int mei_amthif_irq_read_msg(struct mei_device *dev,
529 if (!mei_hdr->msg_complete) 529 if (!mei_hdr->msg_complete)
530 return 0; 530 return 0;
531 531
532 dev_dbg(&dev->pdev->dev, "amthif_message_buffer_index =%d\n", 532 dev_dbg(dev->dev, "amthif_message_buffer_index =%d\n",
533 mei_hdr->length); 533 mei_hdr->length);
534 534
535 dev_dbg(&dev->pdev->dev, "completed amthif read.\n "); 535 dev_dbg(dev->dev, "completed amthif read.\n ");
536 if (!dev->iamthif_current_cb) 536 if (!dev->iamthif_current_cb)
537 return -ENODEV; 537 return -ENODEV;
538 538
@@ -547,8 +547,8 @@ int mei_amthif_irq_read_msg(struct mei_device *dev,
547 cb->read_time = jiffies; 547 cb->read_time = jiffies;
548 if (dev->iamthif_ioctl) { 548 if (dev->iamthif_ioctl) {
549 /* found the iamthif cb */ 549 /* found the iamthif cb */
550 dev_dbg(&dev->pdev->dev, "complete the amthif read cb.\n "); 550 dev_dbg(dev->dev, "complete the amthif read cb.\n ");
551 dev_dbg(&dev->pdev->dev, "add the amthif read cb to complete.\n "); 551 dev_dbg(dev->dev, "add the amthif read cb to complete.\n ");
552 list_add_tail(&cb->list, &complete_list->list); 552 list_add_tail(&cb->list, &complete_list->list);
553 } 553 }
554 return 0; 554 return 0;
@@ -572,11 +572,11 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots)
572 *slots -= msg_slots; 572 *slots -= msg_slots;
573 573
574 if (mei_hbm_cl_flow_control_req(dev, &dev->iamthif_cl)) { 574 if (mei_hbm_cl_flow_control_req(dev, &dev->iamthif_cl)) {
575 dev_dbg(&dev->pdev->dev, "iamthif flow control failed\n"); 575 dev_dbg(dev->dev, "iamthif flow control failed\n");
576 return -EIO; 576 return -EIO;
577 } 577 }
578 578
579 dev_dbg(&dev->pdev->dev, "iamthif flow control success\n"); 579 dev_dbg(dev->dev, "iamthif flow control success\n");
580 dev->iamthif_state = MEI_IAMTHIF_READING; 580 dev->iamthif_state = MEI_IAMTHIF_READING;
581 dev->iamthif_flow_control_pending = false; 581 dev->iamthif_flow_control_pending = false;
582 dev->iamthif_msg_buf_index = 0; 582 dev->iamthif_msg_buf_index = 0;
@@ -601,15 +601,15 @@ void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb)
601 dev->iamthif_msg_buf, 601 dev->iamthif_msg_buf,
602 dev->iamthif_msg_buf_index); 602 dev->iamthif_msg_buf_index);
603 list_add_tail(&cb->list, &dev->amthif_rd_complete_list.list); 603 list_add_tail(&cb->list, &dev->amthif_rd_complete_list.list);
604 dev_dbg(&dev->pdev->dev, "amthif read completed\n"); 604 dev_dbg(dev->dev, "amthif read completed\n");
605 dev->iamthif_timer = jiffies; 605 dev->iamthif_timer = jiffies;
606 dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n", 606 dev_dbg(dev->dev, "dev->iamthif_timer = %ld\n",
607 dev->iamthif_timer); 607 dev->iamthif_timer);
608 } else { 608 } else {
609 mei_amthif_run_next_cmd(dev); 609 mei_amthif_run_next_cmd(dev);
610 } 610 }
611 611
612 dev_dbg(&dev->pdev->dev, "completing amthif call back.\n"); 612 dev_dbg(dev->dev, "completing amthif call back.\n");
613 wake_up_interruptible(&dev->iamthif_cl.wait); 613 wake_up_interruptible(&dev->iamthif_cl.wait);
614} 614}
615 615
@@ -715,11 +715,11 @@ int mei_amthif_release(struct mei_device *dev, struct file *file)
715 if (dev->iamthif_file_object == file && 715 if (dev->iamthif_file_object == file &&
716 dev->iamthif_state != MEI_IAMTHIF_IDLE) { 716 dev->iamthif_state != MEI_IAMTHIF_IDLE) {
717 717
718 dev_dbg(&dev->pdev->dev, "amthif canceled iamthif state %d\n", 718 dev_dbg(dev->dev, "amthif canceled iamthif state %d\n",
719 dev->iamthif_state); 719 dev->iamthif_state);
720 dev->iamthif_canceled = true; 720 dev->iamthif_canceled = true;
721 if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) { 721 if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) {
722 dev_dbg(&dev->pdev->dev, "run next amthif iamthif cb\n"); 722 dev_dbg(dev->dev, "run next amthif iamthif cb\n");
723 mei_amthif_run_next_cmd(dev); 723 mei_amthif_run_next_cmd(dev);
724 } 724 }
725 } 725 }
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 1cf3a72f2954..4cc1a66187be 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -172,7 +172,7 @@ struct mei_cl_device *mei_cl_add_device(struct mei_device *dev,
172 device->cl = cl; 172 device->cl = cl;
173 device->ops = ops; 173 device->ops = ops;
174 174
175 device->dev.parent = &dev->pdev->dev; 175 device->dev.parent = dev->dev;
176 device->dev.bus = &mei_cl_bus_type; 176 device->dev.bus = &mei_cl_bus_type;
177 device->dev.type = &mei_cl_device_type; 177 device->dev.type = &mei_cl_device_type;
178 178
@@ -180,7 +180,7 @@ struct mei_cl_device *mei_cl_add_device(struct mei_device *dev,
180 180
181 status = device_register(&device->dev); 181 status = device_register(&device->dev);
182 if (status) { 182 if (status) {
183 dev_err(&dev->pdev->dev, "Failed to register MEI device\n"); 183 dev_err(dev->dev, "Failed to register MEI device\n");
184 kfree(device); 184 kfree(device);
185 return NULL; 185 return NULL;
186 } 186 }
@@ -430,7 +430,7 @@ int mei_cl_enable_device(struct mei_cl_device *device)
430 err = mei_cl_connect(cl, NULL); 430 err = mei_cl_connect(cl, NULL);
431 if (err < 0) { 431 if (err < 0) {
432 mutex_unlock(&dev->device_lock); 432 mutex_unlock(&dev->device_lock);
433 dev_err(&dev->pdev->dev, "Could not connect to the ME client"); 433 dev_err(dev->dev, "Could not connect to the ME client");
434 434
435 return err; 435 return err;
436 } 436 }
@@ -462,7 +462,7 @@ int mei_cl_disable_device(struct mei_cl_device *device)
462 462
463 if (cl->state != MEI_FILE_CONNECTED) { 463 if (cl->state != MEI_FILE_CONNECTED) {
464 mutex_unlock(&dev->device_lock); 464 mutex_unlock(&dev->device_lock);
465 dev_err(&dev->pdev->dev, "Already disconnected"); 465 dev_err(dev->dev, "Already disconnected");
466 466
467 return 0; 467 return 0;
468 } 468 }
@@ -472,7 +472,7 @@ int mei_cl_disable_device(struct mei_cl_device *device)
472 err = mei_cl_disconnect(cl); 472 err = mei_cl_disconnect(cl);
473 if (err < 0) { 473 if (err < 0) {
474 mutex_unlock(&dev->device_lock); 474 mutex_unlock(&dev->device_lock);
475 dev_err(&dev->pdev->dev, 475 dev_err(dev->dev,
476 "Could not disconnect from the ME client"); 476 "Could not disconnect from the ME client");
477 477
478 return err; 478 return err;
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index b7f21d47a375..bfc3ad24db9c 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -363,13 +363,13 @@ int mei_cl_link(struct mei_cl *cl, int id)
363 MEI_CLIENTS_MAX); 363 MEI_CLIENTS_MAX);
364 364
365 if (id >= MEI_CLIENTS_MAX) { 365 if (id >= MEI_CLIENTS_MAX) {
366 dev_err(&dev->pdev->dev, "id exceeded %d", MEI_CLIENTS_MAX); 366 dev_err(dev->dev, "id exceeded %d", MEI_CLIENTS_MAX);
367 return -EMFILE; 367 return -EMFILE;
368 } 368 }
369 369
370 open_handle_count = dev->open_handle_count + dev->iamthif_open_count; 370 open_handle_count = dev->open_handle_count + dev->iamthif_open_count;
371 if (open_handle_count >= MEI_MAX_OPEN_HANDLE_COUNT) { 371 if (open_handle_count >= MEI_MAX_OPEN_HANDLE_COUNT) {
372 dev_err(&dev->pdev->dev, "open_handle_count exceeded %d", 372 dev_err(dev->dev, "open_handle_count exceeded %d",
373 MEI_MAX_OPEN_HANDLE_COUNT); 373 MEI_MAX_OPEN_HANDLE_COUNT);
374 return -EMFILE; 374 return -EMFILE;
375 } 375 }
@@ -449,9 +449,9 @@ void mei_host_client_init(struct work_struct *work)
449 449
450 mutex_unlock(&dev->device_lock); 450 mutex_unlock(&dev->device_lock);
451 451
452 pm_runtime_mark_last_busy(&dev->pdev->dev); 452 pm_runtime_mark_last_busy(dev->dev);
453 dev_dbg(&dev->pdev->dev, "rpm: autosuspend\n"); 453 dev_dbg(dev->dev, "rpm: autosuspend\n");
454 pm_runtime_autosuspend(&dev->pdev->dev); 454 pm_runtime_autosuspend(dev->dev);
455} 455}
456 456
457/** 457/**
@@ -464,12 +464,12 @@ bool mei_hbuf_acquire(struct mei_device *dev)
464{ 464{
465 if (mei_pg_state(dev) == MEI_PG_ON || 465 if (mei_pg_state(dev) == MEI_PG_ON ||
466 dev->pg_event == MEI_PG_EVENT_WAIT) { 466 dev->pg_event == MEI_PG_EVENT_WAIT) {
467 dev_dbg(&dev->pdev->dev, "device is in pg\n"); 467 dev_dbg(dev->dev, "device is in pg\n");
468 return false; 468 return false;
469 } 469 }
470 470
471 if (!dev->hbuf_is_ready) { 471 if (!dev->hbuf_is_ready) {
472 dev_dbg(&dev->pdev->dev, "hbuf is not ready\n"); 472 dev_dbg(dev->dev, "hbuf is not ready\n");
473 return false; 473 return false;
474 } 474 }
475 475
@@ -503,9 +503,9 @@ int mei_cl_disconnect(struct mei_cl *cl)
503 if (cl->state != MEI_FILE_DISCONNECTING) 503 if (cl->state != MEI_FILE_DISCONNECTING)
504 return 0; 504 return 0;
505 505
506 rets = pm_runtime_get(&dev->pdev->dev); 506 rets = pm_runtime_get(dev->dev);
507 if (rets < 0 && rets != -EINPROGRESS) { 507 if (rets < 0 && rets != -EINPROGRESS) {
508 pm_runtime_put_noidle(&dev->pdev->dev); 508 pm_runtime_put_noidle(dev->dev);
509 cl_err(dev, cl, "rpm: get failed %d\n", rets); 509 cl_err(dev, cl, "rpm: get failed %d\n", rets);
510 return rets; 510 return rets;
511 } 511 }
@@ -552,8 +552,8 @@ int mei_cl_disconnect(struct mei_cl *cl)
552 mei_io_list_flush(&dev->ctrl_wr_list, cl); 552 mei_io_list_flush(&dev->ctrl_wr_list, cl);
553free: 553free:
554 cl_dbg(dev, cl, "rpm: autosuspend\n"); 554 cl_dbg(dev, cl, "rpm: autosuspend\n");
555 pm_runtime_mark_last_busy(&dev->pdev->dev); 555 pm_runtime_mark_last_busy(dev->dev);
556 pm_runtime_put_autosuspend(&dev->pdev->dev); 556 pm_runtime_put_autosuspend(dev->dev);
557 557
558 mei_io_cb_free(cb); 558 mei_io_cb_free(cb);
559 return rets; 559 return rets;
@@ -609,9 +609,9 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file)
609 609
610 dev = cl->dev; 610 dev = cl->dev;
611 611
612 rets = pm_runtime_get(&dev->pdev->dev); 612 rets = pm_runtime_get(dev->dev);
613 if (rets < 0 && rets != -EINPROGRESS) { 613 if (rets < 0 && rets != -EINPROGRESS) {
614 pm_runtime_put_noidle(&dev->pdev->dev); 614 pm_runtime_put_noidle(dev->dev);
615 cl_err(dev, cl, "rpm: get failed %d\n", rets); 615 cl_err(dev, cl, "rpm: get failed %d\n", rets);
616 return rets; 616 return rets;
617 } 617 }
@@ -659,8 +659,8 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file)
659 659
660out: 660out:
661 cl_dbg(dev, cl, "rpm: autosuspend\n"); 661 cl_dbg(dev, cl, "rpm: autosuspend\n");
662 pm_runtime_mark_last_busy(&dev->pdev->dev); 662 pm_runtime_mark_last_busy(dev->dev);
663 pm_runtime_put_autosuspend(&dev->pdev->dev); 663 pm_runtime_put_autosuspend(dev->dev);
664 664
665 mei_io_cb_free(cb); 665 mei_io_cb_free(cb);
666 return rets; 666 return rets;
@@ -772,9 +772,9 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length)
772 return -ENOTTY; 772 return -ENOTTY;
773 } 773 }
774 774
775 rets = pm_runtime_get(&dev->pdev->dev); 775 rets = pm_runtime_get(dev->dev);
776 if (rets < 0 && rets != -EINPROGRESS) { 776 if (rets < 0 && rets != -EINPROGRESS) {
777 pm_runtime_put_noidle(&dev->pdev->dev); 777 pm_runtime_put_noidle(dev->dev);
778 cl_err(dev, cl, "rpm: get failed %d\n", rets); 778 cl_err(dev, cl, "rpm: get failed %d\n", rets);
779 return rets; 779 return rets;
780 } 780 }
@@ -806,8 +806,8 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length)
806 806
807out: 807out:
808 cl_dbg(dev, cl, "rpm: autosuspend\n"); 808 cl_dbg(dev, cl, "rpm: autosuspend\n");
809 pm_runtime_mark_last_busy(&dev->pdev->dev); 809 pm_runtime_mark_last_busy(dev->dev);
810 pm_runtime_put_autosuspend(&dev->pdev->dev); 810 pm_runtime_put_autosuspend(dev->dev);
811 811
812 if (rets) 812 if (rets)
813 mei_io_cb_free(cb); 813 mei_io_cb_free(cb);
@@ -928,9 +928,9 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
928 928
929 cl_dbg(dev, cl, "mei_cl_write %d\n", buf->size); 929 cl_dbg(dev, cl, "mei_cl_write %d\n", buf->size);
930 930
931 rets = pm_runtime_get(&dev->pdev->dev); 931 rets = pm_runtime_get(dev->dev);
932 if (rets < 0 && rets != -EINPROGRESS) { 932 if (rets < 0 && rets != -EINPROGRESS) {
933 pm_runtime_put_noidle(&dev->pdev->dev); 933 pm_runtime_put_noidle(dev->dev);
934 cl_err(dev, cl, "rpm: get failed %d\n", rets); 934 cl_err(dev, cl, "rpm: get failed %d\n", rets);
935 return rets; 935 return rets;
936 } 936 }
@@ -1005,8 +1005,8 @@ out:
1005 rets = buf->size; 1005 rets = buf->size;
1006err: 1006err:
1007 cl_dbg(dev, cl, "rpm: autosuspend\n"); 1007 cl_dbg(dev, cl, "rpm: autosuspend\n");
1008 pm_runtime_mark_last_busy(&dev->pdev->dev); 1008 pm_runtime_mark_last_busy(dev->dev);
1009 pm_runtime_put_autosuspend(&dev->pdev->dev); 1009 pm_runtime_put_autosuspend(dev->dev);
1010 1010
1011 return rets; 1011 return rets;
1012} 1012}
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h
index f5d03d622923..d9d0c1525259 100644
--- a/drivers/misc/mei/client.h
+++ b/drivers/misc/mei/client.h
@@ -110,9 +110,9 @@ void mei_cl_all_write_clear(struct mei_device *dev);
110#define MEI_CL_PRM(cl) (cl)->host_client_id, (cl)->me_client_id 110#define MEI_CL_PRM(cl) (cl)->host_client_id, (cl)->me_client_id
111 111
112#define cl_dbg(dev, cl, format, arg...) \ 112#define cl_dbg(dev, cl, format, arg...) \
113 dev_dbg(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg) 113 dev_dbg((dev)->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
114 114
115#define cl_err(dev, cl, format, arg...) \ 115#define cl_err(dev, cl, format, arg...) \
116 dev_err(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg) 116 dev_err((dev)->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
117 117
118#endif /* _MEI_CLIENT_H_ */ 118#endif /* _MEI_CLIENT_H_ */
diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c
index f15139d73f8f..e14a7db9a669 100644
--- a/drivers/misc/mei/debugfs.c
+++ b/drivers/misc/mei/debugfs.c
@@ -187,19 +187,19 @@ int mei_dbgfs_register(struct mei_device *dev, const char *name)
187 f = debugfs_create_file("meclients", S_IRUSR, dir, 187 f = debugfs_create_file("meclients", S_IRUSR, dir,
188 dev, &mei_dbgfs_fops_meclients); 188 dev, &mei_dbgfs_fops_meclients);
189 if (!f) { 189 if (!f) {
190 dev_err(&dev->pdev->dev, "meclients: registration failed\n"); 190 dev_err(dev->dev, "meclients: registration failed\n");
191 goto err; 191 goto err;
192 } 192 }
193 f = debugfs_create_file("active", S_IRUSR, dir, 193 f = debugfs_create_file("active", S_IRUSR, dir,
194 dev, &mei_dbgfs_fops_active); 194 dev, &mei_dbgfs_fops_active);
195 if (!f) { 195 if (!f) {
196 dev_err(&dev->pdev->dev, "meclients: registration failed\n"); 196 dev_err(dev->dev, "meclients: registration failed\n");
197 goto err; 197 goto err;
198 } 198 }
199 f = debugfs_create_file("devstate", S_IRUSR, dir, 199 f = debugfs_create_file("devstate", S_IRUSR, dir,
200 dev, &mei_dbgfs_fops_devstate); 200 dev, &mei_dbgfs_fops_devstate);
201 if (!f) { 201 if (!f) {
202 dev_err(&dev->pdev->dev, "devstate: registration failed\n"); 202 dev_err(dev->dev, "devstate: registration failed\n");
203 goto err; 203 goto err;
204 } 204 }
205 dev->dbgfs_dir = dir; 205 dev->dbgfs_dir = dir;
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index 271c24086729..209650bccf57 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -248,7 +248,7 @@ int mei_hbm_start_wait(struct mei_device *dev)
248 248
249 if (ret == 0 && (dev->hbm_state <= MEI_HBM_STARTING)) { 249 if (ret == 0 && (dev->hbm_state <= MEI_HBM_STARTING)) {
250 dev->hbm_state = MEI_HBM_IDLE; 250 dev->hbm_state = MEI_HBM_IDLE;
251 dev_err(&dev->pdev->dev, "waiting for mei start failed\n"); 251 dev_err(dev->dev, "waiting for mei start failed\n");
252 return -ETIME; 252 return -ETIME;
253 } 253 }
254 return 0; 254 return 0;
@@ -282,7 +282,7 @@ int mei_hbm_start_req(struct mei_device *dev)
282 dev->hbm_state = MEI_HBM_IDLE; 282 dev->hbm_state = MEI_HBM_IDLE;
283 ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data); 283 ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
284 if (ret) { 284 if (ret) {
285 dev_err(&dev->pdev->dev, "version message write failed: ret = %d\n", 285 dev_err(dev->dev, "version message write failed: ret = %d\n",
286 ret); 286 ret);
287 return ret; 287 return ret;
288 } 288 }
@@ -315,7 +315,7 @@ static int mei_hbm_enum_clients_req(struct mei_device *dev)
315 315
316 ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data); 316 ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
317 if (ret) { 317 if (ret) {
318 dev_err(&dev->pdev->dev, "enumeration request write failed: ret = %d.\n", 318 dev_err(dev->dev, "enumeration request write failed: ret = %d.\n",
319 ret); 319 ret);
320 return ret; 320 return ret;
321 } 321 }
@@ -388,7 +388,7 @@ static int mei_hbm_prop_req(struct mei_device *dev)
388 388
389 ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data); 389 ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
390 if (ret) { 390 if (ret) {
391 dev_err(&dev->pdev->dev, "properties request write failed: ret = %d\n", 391 dev_err(dev->dev, "properties request write failed: ret = %d\n",
392 ret); 392 ret);
393 return ret; 393 return ret;
394 } 394 }
@@ -426,7 +426,7 @@ int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd)
426 426
427 ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data); 427 ret = mei_write_message(dev, mei_hdr, dev->wr_msg.data);
428 if (ret) 428 if (ret)
429 dev_err(&dev->pdev->dev, "power gate command write failed.\n"); 429 dev_err(dev->dev, "power gate command write failed.\n");
430 return ret; 430 return ret;
431} 431}
432EXPORT_SYMBOL_GPL(mei_hbm_pg); 432EXPORT_SYMBOL_GPL(mei_hbm_pg);
@@ -486,7 +486,7 @@ static int mei_hbm_add_single_flow_creds(struct mei_device *dev,
486 486
487 me_cl = mei_me_cl_by_id(dev, flow->me_addr); 487 me_cl = mei_me_cl_by_id(dev, flow->me_addr);
488 if (!me_cl) { 488 if (!me_cl) {
489 dev_err(&dev->pdev->dev, "no such me client %d\n", 489 dev_err(dev->dev, "no such me client %d\n",
490 flow->me_addr); 490 flow->me_addr);
491 return -ENOENT; 491 return -ENOENT;
492 } 492 }
@@ -495,7 +495,7 @@ static int mei_hbm_add_single_flow_creds(struct mei_device *dev,
495 return -EINVAL; 495 return -EINVAL;
496 496
497 me_cl->mei_flow_ctrl_creds++; 497 me_cl->mei_flow_ctrl_creds++;
498 dev_dbg(&dev->pdev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n", 498 dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n",
499 flow->me_addr, me_cl->mei_flow_ctrl_creds); 499 flow->me_addr, me_cl->mei_flow_ctrl_creds);
500 500
501 return 0; 501 return 0;
@@ -570,7 +570,7 @@ static void mei_hbm_cl_disconnect_res(struct mei_cl *cl,
570 struct hbm_client_connect_response *rs = 570 struct hbm_client_connect_response *rs =
571 (struct hbm_client_connect_response *)cmd; 571 (struct hbm_client_connect_response *)cmd;
572 572
573 dev_dbg(&cl->dev->pdev->dev, "hbm: disconnect response cl:host=%02d me=%02d status=%d\n", 573 dev_dbg(cl->dev->dev, "hbm: disconnect response cl:host=%02d me=%02d status=%d\n",
574 rs->me_addr, rs->host_addr, rs->status); 574 rs->me_addr, rs->host_addr, rs->status);
575 575
576 if (rs->status == MEI_CL_DISCONN_SUCCESS) 576 if (rs->status == MEI_CL_DISCONN_SUCCESS)
@@ -606,7 +606,7 @@ static void mei_hbm_cl_connect_res(struct mei_cl *cl,
606 struct hbm_client_connect_response *rs = 606 struct hbm_client_connect_response *rs =
607 (struct hbm_client_connect_response *)cmd; 607 (struct hbm_client_connect_response *)cmd;
608 608
609 dev_dbg(&cl->dev->pdev->dev, "hbm: connect response cl:host=%02d me=%02d status=%s\n", 609 dev_dbg(cl->dev->dev, "hbm: connect response cl:host=%02d me=%02d status=%s\n",
610 rs->me_addr, rs->host_addr, 610 rs->me_addr, rs->host_addr,
611 mei_cl_conn_status_str(rs->status)); 611 mei_cl_conn_status_str(rs->status));
612 612
@@ -763,19 +763,19 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
763 * hbm is put to idle during system reset 763 * hbm is put to idle during system reset
764 */ 764 */
765 if (dev->hbm_state == MEI_HBM_IDLE) { 765 if (dev->hbm_state == MEI_HBM_IDLE) {
766 dev_dbg(&dev->pdev->dev, "hbm: state is idle ignore spurious messages\n"); 766 dev_dbg(dev->dev, "hbm: state is idle ignore spurious messages\n");
767 return 0; 767 return 0;
768 } 768 }
769 769
770 switch (mei_msg->hbm_cmd) { 770 switch (mei_msg->hbm_cmd) {
771 case HOST_START_RES_CMD: 771 case HOST_START_RES_CMD:
772 dev_dbg(&dev->pdev->dev, "hbm: start: response message received.\n"); 772 dev_dbg(dev->dev, "hbm: start: response message received.\n");
773 773
774 dev->init_clients_timer = 0; 774 dev->init_clients_timer = 0;
775 775
776 version_res = (struct hbm_host_version_response *)mei_msg; 776 version_res = (struct hbm_host_version_response *)mei_msg;
777 777
778 dev_dbg(&dev->pdev->dev, "HBM VERSION: DRIVER=%02d:%02d DEVICE=%02d:%02d\n", 778 dev_dbg(dev->dev, "HBM VERSION: DRIVER=%02d:%02d DEVICE=%02d:%02d\n",
779 HBM_MAJOR_VERSION, HBM_MINOR_VERSION, 779 HBM_MAJOR_VERSION, HBM_MINOR_VERSION,
780 version_res->me_max_version.major_version, 780 version_res->me_max_version.major_version,
781 version_res->me_max_version.minor_version); 781 version_res->me_max_version.minor_version);
@@ -791,11 +791,11 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
791 } 791 }
792 792
793 if (!mei_hbm_version_is_supported(dev)) { 793 if (!mei_hbm_version_is_supported(dev)) {
794 dev_warn(&dev->pdev->dev, "hbm: start: version mismatch - stopping the driver.\n"); 794 dev_warn(dev->dev, "hbm: start: version mismatch - stopping the driver.\n");
795 795
796 dev->hbm_state = MEI_HBM_STOPPED; 796 dev->hbm_state = MEI_HBM_STOPPED;
797 if (mei_hbm_stop_req(dev)) { 797 if (mei_hbm_stop_req(dev)) {
798 dev_err(&dev->pdev->dev, "hbm: start: failed to send stop request\n"); 798 dev_err(dev->dev, "hbm: start: failed to send stop request\n");
799 return -EIO; 799 return -EIO;
800 } 800 }
801 break; 801 break;
@@ -805,7 +805,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
805 805
806 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || 806 if (dev->dev_state != MEI_DEV_INIT_CLIENTS ||
807 dev->hbm_state != MEI_HBM_STARTING) { 807 dev->hbm_state != MEI_HBM_STARTING) {
808 dev_err(&dev->pdev->dev, "hbm: start: state mismatch, [%d, %d]\n", 808 dev_err(dev->dev, "hbm: start: state mismatch, [%d, %d]\n",
809 dev->dev_state, dev->hbm_state); 809 dev->dev_state, dev->hbm_state);
810 return -EPROTO; 810 return -EPROTO;
811 } 811 }
@@ -813,7 +813,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
813 dev->hbm_state = MEI_HBM_STARTED; 813 dev->hbm_state = MEI_HBM_STARTED;
814 814
815 if (mei_hbm_enum_clients_req(dev)) { 815 if (mei_hbm_enum_clients_req(dev)) {
816 dev_err(&dev->pdev->dev, "hbm: start: failed to send enumeration request\n"); 816 dev_err(dev->dev, "hbm: start: failed to send enumeration request\n");
817 return -EIO; 817 return -EIO;
818 } 818 }
819 819
@@ -821,31 +821,31 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
821 break; 821 break;
822 822
823 case CLIENT_CONNECT_RES_CMD: 823 case CLIENT_CONNECT_RES_CMD:
824 dev_dbg(&dev->pdev->dev, "hbm: client connect response: message received.\n"); 824 dev_dbg(dev->dev, "hbm: client connect response: message received.\n");
825 mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_CONNECT); 825 mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_CONNECT);
826 break; 826 break;
827 827
828 case CLIENT_DISCONNECT_RES_CMD: 828 case CLIENT_DISCONNECT_RES_CMD:
829 dev_dbg(&dev->pdev->dev, "hbm: client disconnect response: message received.\n"); 829 dev_dbg(dev->dev, "hbm: client disconnect response: message received.\n");
830 mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_DISCONNECT); 830 mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_DISCONNECT);
831 break; 831 break;
832 832
833 case MEI_FLOW_CONTROL_CMD: 833 case MEI_FLOW_CONTROL_CMD:
834 dev_dbg(&dev->pdev->dev, "hbm: client flow control response: message received.\n"); 834 dev_dbg(dev->dev, "hbm: client flow control response: message received.\n");
835 835
836 flow_control = (struct hbm_flow_control *) mei_msg; 836 flow_control = (struct hbm_flow_control *) mei_msg;
837 mei_hbm_cl_flow_control_res(dev, flow_control); 837 mei_hbm_cl_flow_control_res(dev, flow_control);
838 break; 838 break;
839 839
840 case MEI_PG_ISOLATION_ENTRY_RES_CMD: 840 case MEI_PG_ISOLATION_ENTRY_RES_CMD:
841 dev_dbg(&dev->pdev->dev, "power gate isolation entry response received\n"); 841 dev_dbg(dev->dev, "power gate isolation entry response received\n");
842 dev->pg_event = MEI_PG_EVENT_RECEIVED; 842 dev->pg_event = MEI_PG_EVENT_RECEIVED;
843 if (waitqueue_active(&dev->wait_pg)) 843 if (waitqueue_active(&dev->wait_pg))
844 wake_up(&dev->wait_pg); 844 wake_up(&dev->wait_pg);
845 break; 845 break;
846 846
847 case MEI_PG_ISOLATION_EXIT_REQ_CMD: 847 case MEI_PG_ISOLATION_EXIT_REQ_CMD:
848 dev_dbg(&dev->pdev->dev, "power gate isolation exit request received\n"); 848 dev_dbg(dev->dev, "power gate isolation exit request received\n");
849 dev->pg_event = MEI_PG_EVENT_RECEIVED; 849 dev->pg_event = MEI_PG_EVENT_RECEIVED;
850 if (waitqueue_active(&dev->wait_pg)) 850 if (waitqueue_active(&dev->wait_pg))
851 wake_up(&dev->wait_pg); 851 wake_up(&dev->wait_pg);
@@ -855,17 +855,17 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
855 * this is HW initiated exit from PG. 855 * this is HW initiated exit from PG.
856 * Start runtime pm resume sequence to exit from PG. 856 * Start runtime pm resume sequence to exit from PG.
857 */ 857 */
858 pm_request_resume(&dev->pdev->dev); 858 pm_request_resume(dev->dev);
859 break; 859 break;
860 860
861 case HOST_CLIENT_PROPERTIES_RES_CMD: 861 case HOST_CLIENT_PROPERTIES_RES_CMD:
862 dev_dbg(&dev->pdev->dev, "hbm: properties response: message received.\n"); 862 dev_dbg(dev->dev, "hbm: properties response: message received.\n");
863 863
864 dev->init_clients_timer = 0; 864 dev->init_clients_timer = 0;
865 865
866 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || 866 if (dev->dev_state != MEI_DEV_INIT_CLIENTS ||
867 dev->hbm_state != MEI_HBM_CLIENT_PROPERTIES) { 867 dev->hbm_state != MEI_HBM_CLIENT_PROPERTIES) {
868 dev_err(&dev->pdev->dev, "hbm: properties response: state mismatch, [%d, %d]\n", 868 dev_err(dev->dev, "hbm: properties response: state mismatch, [%d, %d]\n",
869 dev->dev_state, dev->hbm_state); 869 dev->dev_state, dev->hbm_state);
870 return -EPROTO; 870 return -EPROTO;
871 } 871 }
@@ -873,7 +873,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
873 props_res = (struct hbm_props_response *)mei_msg; 873 props_res = (struct hbm_props_response *)mei_msg;
874 874
875 if (props_res->status) { 875 if (props_res->status) {
876 dev_err(&dev->pdev->dev, "hbm: properties response: wrong status = %d %s\n", 876 dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n",
877 props_res->status, 877 props_res->status,
878 mei_hbm_status_str(props_res->status)); 878 mei_hbm_status_str(props_res->status));
879 return -EPROTO; 879 return -EPROTO;
@@ -891,7 +891,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
891 break; 891 break;
892 892
893 case HOST_ENUM_RES_CMD: 893 case HOST_ENUM_RES_CMD:
894 dev_dbg(&dev->pdev->dev, "hbm: enumeration response: message received\n"); 894 dev_dbg(dev->dev, "hbm: enumeration response: message received\n");
895 895
896 dev->init_clients_timer = 0; 896 dev->init_clients_timer = 0;
897 897
@@ -903,7 +903,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
903 903
904 if (dev->dev_state != MEI_DEV_INIT_CLIENTS || 904 if (dev->dev_state != MEI_DEV_INIT_CLIENTS ||
905 dev->hbm_state != MEI_HBM_ENUM_CLIENTS) { 905 dev->hbm_state != MEI_HBM_ENUM_CLIENTS) {
906 dev_err(&dev->pdev->dev, "hbm: enumeration response: state mismatch, [%d, %d]\n", 906 dev_err(dev->dev, "hbm: enumeration response: state mismatch, [%d, %d]\n",
907 dev->dev_state, dev->hbm_state); 907 dev->dev_state, dev->hbm_state);
908 return -EPROTO; 908 return -EPROTO;
909 } 909 }
@@ -917,34 +917,34 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
917 break; 917 break;
918 918
919 case HOST_STOP_RES_CMD: 919 case HOST_STOP_RES_CMD:
920 dev_dbg(&dev->pdev->dev, "hbm: stop response: message received\n"); 920 dev_dbg(dev->dev, "hbm: stop response: message received\n");
921 921
922 dev->init_clients_timer = 0; 922 dev->init_clients_timer = 0;
923 923
924 if (dev->hbm_state != MEI_HBM_STOPPED) { 924 if (dev->hbm_state != MEI_HBM_STOPPED) {
925 dev_err(&dev->pdev->dev, "hbm: stop response: state mismatch, [%d, %d]\n", 925 dev_err(dev->dev, "hbm: stop response: state mismatch, [%d, %d]\n",
926 dev->dev_state, dev->hbm_state); 926 dev->dev_state, dev->hbm_state);
927 return -EPROTO; 927 return -EPROTO;
928 } 928 }
929 929
930 dev->dev_state = MEI_DEV_POWER_DOWN; 930 dev->dev_state = MEI_DEV_POWER_DOWN;
931 dev_info(&dev->pdev->dev, "hbm: stop response: resetting.\n"); 931 dev_info(dev->dev, "hbm: stop response: resetting.\n");
932 /* force the reset */ 932 /* force the reset */
933 return -EPROTO; 933 return -EPROTO;
934 break; 934 break;
935 935
936 case CLIENT_DISCONNECT_REQ_CMD: 936 case CLIENT_DISCONNECT_REQ_CMD:
937 dev_dbg(&dev->pdev->dev, "hbm: disconnect request: message received\n"); 937 dev_dbg(dev->dev, "hbm: disconnect request: message received\n");
938 938
939 disconnect_req = (struct hbm_client_connect_request *)mei_msg; 939 disconnect_req = (struct hbm_client_connect_request *)mei_msg;
940 mei_hbm_fw_disconnect_req(dev, disconnect_req); 940 mei_hbm_fw_disconnect_req(dev, disconnect_req);
941 break; 941 break;
942 942
943 case ME_STOP_REQ_CMD: 943 case ME_STOP_REQ_CMD:
944 dev_dbg(&dev->pdev->dev, "hbm: stop request: message received\n"); 944 dev_dbg(dev->dev, "hbm: stop request: message received\n");
945 dev->hbm_state = MEI_HBM_STOPPED; 945 dev->hbm_state = MEI_HBM_STOPPED;
946 if (mei_hbm_stop_req(dev)) { 946 if (mei_hbm_stop_req(dev)) {
947 dev_err(&dev->pdev->dev, "hbm: stop request: failed to send stop request\n"); 947 dev_err(dev->dev, "hbm: stop request: failed to send stop request\n");
948 return -EIO; 948 return -EIO;
949 } 949 }
950 break; 950 break;
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index df42b6f6e7ca..1247be706216 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -217,10 +217,10 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
217 hcsr = mei_hcsr_read(hw); 217 hcsr = mei_hcsr_read(hw);
218 218
219 if ((hcsr & H_RST) == 0) 219 if ((hcsr & H_RST) == 0)
220 dev_warn(&dev->pdev->dev, "H_RST is not set = 0x%08X", hcsr); 220 dev_warn(dev->dev, "H_RST is not set = 0x%08X", hcsr);
221 221
222 if ((hcsr & H_RDY) == H_RDY) 222 if ((hcsr & H_RDY) == H_RDY)
223 dev_warn(&dev->pdev->dev, "H_RDY is not cleared 0x%08X", hcsr); 223 dev_warn(dev->dev, "H_RDY is not cleared 0x%08X", hcsr);
224 224
225 if (intr_enable == false) 225 if (intr_enable == false)
226 mei_me_hw_reset_release(dev); 226 mei_me_hw_reset_release(dev);
@@ -279,7 +279,7 @@ static int mei_me_hw_ready_wait(struct mei_device *dev)
279 mei_secs_to_jiffies(MEI_HW_READY_TIMEOUT)); 279 mei_secs_to_jiffies(MEI_HW_READY_TIMEOUT));
280 mutex_lock(&dev->device_lock); 280 mutex_lock(&dev->device_lock);
281 if (!dev->recvd_hw_ready) { 281 if (!dev->recvd_hw_ready) {
282 dev_err(&dev->pdev->dev, "wait hw ready failed\n"); 282 dev_err(dev->dev, "wait hw ready failed\n");
283 return -ETIME; 283 return -ETIME;
284 } 284 }
285 285
@@ -293,7 +293,7 @@ static int mei_me_hw_start(struct mei_device *dev)
293 293
294 if (ret) 294 if (ret)
295 return ret; 295 return ret;
296 dev_dbg(&dev->pdev->dev, "hw is ready\n"); 296 dev_dbg(dev->dev, "hw is ready\n");
297 297
298 mei_me_host_set_ready(dev); 298 mei_me_host_set_ready(dev);
299 return ret; 299 return ret;
@@ -381,10 +381,10 @@ static int mei_me_write_message(struct mei_device *dev,
381 int i; 381 int i;
382 int empty_slots; 382 int empty_slots;
383 383
384 dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(header)); 384 dev_dbg(dev->dev, MEI_HDR_FMT, MEI_HDR_PRM(header));
385 385
386 empty_slots = mei_hbuf_empty_slots(dev); 386 empty_slots = mei_hbuf_empty_slots(dev);
387 dev_dbg(&dev->pdev->dev, "empty slots = %hu.\n", empty_slots); 387 dev_dbg(dev->dev, "empty slots = %hu.\n", empty_slots);
388 388
389 dw_cnt = mei_data2slots(length); 389 dw_cnt = mei_data2slots(length);
390 if (empty_slots < 0 || dw_cnt > empty_slots) 390 if (empty_slots < 0 || dw_cnt > empty_slots)
@@ -434,7 +434,7 @@ static int mei_me_count_full_read_slots(struct mei_device *dev)
434 if (filled_slots > buffer_depth) 434 if (filled_slots > buffer_depth)
435 return -EOVERFLOW; 435 return -EOVERFLOW;
436 436
437 dev_dbg(&dev->pdev->dev, "filled_slots =%08x\n", filled_slots); 437 dev_dbg(dev->dev, "filled_slots =%08x\n", filled_slots);
438 return (int)filled_slots; 438 return (int)filled_slots;
439} 439}
440 440
@@ -591,7 +591,7 @@ static bool mei_me_pg_is_enabled(struct mei_device *dev)
591 return true; 591 return true;
592 592
593notsupported: 593notsupported:
594 dev_dbg(&dev->pdev->dev, "pg: not supported: HGP = %d hbm version %d.%d ?= %d.%d\n", 594 dev_dbg(dev->dev, "pg: not supported: HGP = %d hbm version %d.%d ?= %d.%d\n",
595 !!(reg & ME_PGIC_HRA), 595 !!(reg & ME_PGIC_HRA),
596 dev->version.major_version, 596 dev->version.major_version,
597 dev->version.minor_version, 597 dev->version.minor_version,
@@ -642,7 +642,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
642 s32 slots; 642 s32 slots;
643 int rets = 0; 643 int rets = 0;
644 644
645 dev_dbg(&dev->pdev->dev, "function called after ISR to handle the interrupt processing.\n"); 645 dev_dbg(dev->dev, "function called after ISR to handle the interrupt processing.\n");
646 /* initialize our complete list */ 646 /* initialize our complete list */
647 mutex_lock(&dev->device_lock); 647 mutex_lock(&dev->device_lock);
648 mei_io_list_init(&complete_list); 648 mei_io_list_init(&complete_list);
@@ -654,7 +654,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
654 654
655 /* check if ME wants a reset */ 655 /* check if ME wants a reset */
656 if (!mei_hw_is_ready(dev) && dev->dev_state != MEI_DEV_RESETTING) { 656 if (!mei_hw_is_ready(dev) && dev->dev_state != MEI_DEV_RESETTING) {
657 dev_warn(&dev->pdev->dev, "FW not ready: resetting.\n"); 657 dev_warn(dev->dev, "FW not ready: resetting.\n");
658 schedule_work(&dev->reset_work); 658 schedule_work(&dev->reset_work);
659 goto end; 659 goto end;
660 } 660 }
@@ -663,19 +663,19 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
663 if (!mei_host_is_ready(dev)) { 663 if (!mei_host_is_ready(dev)) {
664 if (mei_hw_is_ready(dev)) { 664 if (mei_hw_is_ready(dev)) {
665 mei_me_hw_reset_release(dev); 665 mei_me_hw_reset_release(dev);
666 dev_dbg(&dev->pdev->dev, "we need to start the dev.\n"); 666 dev_dbg(dev->dev, "we need to start the dev.\n");
667 667
668 dev->recvd_hw_ready = true; 668 dev->recvd_hw_ready = true;
669 wake_up(&dev->wait_hw_ready); 669 wake_up(&dev->wait_hw_ready);
670 } else { 670 } else {
671 dev_dbg(&dev->pdev->dev, "Spurious Interrupt\n"); 671 dev_dbg(dev->dev, "Spurious Interrupt\n");
672 } 672 }
673 goto end; 673 goto end;
674 } 674 }
675 /* check slots available for reading */ 675 /* check slots available for reading */
676 slots = mei_count_full_read_slots(dev); 676 slots = mei_count_full_read_slots(dev);
677 while (slots > 0) { 677 while (slots > 0) {
678 dev_dbg(&dev->pdev->dev, "slots to read = %08x\n", slots); 678 dev_dbg(dev->dev, "slots to read = %08x\n", slots);
679 rets = mei_irq_read_handler(dev, &complete_list, &slots); 679 rets = mei_irq_read_handler(dev, &complete_list, &slots);
680 /* There is a race between ME write and interrupt delivery: 680 /* There is a race between ME write and interrupt delivery:
681 * Not all data is always available immediately after the 681 * Not all data is always available immediately after the
@@ -685,7 +685,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
685 break; 685 break;
686 686
687 if (rets && dev->dev_state != MEI_DEV_RESETTING) { 687 if (rets && dev->dev_state != MEI_DEV_RESETTING) {
688 dev_err(&dev->pdev->dev, "mei_irq_read_handler ret = %d.\n", 688 dev_err(dev->dev, "mei_irq_read_handler ret = %d.\n",
689 rets); 689 rets);
690 schedule_work(&dev->reset_work); 690 schedule_work(&dev->reset_work);
691 goto end; 691 goto end;
@@ -707,7 +707,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
707 mei_irq_compl_handler(dev, &complete_list); 707 mei_irq_compl_handler(dev, &complete_list);
708 708
709end: 709end:
710 dev_dbg(&dev->pdev->dev, "interrupt thread end ret = %d\n", rets); 710 dev_dbg(dev->dev, "interrupt thread end ret = %d\n", rets);
711 mutex_unlock(&dev->device_lock); 711 mutex_unlock(&dev->device_lock);
712 return IRQ_HANDLED; 712 return IRQ_HANDLED;
713} 713}
diff --git a/drivers/misc/mei/hw-txe.c b/drivers/misc/mei/hw-txe.c
index fc1a51f818d0..acc475eec150 100644
--- a/drivers/misc/mei/hw-txe.c
+++ b/drivers/misc/mei/hw-txe.c
@@ -155,7 +155,7 @@ static bool mei_txe_aliveness_set(struct mei_device *dev, u32 req)
155 struct mei_txe_hw *hw = to_txe_hw(dev); 155 struct mei_txe_hw *hw = to_txe_hw(dev);
156 bool do_req = hw->aliveness != req; 156 bool do_req = hw->aliveness != req;
157 157
158 dev_dbg(&dev->pdev->dev, "Aliveness current=%d request=%d\n", 158 dev_dbg(dev->dev, "Aliveness current=%d request=%d\n",
159 hw->aliveness, req); 159 hw->aliveness, req);
160 if (do_req) { 160 if (do_req) {
161 dev->pg_event = MEI_PG_EVENT_WAIT; 161 dev->pg_event = MEI_PG_EVENT_WAIT;
@@ -216,7 +216,7 @@ static int mei_txe_aliveness_poll(struct mei_device *dev, u32 expected)
216 hw->aliveness = mei_txe_aliveness_get(dev); 216 hw->aliveness = mei_txe_aliveness_get(dev);
217 if (hw->aliveness == expected) { 217 if (hw->aliveness == expected) {
218 dev->pg_event = MEI_PG_EVENT_IDLE; 218 dev->pg_event = MEI_PG_EVENT_IDLE;
219 dev_dbg(&dev->pdev->dev, 219 dev_dbg(dev->dev,
220 "aliveness settled after %d msecs\n", t); 220 "aliveness settled after %d msecs\n", t);
221 return t; 221 return t;
222 } 222 }
@@ -227,7 +227,7 @@ static int mei_txe_aliveness_poll(struct mei_device *dev, u32 expected)
227 } while (t < SEC_ALIVENESS_WAIT_TIMEOUT); 227 } while (t < SEC_ALIVENESS_WAIT_TIMEOUT);
228 228
229 dev->pg_event = MEI_PG_EVENT_IDLE; 229 dev->pg_event = MEI_PG_EVENT_IDLE;
230 dev_err(&dev->pdev->dev, "aliveness timed out\n"); 230 dev_err(dev->dev, "aliveness timed out\n");
231 return -ETIME; 231 return -ETIME;
232} 232}
233 233
@@ -261,10 +261,10 @@ static int mei_txe_aliveness_wait(struct mei_device *dev, u32 expected)
261 ret = hw->aliveness == expected ? 0 : -ETIME; 261 ret = hw->aliveness == expected ? 0 : -ETIME;
262 262
263 if (ret) 263 if (ret)
264 dev_warn(&dev->pdev->dev, "aliveness timed out = %ld aliveness = %d event = %d\n", 264 dev_warn(dev->dev, "aliveness timed out = %ld aliveness = %d event = %d\n",
265 err, hw->aliveness, dev->pg_event); 265 err, hw->aliveness, dev->pg_event);
266 else 266 else
267 dev_dbg(&dev->pdev->dev, "aliveness settled after = %d msec aliveness = %d event = %d\n", 267 dev_dbg(dev->dev, "aliveness settled after = %d msec aliveness = %d event = %d\n",
268 jiffies_to_msecs(timeout - err), 268 jiffies_to_msecs(timeout - err),
269 hw->aliveness, dev->pg_event); 269 hw->aliveness, dev->pg_event);
270 270
@@ -425,7 +425,7 @@ static bool mei_txe_pending_interrupts(struct mei_device *dev)
425 TXE_INTR_OUT_DB)); 425 TXE_INTR_OUT_DB));
426 426
427 if (ret) { 427 if (ret) {
428 dev_dbg(&dev->pdev->dev, 428 dev_dbg(dev->dev,
429 "Pending Interrupts InReady=%01d Readiness=%01d, Aliveness=%01d, OutDoor=%01d\n", 429 "Pending Interrupts InReady=%01d Readiness=%01d, Aliveness=%01d, OutDoor=%01d\n",
430 !!(hw->intr_cause & TXE_INTR_IN_READY), 430 !!(hw->intr_cause & TXE_INTR_IN_READY),
431 !!(hw->intr_cause & TXE_INTR_READINESS), 431 !!(hw->intr_cause & TXE_INTR_READINESS),
@@ -565,7 +565,7 @@ static int mei_txe_readiness_wait(struct mei_device *dev)
565 msecs_to_jiffies(SEC_RESET_WAIT_TIMEOUT)); 565 msecs_to_jiffies(SEC_RESET_WAIT_TIMEOUT));
566 mutex_lock(&dev->device_lock); 566 mutex_lock(&dev->device_lock);
567 if (!dev->recvd_hw_ready) { 567 if (!dev->recvd_hw_ready) {
568 dev_err(&dev->pdev->dev, "wait for readiness failed\n"); 568 dev_err(dev->dev, "wait for readiness failed\n");
569 return -ETIME; 569 return -ETIME;
570 } 570 }
571 571
@@ -592,7 +592,7 @@ static void mei_txe_hw_config(struct mei_device *dev)
592 hw->aliveness = mei_txe_aliveness_get(dev); 592 hw->aliveness = mei_txe_aliveness_get(dev);
593 hw->readiness = mei_txe_readiness_get(dev); 593 hw->readiness = mei_txe_readiness_get(dev);
594 594
595 dev_dbg(&dev->pdev->dev, "aliveness_resp = 0x%08x, readiness = 0x%08x.\n", 595 dev_dbg(dev->dev, "aliveness_resp = 0x%08x, readiness = 0x%08x.\n",
596 hw->aliveness, hw->readiness); 596 hw->aliveness, hw->readiness);
597} 597}
598 598
@@ -622,7 +622,7 @@ static int mei_txe_write(struct mei_device *dev,
622 622
623 length = header->length; 623 length = header->length;
624 624
625 dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(header)); 625 dev_dbg(dev->dev, MEI_HDR_FMT, MEI_HDR_PRM(header));
626 626
627 dw_cnt = mei_data2slots(length); 627 dw_cnt = mei_data2slots(length);
628 if (dw_cnt > slots) 628 if (dw_cnt > slots)
@@ -638,7 +638,7 @@ static int mei_txe_write(struct mei_device *dev,
638 struct mei_fw_status fw_status; 638 struct mei_fw_status fw_status;
639 639
640 mei_fw_status(dev, &fw_status); 640 mei_fw_status(dev, &fw_status);
641 dev_err(&dev->pdev->dev, "Input is not ready " FW_STS_FMT "\n", 641 dev_err(dev->dev, "Input is not ready " FW_STS_FMT "\n",
642 FW_STS_PRM(fw_status)); 642 FW_STS_PRM(fw_status));
643 return -EAGAIN; 643 return -EAGAIN;
644 } 644 }
@@ -740,14 +740,13 @@ static int mei_txe_read(struct mei_device *dev,
740 reg_buf = (u32 *)buf; 740 reg_buf = (u32 *)buf;
741 rem = len & 0x3; 741 rem = len & 0x3;
742 742
743 dev_dbg(&dev->pdev->dev, 743 dev_dbg(dev->dev, "buffer-length = %lu buf[0]0x%08X\n",
744 "buffer-length = %lu buf[0]0x%08X\n",
745 len, mei_txe_out_data_read(dev, 0)); 744 len, mei_txe_out_data_read(dev, 0));
746 745
747 for (i = 0; i < len / 4; i++) { 746 for (i = 0; i < len / 4; i++) {
748 /* skip header: index starts from 1 */ 747 /* skip header: index starts from 1 */
749 reg = mei_txe_out_data_read(dev, i + 1); 748 reg = mei_txe_out_data_read(dev, i + 1);
750 dev_dbg(&dev->pdev->dev, "buf[%d] = 0x%08X\n", i, reg); 749 dev_dbg(dev->dev, "buf[%d] = 0x%08X\n", i, reg);
751 *reg_buf++ = reg; 750 *reg_buf++ = reg;
752 } 751 }
753 752
@@ -792,8 +791,7 @@ static int mei_txe_hw_reset(struct mei_device *dev, bool intr_enable)
792 */ 791 */
793 if (aliveness_req != hw->aliveness) 792 if (aliveness_req != hw->aliveness)
794 if (mei_txe_aliveness_poll(dev, aliveness_req) < 0) { 793 if (mei_txe_aliveness_poll(dev, aliveness_req) < 0) {
795 dev_err(&dev->pdev->dev, 794 dev_err(dev->dev, "wait for aliveness settle failed ... bailing out\n");
796 "wait for aliveness settle failed ... bailing out\n");
797 return -EIO; 795 return -EIO;
798 } 796 }
799 797
@@ -803,8 +801,7 @@ static int mei_txe_hw_reset(struct mei_device *dev, bool intr_enable)
803 if (aliveness_req) { 801 if (aliveness_req) {
804 mei_txe_aliveness_set(dev, 0); 802 mei_txe_aliveness_set(dev, 0);
805 if (mei_txe_aliveness_poll(dev, 0) < 0) { 803 if (mei_txe_aliveness_poll(dev, 0) < 0) {
806 dev_err(&dev->pdev->dev, 804 dev_err(dev->dev, "wait for aliveness failed ... bailing out\n");
807 "wait for aliveness failed ... bailing out\n");
808 return -EIO; 805 return -EIO;
809 } 806 }
810 } 807 }
@@ -836,7 +833,7 @@ static int mei_txe_hw_start(struct mei_device *dev)
836 833
837 ret = mei_txe_readiness_wait(dev); 834 ret = mei_txe_readiness_wait(dev);
838 if (ret < 0) { 835 if (ret < 0) {
839 dev_err(&dev->pdev->dev, "wating for readiness failed\n"); 836 dev_err(dev->dev, "wating for readiness failed\n");
840 return ret; 837 return ret;
841 } 838 }
842 839
@@ -852,7 +849,7 @@ static int mei_txe_hw_start(struct mei_device *dev)
852 849
853 ret = mei_txe_aliveness_set_sync(dev, 1); 850 ret = mei_txe_aliveness_set_sync(dev, 1);
854 if (ret < 0) { 851 if (ret < 0) {
855 dev_err(&dev->pdev->dev, "wait for aliveness failed ... bailing out\n"); 852 dev_err(dev->dev, "wait for aliveness failed ... bailing out\n");
856 return ret; 853 return ret;
857 } 854 }
858 855
@@ -962,7 +959,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
962 s32 slots; 959 s32 slots;
963 int rets = 0; 960 int rets = 0;
964 961
965 dev_dbg(&dev->pdev->dev, "irq thread: Interrupt Registers HHISR|HISR|SEC=%02X|%04X|%02X\n", 962 dev_dbg(dev->dev, "irq thread: Interrupt Registers HHISR|HISR|SEC=%02X|%04X|%02X\n",
966 mei_txe_br_reg_read(hw, HHISR_REG), 963 mei_txe_br_reg_read(hw, HHISR_REG),
967 mei_txe_br_reg_read(hw, HISR_REG), 964 mei_txe_br_reg_read(hw, HISR_REG),
968 mei_txe_sec_reg_read_silent(hw, SEC_IPC_HOST_INT_STATUS_REG)); 965 mei_txe_sec_reg_read_silent(hw, SEC_IPC_HOST_INT_STATUS_REG));
@@ -986,17 +983,17 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
986 * or TXE driver resetting the HECI interface. 983 * or TXE driver resetting the HECI interface.
987 */ 984 */
988 if (test_and_clear_bit(TXE_INTR_READINESS_BIT, &hw->intr_cause)) { 985 if (test_and_clear_bit(TXE_INTR_READINESS_BIT, &hw->intr_cause)) {
989 dev_dbg(&dev->pdev->dev, "Readiness Interrupt was received...\n"); 986 dev_dbg(dev->dev, "Readiness Interrupt was received...\n");
990 987
991 /* Check if SeC is going through reset */ 988 /* Check if SeC is going through reset */
992 if (mei_txe_readiness_is_sec_rdy(hw->readiness)) { 989 if (mei_txe_readiness_is_sec_rdy(hw->readiness)) {
993 dev_dbg(&dev->pdev->dev, "we need to start the dev.\n"); 990 dev_dbg(dev->dev, "we need to start the dev.\n");
994 dev->recvd_hw_ready = true; 991 dev->recvd_hw_ready = true;
995 } else { 992 } else {
996 dev->recvd_hw_ready = false; 993 dev->recvd_hw_ready = false;
997 if (dev->dev_state != MEI_DEV_RESETTING) { 994 if (dev->dev_state != MEI_DEV_RESETTING) {
998 995
999 dev_warn(&dev->pdev->dev, "FW not ready: resetting.\n"); 996 dev_warn(dev->dev, "FW not ready: resetting.\n");
1000 schedule_work(&dev->reset_work); 997 schedule_work(&dev->reset_work);
1001 goto end; 998 goto end;
1002 999
@@ -1013,7 +1010,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
1013 1010
1014 if (test_and_clear_bit(TXE_INTR_ALIVENESS_BIT, &hw->intr_cause)) { 1011 if (test_and_clear_bit(TXE_INTR_ALIVENESS_BIT, &hw->intr_cause)) {
1015 /* Clear the interrupt cause */ 1012 /* Clear the interrupt cause */
1016 dev_dbg(&dev->pdev->dev, 1013 dev_dbg(dev->dev,
1017 "Aliveness Interrupt: Status: %d\n", hw->aliveness); 1014 "Aliveness Interrupt: Status: %d\n", hw->aliveness);
1018 dev->pg_event = MEI_PG_EVENT_RECEIVED; 1015 dev->pg_event = MEI_PG_EVENT_RECEIVED;
1019 if (waitqueue_active(&hw->wait_aliveness_resp)) 1016 if (waitqueue_active(&hw->wait_aliveness_resp))
@@ -1029,7 +1026,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
1029 /* Read from TXE */ 1026 /* Read from TXE */
1030 rets = mei_irq_read_handler(dev, &complete_list, &slots); 1027 rets = mei_irq_read_handler(dev, &complete_list, &slots);
1031 if (rets && dev->dev_state != MEI_DEV_RESETTING) { 1028 if (rets && dev->dev_state != MEI_DEV_RESETTING) {
1032 dev_err(&dev->pdev->dev, 1029 dev_err(dev->dev,
1033 "mei_irq_read_handler ret = %d.\n", rets); 1030 "mei_irq_read_handler ret = %d.\n", rets);
1034 1031
1035 schedule_work(&dev->reset_work); 1032 schedule_work(&dev->reset_work);
@@ -1047,7 +1044,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
1047 dev->hbuf_is_ready = mei_hbuf_is_ready(dev); 1044 dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
1048 rets = mei_irq_write_handler(dev, &complete_list); 1045 rets = mei_irq_write_handler(dev, &complete_list);
1049 if (rets && rets != -EMSGSIZE) 1046 if (rets && rets != -EMSGSIZE)
1050 dev_err(&dev->pdev->dev, "mei_irq_write_handler ret = %d.\n", 1047 dev_err(dev->dev, "mei_irq_write_handler ret = %d.\n",
1051 rets); 1048 rets);
1052 dev->hbuf_is_ready = mei_hbuf_is_ready(dev); 1049 dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
1053 } 1050 }
@@ -1055,7 +1052,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
1055 mei_irq_compl_handler(dev, &complete_list); 1052 mei_irq_compl_handler(dev, &complete_list);
1056 1053
1057end: 1054end:
1058 dev_dbg(&dev->pdev->dev, "interrupt thread end ret = %d\n", rets); 1055 dev_dbg(dev->dev, "interrupt thread end ret = %d\n", rets);
1059 1056
1060 mutex_unlock(&dev->device_lock); 1057 mutex_unlock(&dev->device_lock);
1061 1058
@@ -1171,7 +1168,7 @@ int mei_txe_setup_satt2(struct mei_device *dev, phys_addr_t addr, u32 range)
1171 mei_txe_br_reg_write(hw, SATT2_SAP_SIZE_REG, range); 1168 mei_txe_br_reg_write(hw, SATT2_SAP_SIZE_REG, range);
1172 mei_txe_br_reg_write(hw, SATT2_BRG_BA_LSB_REG, lo32); 1169 mei_txe_br_reg_write(hw, SATT2_BRG_BA_LSB_REG, lo32);
1173 mei_txe_br_reg_write(hw, SATT2_CTRL_REG, ctrl); 1170 mei_txe_br_reg_write(hw, SATT2_CTRL_REG, ctrl);
1174 dev_dbg(&dev->pdev->dev, "SATT2: SAP_SIZE_OFFSET=0x%08X, BRG_BA_LSB_OFFSET=0x%08X, CTRL_OFFSET=0x%08X\n", 1171 dev_dbg(dev->dev, "SATT2: SAP_SIZE_OFFSET=0x%08X, BRG_BA_LSB_OFFSET=0x%08X, CTRL_OFFSET=0x%08X\n",
1175 range, lo32, ctrl); 1172 range, lo32, ctrl);
1176 1173
1177 return 0; 1174 return 0;
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index ac659768e2b5..29aae7b7a304 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -90,7 +90,7 @@ int mei_reset(struct mei_device *dev)
90 struct mei_fw_status fw_status; 90 struct mei_fw_status fw_status;
91 91
92 mei_fw_status(dev, &fw_status); 92 mei_fw_status(dev, &fw_status);
93 dev_warn(&dev->pdev->dev, 93 dev_warn(dev->dev,
94 "unexpected reset: dev_state = %s " FW_STS_FMT "\n", 94 "unexpected reset: dev_state = %s " FW_STS_FMT "\n",
95 mei_dev_state_str(state), FW_STS_PRM(fw_status)); 95 mei_dev_state_str(state), FW_STS_PRM(fw_status));
96 } 96 }
@@ -108,7 +108,7 @@ int mei_reset(struct mei_device *dev)
108 108
109 dev->reset_count++; 109 dev->reset_count++;
110 if (dev->reset_count > MEI_MAX_CONSEC_RESET) { 110 if (dev->reset_count > MEI_MAX_CONSEC_RESET) {
111 dev_err(&dev->pdev->dev, "reset: reached maximal consecutive resets: disabling the device\n"); 111 dev_err(dev->dev, "reset: reached maximal consecutive resets: disabling the device\n");
112 dev->dev_state = MEI_DEV_DISABLED; 112 dev->dev_state = MEI_DEV_DISABLED;
113 return -ENODEV; 113 return -ENODEV;
114 } 114 }
@@ -129,7 +129,7 @@ int mei_reset(struct mei_device *dev)
129 mei_cl_all_wakeup(dev); 129 mei_cl_all_wakeup(dev);
130 130
131 /* remove entry if already in list */ 131 /* remove entry if already in list */
132 dev_dbg(&dev->pdev->dev, "remove iamthif and wd from the file list.\n"); 132 dev_dbg(dev->dev, "remove iamthif and wd from the file list.\n");
133 mei_cl_unlink(&dev->wd_cl); 133 mei_cl_unlink(&dev->wd_cl);
134 mei_cl_unlink(&dev->iamthif_cl); 134 mei_cl_unlink(&dev->iamthif_cl);
135 mei_amthif_reset_params(dev); 135 mei_amthif_reset_params(dev);
@@ -141,28 +141,28 @@ int mei_reset(struct mei_device *dev)
141 dev->wd_pending = false; 141 dev->wd_pending = false;
142 142
143 if (ret) { 143 if (ret) {
144 dev_err(&dev->pdev->dev, "hw_reset failed ret = %d\n", ret); 144 dev_err(dev->dev, "hw_reset failed ret = %d\n", ret);
145 return ret; 145 return ret;
146 } 146 }
147 147
148 if (state == MEI_DEV_POWER_DOWN) { 148 if (state == MEI_DEV_POWER_DOWN) {
149 dev_dbg(&dev->pdev->dev, "powering down: end of reset\n"); 149 dev_dbg(dev->dev, "powering down: end of reset\n");
150 dev->dev_state = MEI_DEV_DISABLED; 150 dev->dev_state = MEI_DEV_DISABLED;
151 return 0; 151 return 0;
152 } 152 }
153 153
154 ret = mei_hw_start(dev); 154 ret = mei_hw_start(dev);
155 if (ret) { 155 if (ret) {
156 dev_err(&dev->pdev->dev, "hw_start failed ret = %d\n", ret); 156 dev_err(dev->dev, "hw_start failed ret = %d\n", ret);
157 return ret; 157 return ret;
158 } 158 }
159 159
160 dev_dbg(&dev->pdev->dev, "link is established start sending messages.\n"); 160 dev_dbg(dev->dev, "link is established start sending messages.\n");
161 161
162 dev->dev_state = MEI_DEV_INIT_CLIENTS; 162 dev->dev_state = MEI_DEV_INIT_CLIENTS;
163 ret = mei_hbm_start_req(dev); 163 ret = mei_hbm_start_req(dev);
164 if (ret) { 164 if (ret) {
165 dev_err(&dev->pdev->dev, "hbm_start failed ret = %d\n", ret); 165 dev_err(dev->dev, "hbm_start failed ret = %d\n", ret);
166 dev->dev_state = MEI_DEV_RESETTING; 166 dev->dev_state = MEI_DEV_RESETTING;
167 return ret; 167 return ret;
168 } 168 }
@@ -189,7 +189,7 @@ int mei_start(struct mei_device *dev)
189 189
190 mei_hw_config(dev); 190 mei_hw_config(dev);
191 191
192 dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n"); 192 dev_dbg(dev->dev, "reset in start the mei device.\n");
193 193
194 dev->reset_count = 0; 194 dev->reset_count = 0;
195 do { 195 do {
@@ -197,43 +197,43 @@ int mei_start(struct mei_device *dev)
197 ret = mei_reset(dev); 197 ret = mei_reset(dev);
198 198
199 if (ret == -ENODEV || dev->dev_state == MEI_DEV_DISABLED) { 199 if (ret == -ENODEV || dev->dev_state == MEI_DEV_DISABLED) {
200 dev_err(&dev->pdev->dev, "reset failed ret = %d", ret); 200 dev_err(dev->dev, "reset failed ret = %d", ret);
201 goto err; 201 goto err;
202 } 202 }
203 } while (ret); 203 } while (ret);
204 204
205 /* we cannot start the device w/o hbm start message completed */ 205 /* we cannot start the device w/o hbm start message completed */
206 if (dev->dev_state == MEI_DEV_DISABLED) { 206 if (dev->dev_state == MEI_DEV_DISABLED) {
207 dev_err(&dev->pdev->dev, "reset failed"); 207 dev_err(dev->dev, "reset failed");
208 goto err; 208 goto err;
209 } 209 }
210 210
211 if (mei_hbm_start_wait(dev)) { 211 if (mei_hbm_start_wait(dev)) {
212 dev_err(&dev->pdev->dev, "HBM haven't started"); 212 dev_err(dev->dev, "HBM haven't started");
213 goto err; 213 goto err;
214 } 214 }
215 215
216 if (!mei_host_is_ready(dev)) { 216 if (!mei_host_is_ready(dev)) {
217 dev_err(&dev->pdev->dev, "host is not ready.\n"); 217 dev_err(dev->dev, "host is not ready.\n");
218 goto err; 218 goto err;
219 } 219 }
220 220
221 if (!mei_hw_is_ready(dev)) { 221 if (!mei_hw_is_ready(dev)) {
222 dev_err(&dev->pdev->dev, "ME is not ready.\n"); 222 dev_err(dev->dev, "ME is not ready.\n");
223 goto err; 223 goto err;
224 } 224 }
225 225
226 if (!mei_hbm_version_is_supported(dev)) { 226 if (!mei_hbm_version_is_supported(dev)) {
227 dev_dbg(&dev->pdev->dev, "MEI start failed.\n"); 227 dev_dbg(dev->dev, "MEI start failed.\n");
228 goto err; 228 goto err;
229 } 229 }
230 230
231 dev_dbg(&dev->pdev->dev, "link layer has been established.\n"); 231 dev_dbg(dev->dev, "link layer has been established.\n");
232 232
233 mutex_unlock(&dev->device_lock); 233 mutex_unlock(&dev->device_lock);
234 return 0; 234 return 0;
235err: 235err:
236 dev_err(&dev->pdev->dev, "link layer initialization failed.\n"); 236 dev_err(dev->dev, "link layer initialization failed.\n");
237 dev->dev_state = MEI_DEV_DISABLED; 237 dev->dev_state = MEI_DEV_DISABLED;
238 mutex_unlock(&dev->device_lock); 238 mutex_unlock(&dev->device_lock);
239 return -ENODEV; 239 return -ENODEV;
@@ -263,7 +263,7 @@ int mei_restart(struct mei_device *dev)
263 mutex_unlock(&dev->device_lock); 263 mutex_unlock(&dev->device_lock);
264 264
265 if (err == -ENODEV || dev->dev_state == MEI_DEV_DISABLED) { 265 if (err == -ENODEV || dev->dev_state == MEI_DEV_DISABLED) {
266 dev_err(&dev->pdev->dev, "device disabled = %d\n", err); 266 dev_err(dev->dev, "device disabled = %d\n", err);
267 return -ENODEV; 267 return -ENODEV;
268 } 268 }
269 269
@@ -289,7 +289,7 @@ static void mei_reset_work(struct work_struct *work)
289 mutex_unlock(&dev->device_lock); 289 mutex_unlock(&dev->device_lock);
290 290
291 if (dev->dev_state == MEI_DEV_DISABLED) { 291 if (dev->dev_state == MEI_DEV_DISABLED) {
292 dev_err(&dev->pdev->dev, "device disabled = %d\n", ret); 292 dev_err(dev->dev, "device disabled = %d\n", ret);
293 return; 293 return;
294 } 294 }
295 295
@@ -300,7 +300,7 @@ static void mei_reset_work(struct work_struct *work)
300 300
301void mei_stop(struct mei_device *dev) 301void mei_stop(struct mei_device *dev)
302{ 302{
303 dev_dbg(&dev->pdev->dev, "stopping the device.\n"); 303 dev_dbg(dev->dev, "stopping the device.\n");
304 304
305 mei_cancel_work(dev); 305 mei_cancel_work(dev);
306 306
@@ -334,7 +334,7 @@ bool mei_write_is_idle(struct mei_device *dev)
334 list_empty(&dev->ctrl_wr_list.list) && 334 list_empty(&dev->ctrl_wr_list.list) &&
335 list_empty(&dev->write_list.list)); 335 list_empty(&dev->write_list.list));
336 336
337 dev_dbg(&dev->pdev->dev, "write pg: is idle[%d] state=%s ctrl=%d write=%d\n", 337 dev_dbg(dev->dev, "write pg: is idle[%d] state=%s ctrl=%d write=%d\n",
338 idle, 338 idle,
339 mei_dev_state_str(dev->dev_state), 339 mei_dev_state_str(dev->dev_state),
340 list_empty(&dev->ctrl_wr_list.list), 340 list_empty(&dev->ctrl_wr_list.list),
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index b8d9cfee3e87..8dac76901130 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -47,7 +47,7 @@ void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *compl_list)
47 if (!cl) 47 if (!cl)
48 continue; 48 continue;
49 49
50 dev_dbg(&dev->pdev->dev, "completing call back.\n"); 50 dev_dbg(dev->dev, "completing call back.\n");
51 if (cl == &dev->iamthif_cl) 51 if (cl == &dev->iamthif_cl)
52 mei_amthif_complete(dev, cb); 52 mei_amthif_complete(dev, cb);
53 else 53 else
@@ -148,10 +148,10 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
148 break; 148 break;
149 } 149 }
150 150
151 dev_dbg(&dev->pdev->dev, "message read\n"); 151 dev_dbg(dev->dev, "message read\n");
152 if (!buffer) { 152 if (!buffer) {
153 mei_read_slots(dev, dev->rd_msg_buf, mei_hdr->length); 153 mei_read_slots(dev, dev->rd_msg_buf, mei_hdr->length);
154 dev_dbg(&dev->pdev->dev, "discarding message " MEI_HDR_FMT "\n", 154 dev_dbg(dev->dev, "discarding message " MEI_HDR_FMT "\n",
155 MEI_HDR_PRM(mei_hdr)); 155 MEI_HDR_PRM(mei_hdr));
156 } 156 }
157 157
@@ -333,20 +333,20 @@ int mei_irq_read_handler(struct mei_device *dev,
333 if (!dev->rd_msg_hdr) { 333 if (!dev->rd_msg_hdr) {
334 dev->rd_msg_hdr = mei_read_hdr(dev); 334 dev->rd_msg_hdr = mei_read_hdr(dev);
335 (*slots)--; 335 (*slots)--;
336 dev_dbg(&dev->pdev->dev, "slots =%08x.\n", *slots); 336 dev_dbg(dev->dev, "slots =%08x.\n", *slots);
337 } 337 }
338 mei_hdr = (struct mei_msg_hdr *) &dev->rd_msg_hdr; 338 mei_hdr = (struct mei_msg_hdr *) &dev->rd_msg_hdr;
339 dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(mei_hdr)); 339 dev_dbg(dev->dev, MEI_HDR_FMT, MEI_HDR_PRM(mei_hdr));
340 340
341 if (mei_hdr->reserved || !dev->rd_msg_hdr) { 341 if (mei_hdr->reserved || !dev->rd_msg_hdr) {
342 dev_err(&dev->pdev->dev, "corrupted message header 0x%08X\n", 342 dev_err(dev->dev, "corrupted message header 0x%08X\n",
343 dev->rd_msg_hdr); 343 dev->rd_msg_hdr);
344 ret = -EBADMSG; 344 ret = -EBADMSG;
345 goto end; 345 goto end;
346 } 346 }
347 347
348 if (mei_slots2data(*slots) < mei_hdr->length) { 348 if (mei_slots2data(*slots) < mei_hdr->length) {
349 dev_err(&dev->pdev->dev, "less data available than length=%08x.\n", 349 dev_err(dev->dev, "less data available than length=%08x.\n",
350 *slots); 350 *slots);
351 /* we can't read the message */ 351 /* we can't read the message */
352 ret = -ENODATA; 352 ret = -ENODATA;
@@ -357,7 +357,7 @@ int mei_irq_read_handler(struct mei_device *dev,
357 if (mei_hdr->host_addr == 0 && mei_hdr->me_addr == 0) { 357 if (mei_hdr->host_addr == 0 && mei_hdr->me_addr == 0) {
358 ret = mei_hbm_dispatch(dev, mei_hdr); 358 ret = mei_hbm_dispatch(dev, mei_hdr);
359 if (ret) { 359 if (ret) {
360 dev_dbg(&dev->pdev->dev, "mei_hbm_dispatch failed ret = %d\n", 360 dev_dbg(dev->dev, "mei_hbm_dispatch failed ret = %d\n",
361 ret); 361 ret);
362 goto end; 362 goto end;
363 } 363 }
@@ -374,7 +374,7 @@ int mei_irq_read_handler(struct mei_device *dev,
374 374
375 /* if no recipient cl was found we assume corrupted header */ 375 /* if no recipient cl was found we assume corrupted header */
376 if (&cl->link == &dev->file_list) { 376 if (&cl->link == &dev->file_list) {
377 dev_err(&dev->pdev->dev, "no destination client found 0x%08X\n", 377 dev_err(dev->dev, "no destination client found 0x%08X\n",
378 dev->rd_msg_hdr); 378 dev->rd_msg_hdr);
379 ret = -EBADMSG; 379 ret = -EBADMSG;
380 goto end; 380 goto end;
@@ -386,14 +386,14 @@ int mei_irq_read_handler(struct mei_device *dev,
386 386
387 ret = mei_amthif_irq_read_msg(dev, mei_hdr, cmpl_list); 387 ret = mei_amthif_irq_read_msg(dev, mei_hdr, cmpl_list);
388 if (ret) { 388 if (ret) {
389 dev_err(&dev->pdev->dev, "mei_amthif_irq_read_msg failed = %d\n", 389 dev_err(dev->dev, "mei_amthif_irq_read_msg failed = %d\n",
390 ret); 390 ret);
391 goto end; 391 goto end;
392 } 392 }
393 } else { 393 } else {
394 ret = mei_cl_irq_read_msg(dev, mei_hdr, cmpl_list); 394 ret = mei_cl_irq_read_msg(dev, mei_hdr, cmpl_list);
395 if (ret) { 395 if (ret) {
396 dev_err(&dev->pdev->dev, "mei_cl_irq_read_msg failed = %d\n", 396 dev_err(dev->dev, "mei_cl_irq_read_msg failed = %d\n",
397 ret); 397 ret);
398 goto end; 398 goto end;
399 } 399 }
@@ -406,7 +406,7 @@ reset_slots:
406 406
407 if (*slots == -EOVERFLOW) { 407 if (*slots == -EOVERFLOW) {
408 /* overflow - reset */ 408 /* overflow - reset */
409 dev_err(&dev->pdev->dev, "resetting due to slots overflow.\n"); 409 dev_err(dev->dev, "resetting due to slots overflow.\n");
410 /* set the event since message has been read */ 410 /* set the event since message has been read */
411 ret = -ERANGE; 411 ret = -ERANGE;
412 goto end; 412 goto end;
@@ -444,7 +444,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
444 return -EMSGSIZE; 444 return -EMSGSIZE;
445 445
446 /* complete all waiting for write CB */ 446 /* complete all waiting for write CB */
447 dev_dbg(&dev->pdev->dev, "complete all waiting for write cb.\n"); 447 dev_dbg(dev->dev, "complete all waiting for write cb.\n");
448 448
449 list = &dev->write_waiting_list; 449 list = &dev->write_waiting_list;
450 list_for_each_entry_safe(cb, next, &list->list, list) { 450 list_for_each_entry_safe(cb, next, &list->list, list) {
@@ -486,7 +486,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
486 } 486 }
487 487
488 /* complete control write list CB */ 488 /* complete control write list CB */
489 dev_dbg(&dev->pdev->dev, "complete control write list cb.\n"); 489 dev_dbg(dev->dev, "complete control write list cb.\n");
490 list_for_each_entry_safe(cb, next, &dev->ctrl_wr_list.list, list) { 490 list_for_each_entry_safe(cb, next, &dev->ctrl_wr_list.list, list) {
491 cl = cb->cl; 491 cl = cb->cl;
492 if (!cl) { 492 if (!cl) {
@@ -527,7 +527,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
527 527
528 } 528 }
529 /* complete write list CB */ 529 /* complete write list CB */
530 dev_dbg(&dev->pdev->dev, "complete write list cb.\n"); 530 dev_dbg(dev->dev, "complete write list cb.\n");
531 list_for_each_entry_safe(cb, next, &dev->write_list.list, list) { 531 list_for_each_entry_safe(cb, next, &dev->write_list.list, list) {
532 cl = cb->cl; 532 cl = cb->cl;
533 if (cl == NULL) 533 if (cl == NULL)
@@ -568,7 +568,7 @@ void mei_timer(struct work_struct *work)
568 568
569 if (dev->init_clients_timer) { 569 if (dev->init_clients_timer) {
570 if (--dev->init_clients_timer == 0) { 570 if (--dev->init_clients_timer == 0) {
571 dev_err(&dev->pdev->dev, "timer: init clients timeout hbm_state = %d.\n", 571 dev_err(dev->dev, "timer: init clients timeout hbm_state = %d.\n",
572 dev->hbm_state); 572 dev->hbm_state);
573 mei_reset(dev); 573 mei_reset(dev);
574 goto out; 574 goto out;
@@ -583,7 +583,7 @@ void mei_timer(struct work_struct *work)
583 list_for_each_entry(cl, &dev->file_list, link) { 583 list_for_each_entry(cl, &dev->file_list, link) {
584 if (cl->timer_count) { 584 if (cl->timer_count) {
585 if (--cl->timer_count == 0) { 585 if (--cl->timer_count == 0) {
586 dev_err(&dev->pdev->dev, "timer: connect/disconnect timeout.\n"); 586 dev_err(dev->dev, "timer: connect/disconnect timeout.\n");
587 mei_reset(dev); 587 mei_reset(dev);
588 goto out; 588 goto out;
589 } 589 }
@@ -595,7 +595,7 @@ void mei_timer(struct work_struct *work)
595 595
596 if (dev->iamthif_stall_timer) { 596 if (dev->iamthif_stall_timer) {
597 if (--dev->iamthif_stall_timer == 0) { 597 if (--dev->iamthif_stall_timer == 0) {
598 dev_err(&dev->pdev->dev, "timer: amthif hanged.\n"); 598 dev_err(dev->dev, "timer: amthif hanged.\n");
599 mei_reset(dev); 599 mei_reset(dev);
600 dev->iamthif_msg_buf_size = 0; 600 dev->iamthif_msg_buf_size = 0;
601 dev->iamthif_msg_buf_index = 0; 601 dev->iamthif_msg_buf_index = 0;
@@ -617,17 +617,17 @@ void mei_timer(struct work_struct *work)
617 timeout = dev->iamthif_timer + 617 timeout = dev->iamthif_timer +
618 mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER); 618 mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER);
619 619
620 dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n", 620 dev_dbg(dev->dev, "dev->iamthif_timer = %ld\n",
621 dev->iamthif_timer); 621 dev->iamthif_timer);
622 dev_dbg(&dev->pdev->dev, "timeout = %ld\n", timeout); 622 dev_dbg(dev->dev, "timeout = %ld\n", timeout);
623 dev_dbg(&dev->pdev->dev, "jiffies = %ld\n", jiffies); 623 dev_dbg(dev->dev, "jiffies = %ld\n", jiffies);
624 if (time_after(jiffies, timeout)) { 624 if (time_after(jiffies, timeout)) {
625 /* 625 /*
626 * User didn't read the AMTHI data on time (15sec) 626 * User didn't read the AMTHI data on time (15sec)
627 * freeing AMTHI for other requests 627 * freeing AMTHI for other requests
628 */ 628 */
629 629
630 dev_dbg(&dev->pdev->dev, "freeing AMTHI for other requests\n"); 630 dev_dbg(dev->dev, "freeing AMTHI for other requests\n");
631 631
632 mei_io_list_flush(&dev->amthif_rd_complete_list, 632 mei_io_list_flush(&dev->amthif_rd_complete_list,
633 &dev->iamthif_cl); 633 &dev->iamthif_cl);
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 244fb6bf7463..4d738c881878 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -63,7 +63,7 @@ static int mei_open(struct inode *inode, struct file *file)
63 63
64 err = -ENODEV; 64 err = -ENODEV;
65 if (dev->dev_state != MEI_DEV_ENABLED) { 65 if (dev->dev_state != MEI_DEV_ENABLED) {
66 dev_dbg(&dev->pdev->dev, "dev_state != MEI_ENABLED dev_state = %s\n", 66 dev_dbg(dev->dev, "dev_state != MEI_ENABLED dev_state = %s\n",
67 mei_dev_state_str(dev->dev_state)); 67 mei_dev_state_str(dev->dev_state));
68 goto err_unlock; 68 goto err_unlock;
69 } 69 }
@@ -211,7 +211,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
211 211
212 err = mei_cl_read_start(cl, length); 212 err = mei_cl_read_start(cl, length);
213 if (err && err != -EBUSY) { 213 if (err && err != -EBUSY) {
214 dev_dbg(&dev->pdev->dev, 214 dev_dbg(dev->dev,
215 "mei start read failure with status = %d\n", err); 215 "mei start read failure with status = %d\n", err);
216 rets = err; 216 rets = err;
217 goto out; 217 goto out;
@@ -254,7 +254,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
254 } 254 }
255 /* now copy the data to user space */ 255 /* now copy the data to user space */
256copy_buffer: 256copy_buffer:
257 dev_dbg(&dev->pdev->dev, "buf.size = %d buf.idx= %ld\n", 257 dev_dbg(dev->dev, "buf.size = %d buf.idx= %ld\n",
258 cb->response_buffer.size, cb->buf_idx); 258 cb->response_buffer.size, cb->buf_idx);
259 if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) { 259 if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) {
260 rets = -EMSGSIZE; 260 rets = -EMSGSIZE;
@@ -266,7 +266,7 @@ copy_buffer:
266 length = min_t(size_t, length, cb->buf_idx - *offset); 266 length = min_t(size_t, length, cb->buf_idx - *offset);
267 267
268 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) { 268 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) {
269 dev_dbg(&dev->pdev->dev, "failed to copy data to userland\n"); 269 dev_dbg(dev->dev, "failed to copy data to userland\n");
270 rets = -EFAULT; 270 rets = -EFAULT;
271 goto free; 271 goto free;
272 } 272 }
@@ -285,7 +285,7 @@ free:
285 cl->reading_state = MEI_IDLE; 285 cl->reading_state = MEI_IDLE;
286 cl->read_cb = NULL; 286 cl->read_cb = NULL;
287out: 287out:
288 dev_dbg(&dev->pdev->dev, "end mei read rets= %d\n", rets); 288 dev_dbg(dev->dev, "end mei read rets= %d\n", rets);
289 mutex_unlock(&dev->device_lock); 289 mutex_unlock(&dev->device_lock);
290 return rets; 290 return rets;
291} 291}
@@ -338,7 +338,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
338 } 338 }
339 339
340 if (cl->state != MEI_FILE_CONNECTED) { 340 if (cl->state != MEI_FILE_CONNECTED) {
341 dev_err(&dev->pdev->dev, "host client = %d, is not connected to ME client = %d", 341 dev_err(dev->dev, "host client = %d, is not connected to ME client = %d",
342 cl->host_client_id, cl->me_client_id); 342 cl->host_client_id, cl->me_client_id);
343 rets = -ENODEV; 343 rets = -ENODEV;
344 goto out; 344 goto out;
@@ -386,7 +386,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
386 386
387 rets = copy_from_user(write_cb->request_buffer.data, ubuf, length); 387 rets = copy_from_user(write_cb->request_buffer.data, ubuf, length);
388 if (rets) { 388 if (rets) {
389 dev_dbg(&dev->pdev->dev, "failed to copy data from userland\n"); 389 dev_dbg(dev->dev, "failed to copy data from userland\n");
390 rets = -EFAULT; 390 rets = -EFAULT;
391 goto out; 391 goto out;
392 } 392 }
@@ -395,7 +395,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
395 rets = mei_amthif_write(dev, write_cb); 395 rets = mei_amthif_write(dev, write_cb);
396 396
397 if (rets) { 397 if (rets) {
398 dev_err(&dev->pdev->dev, 398 dev_err(dev->dev,
399 "amthif write failed with status = %d\n", rets); 399 "amthif write failed with status = %d\n", rets);
400 goto out; 400 goto out;
401 } 401 }
@@ -448,7 +448,7 @@ static int mei_ioctl_connect_client(struct file *file,
448 /* find ME client we're trying to connect to */ 448 /* find ME client we're trying to connect to */
449 me_cl = mei_me_cl_by_uuid(dev, &data->in_client_uuid); 449 me_cl = mei_me_cl_by_uuid(dev, &data->in_client_uuid);
450 if (!me_cl || me_cl->props.fixed_address) { 450 if (!me_cl || me_cl->props.fixed_address) {
451 dev_dbg(&dev->pdev->dev, "Cannot connect to FW Client UUID = %pUl\n", 451 dev_dbg(dev->dev, "Cannot connect to FW Client UUID = %pUl\n",
452 &data->in_client_uuid); 452 &data->in_client_uuid);
453 rets = -ENOTTY; 453 rets = -ENOTTY;
454 goto end; 454 goto end;
@@ -457,18 +457,18 @@ static int mei_ioctl_connect_client(struct file *file,
457 cl->me_client_id = me_cl->client_id; 457 cl->me_client_id = me_cl->client_id;
458 cl->cl_uuid = me_cl->props.protocol_name; 458 cl->cl_uuid = me_cl->props.protocol_name;
459 459
460 dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n", 460 dev_dbg(dev->dev, "Connect to FW Client ID = %d\n",
461 cl->me_client_id); 461 cl->me_client_id);
462 dev_dbg(&dev->pdev->dev, "FW Client - Protocol Version = %d\n", 462 dev_dbg(dev->dev, "FW Client - Protocol Version = %d\n",
463 me_cl->props.protocol_version); 463 me_cl->props.protocol_version);
464 dev_dbg(&dev->pdev->dev, "FW Client - Max Msg Len = %d\n", 464 dev_dbg(dev->dev, "FW Client - Max Msg Len = %d\n",
465 me_cl->props.max_msg_length); 465 me_cl->props.max_msg_length);
466 466
467 /* if we're connecting to amthif client then we will use the 467 /* if we're connecting to amthif client then we will use the
468 * existing connection 468 * existing connection
469 */ 469 */
470 if (uuid_le_cmp(data->in_client_uuid, mei_amthif_guid) == 0) { 470 if (uuid_le_cmp(data->in_client_uuid, mei_amthif_guid) == 0) {
471 dev_dbg(&dev->pdev->dev, "FW Client is amthi\n"); 471 dev_dbg(dev->dev, "FW Client is amthi\n");
472 if (dev->iamthif_cl.state != MEI_FILE_CONNECTED) { 472 if (dev->iamthif_cl.state != MEI_FILE_CONNECTED) {
473 rets = -ENODEV; 473 rets = -ENODEV;
474 goto end; 474 goto end;
@@ -493,7 +493,7 @@ static int mei_ioctl_connect_client(struct file *file,
493 client = &data->out_client_properties; 493 client = &data->out_client_properties;
494 client->max_msg_length = me_cl->props.max_msg_length; 494 client->max_msg_length = me_cl->props.max_msg_length;
495 client->protocol_version = me_cl->props.protocol_version; 495 client->protocol_version = me_cl->props.protocol_version;
496 dev_dbg(&dev->pdev->dev, "Can connect?\n"); 496 dev_dbg(dev->dev, "Can connect?\n");
497 497
498 498
499 rets = mei_cl_connect(cl, file); 499 rets = mei_cl_connect(cl, file);
@@ -524,7 +524,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
524 524
525 dev = cl->dev; 525 dev = cl->dev;
526 526
527 dev_dbg(&dev->pdev->dev, "IOCTL cmd = 0x%x", cmd); 527 dev_dbg(dev->dev, "IOCTL cmd = 0x%x", cmd);
528 528
529 mutex_lock(&dev->device_lock); 529 mutex_lock(&dev->device_lock);
530 if (dev->dev_state != MEI_DEV_ENABLED) { 530 if (dev->dev_state != MEI_DEV_ENABLED) {
@@ -534,10 +534,10 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
534 534
535 switch (cmd) { 535 switch (cmd) {
536 case IOCTL_MEI_CONNECT_CLIENT: 536 case IOCTL_MEI_CONNECT_CLIENT:
537 dev_dbg(&dev->pdev->dev, ": IOCTL_MEI_CONNECT_CLIENT.\n"); 537 dev_dbg(dev->dev, ": IOCTL_MEI_CONNECT_CLIENT.\n");
538 if (copy_from_user(&connect_data, (char __user *)data, 538 if (copy_from_user(&connect_data, (char __user *)data,
539 sizeof(struct mei_connect_client_data))) { 539 sizeof(struct mei_connect_client_data))) {
540 dev_dbg(&dev->pdev->dev, "failed to copy data from userland\n"); 540 dev_dbg(dev->dev, "failed to copy data from userland\n");
541 rets = -EFAULT; 541 rets = -EFAULT;
542 goto out; 542 goto out;
543 } 543 }
@@ -549,7 +549,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
549 /* if all is ok, copying the data back to user. */ 549 /* if all is ok, copying the data back to user. */
550 if (copy_to_user((char __user *)data, &connect_data, 550 if (copy_to_user((char __user *)data, &connect_data,
551 sizeof(struct mei_connect_client_data))) { 551 sizeof(struct mei_connect_client_data))) {
552 dev_dbg(&dev->pdev->dev, "failed to copy data to userland\n"); 552 dev_dbg(dev->dev, "failed to copy data to userland\n");
553 rets = -EFAULT; 553 rets = -EFAULT;
554 goto out; 554 goto out;
555 } 555 }
@@ -557,7 +557,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
557 break; 557 break;
558 558
559 default: 559 default:
560 dev_err(&dev->pdev->dev, ": unsupported ioctl %d.\n", cmd); 560 dev_err(dev->dev, ": unsupported ioctl %d.\n", cmd);
561 rets = -ENOIOCTLCMD; 561 rets = -ENOIOCTLCMD;
562 } 562 }
563 563
@@ -671,7 +671,7 @@ static int mei_minor_get(struct mei_device *dev)
671 if (ret >= 0) 671 if (ret >= 0)
672 dev->minor = ret; 672 dev->minor = ret;
673 else if (ret == -ENOSPC) 673 else if (ret == -ENOSPC)
674 dev_err(&dev->pdev->dev, "too many mei devices\n"); 674 dev_err(dev->dev, "too many mei devices\n");
675 675
676 mutex_unlock(&mei_minor_lock); 676 mutex_unlock(&mei_minor_lock);
677 return ret; 677 return ret;
diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c
index 8cc93e4756b3..9f32fd6eaccf 100644
--- a/drivers/misc/mei/nfc.c
+++ b/drivers/misc/mei/nfc.c
@@ -163,7 +163,7 @@ static int mei_nfc_build_bus_name(struct mei_nfc_dev *ndev)
163 return 0; 163 return 0;
164 164
165 default: 165 default:
166 dev_err(&dev->pdev->dev, "Unknown radio type 0x%x\n", 166 dev_err(dev->dev, "Unknown radio type 0x%x\n",
167 ndev->radio_type); 167 ndev->radio_type);
168 168
169 return -EINVAL; 169 return -EINVAL;
@@ -175,14 +175,14 @@ static int mei_nfc_build_bus_name(struct mei_nfc_dev *ndev)
175 ndev->bus_name = "pn544"; 175 ndev->bus_name = "pn544";
176 return 0; 176 return 0;
177 default: 177 default:
178 dev_err(&dev->pdev->dev, "Unknown radio type 0x%x\n", 178 dev_err(dev->dev, "Unknown radio type 0x%x\n",
179 ndev->radio_type); 179 ndev->radio_type);
180 180
181 return -EINVAL; 181 return -EINVAL;
182 } 182 }
183 183
184 default: 184 default:
185 dev_err(&dev->pdev->dev, "Unknown vendor ID 0x%x\n", 185 dev_err(dev->dev, "Unknown vendor ID 0x%x\n",
186 ndev->vendor_id); 186 ndev->vendor_id);
187 187
188 return -EINVAL; 188 return -EINVAL;
@@ -231,21 +231,21 @@ static int mei_nfc_connect(struct mei_nfc_dev *ndev)
231 231
232 ret = __mei_cl_send(cl, (u8 *)cmd, connect_length); 232 ret = __mei_cl_send(cl, (u8 *)cmd, connect_length);
233 if (ret < 0) { 233 if (ret < 0) {
234 dev_err(&dev->pdev->dev, "Could not send connect cmd\n"); 234 dev_err(dev->dev, "Could not send connect cmd\n");
235 goto err; 235 goto err;
236 } 236 }
237 237
238 bytes_recv = __mei_cl_recv(cl, (u8 *)reply, connect_resp_length); 238 bytes_recv = __mei_cl_recv(cl, (u8 *)reply, connect_resp_length);
239 if (bytes_recv < 0) { 239 if (bytes_recv < 0) {
240 dev_err(&dev->pdev->dev, "Could not read connect response\n"); 240 dev_err(dev->dev, "Could not read connect response\n");
241 ret = bytes_recv; 241 ret = bytes_recv;
242 goto err; 242 goto err;
243 } 243 }
244 244
245 dev_info(&dev->pdev->dev, "IVN 0x%x Vendor ID 0x%x\n", 245 dev_info(dev->dev, "IVN 0x%x Vendor ID 0x%x\n",
246 connect_resp->fw_ivn, connect_resp->vendor_id); 246 connect_resp->fw_ivn, connect_resp->vendor_id);
247 247
248 dev_info(&dev->pdev->dev, "ME FW %d.%d.%d.%d\n", 248 dev_info(dev->dev, "ME FW %d.%d.%d.%d\n",
249 connect_resp->me_major, connect_resp->me_minor, 249 connect_resp->me_major, connect_resp->me_minor,
250 connect_resp->me_hotfix, connect_resp->me_build); 250 connect_resp->me_hotfix, connect_resp->me_build);
251 251
@@ -279,7 +279,7 @@ static int mei_nfc_if_version(struct mei_nfc_dev *ndev)
279 279
280 ret = __mei_cl_send(cl, (u8 *)&cmd, sizeof(struct mei_nfc_cmd)); 280 ret = __mei_cl_send(cl, (u8 *)&cmd, sizeof(struct mei_nfc_cmd));
281 if (ret < 0) { 281 if (ret < 0) {
282 dev_err(&dev->pdev->dev, "Could not send IF version cmd\n"); 282 dev_err(dev->dev, "Could not send IF version cmd\n");
283 return ret; 283 return ret;
284 } 284 }
285 285
@@ -293,7 +293,7 @@ static int mei_nfc_if_version(struct mei_nfc_dev *ndev)
293 293
294 bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length); 294 bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length);
295 if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) { 295 if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) {
296 dev_err(&dev->pdev->dev, "Could not read IF version\n"); 296 dev_err(dev->dev, "Could not read IF version\n");
297 ret = -EIO; 297 ret = -EIO;
298 goto err; 298 goto err;
299 } 299 }
@@ -319,7 +319,7 @@ static int mei_nfc_enable(struct mei_cl_device *cldev)
319 319
320 ret = mei_nfc_connect(ndev); 320 ret = mei_nfc_connect(ndev);
321 if (ret < 0) { 321 if (ret < 0) {
322 dev_err(&dev->pdev->dev, "Could not connect to NFC"); 322 dev_err(dev->dev, "Could not connect to NFC");
323 return ret; 323 return ret;
324 } 324 }
325 325
@@ -361,7 +361,7 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length)
361 361
362 if (!wait_event_interruptible_timeout(ndev->send_wq, 362 if (!wait_event_interruptible_timeout(ndev->send_wq,
363 ndev->recv_req_id == ndev->req_id, HZ)) { 363 ndev->recv_req_id == ndev->req_id, HZ)) {
364 dev_err(&dev->pdev->dev, "NFC MEI command timeout\n"); 364 dev_err(dev->dev, "NFC MEI command timeout\n");
365 err = -ETIME; 365 err = -ETIME;
366 } else { 366 } else {
367 ndev->req_id++; 367 ndev->req_id++;
@@ -418,8 +418,7 @@ static void mei_nfc_init(struct work_struct *work)
418 418
419 if (mei_cl_connect(cl_info, NULL) < 0) { 419 if (mei_cl_connect(cl_info, NULL) < 0) {
420 mutex_unlock(&dev->device_lock); 420 mutex_unlock(&dev->device_lock);
421 dev_err(&dev->pdev->dev, 421 dev_err(dev->dev, "Could not connect to the NFC INFO ME client");
422 "Could not connect to the NFC INFO ME client");
423 422
424 goto err; 423 goto err;
425 } 424 }
@@ -427,21 +426,19 @@ static void mei_nfc_init(struct work_struct *work)
427 mutex_unlock(&dev->device_lock); 426 mutex_unlock(&dev->device_lock);
428 427
429 if (mei_nfc_if_version(ndev) < 0) { 428 if (mei_nfc_if_version(ndev) < 0) {
430 dev_err(&dev->pdev->dev, "Could not get the NFC interface version"); 429 dev_err(dev->dev, "Could not get the NFC interface version");
431 430
432 goto err; 431 goto err;
433 } 432 }
434 433
435 dev_info(&dev->pdev->dev, 434 dev_info(dev->dev, "NFC MEI VERSION: IVN 0x%x Vendor ID 0x%x Type 0x%x\n",
436 "NFC MEI VERSION: IVN 0x%x Vendor ID 0x%x Type 0x%x\n",
437 ndev->fw_ivn, ndev->vendor_id, ndev->radio_type); 435 ndev->fw_ivn, ndev->vendor_id, ndev->radio_type);
438 436
439 mutex_lock(&dev->device_lock); 437 mutex_lock(&dev->device_lock);
440 438
441 if (mei_cl_disconnect(cl_info) < 0) { 439 if (mei_cl_disconnect(cl_info) < 0) {
442 mutex_unlock(&dev->device_lock); 440 mutex_unlock(&dev->device_lock);
443 dev_err(&dev->pdev->dev, 441 dev_err(dev->dev, "Could not disconnect the NFC INFO ME client");
444 "Could not disconnect the NFC INFO ME client");
445 442
446 goto err; 443 goto err;
447 } 444 }
@@ -449,15 +446,13 @@ static void mei_nfc_init(struct work_struct *work)
449 mutex_unlock(&dev->device_lock); 446 mutex_unlock(&dev->device_lock);
450 447
451 if (mei_nfc_build_bus_name(ndev) < 0) { 448 if (mei_nfc_build_bus_name(ndev) < 0) {
452 dev_err(&dev->pdev->dev, 449 dev_err(dev->dev, "Could not build the bus ID name\n");
453 "Could not build the bus ID name\n");
454 return; 450 return;
455 } 451 }
456 452
457 cldev = mei_cl_add_device(dev, mei_nfc_guid, ndev->bus_name, &nfc_ops); 453 cldev = mei_cl_add_device(dev, mei_nfc_guid, ndev->bus_name, &nfc_ops);
458 if (!cldev) { 454 if (!cldev) {
459 dev_err(&dev->pdev->dev, 455 dev_err(dev->dev, "Could not add the NFC device to the MEI bus\n");
460 "Could not add the NFC device to the MEI bus\n");
461 456
462 goto err; 457 goto err;
463 } 458 }
@@ -500,7 +495,7 @@ int mei_nfc_host_init(struct mei_device *dev)
500 /* check for valid client id */ 495 /* check for valid client id */
501 me_cl = mei_me_cl_by_uuid(dev, &mei_nfc_info_guid); 496 me_cl = mei_me_cl_by_uuid(dev, &mei_nfc_info_guid);
502 if (!me_cl) { 497 if (!me_cl) {
503 dev_info(&dev->pdev->dev, "nfc: failed to find the client\n"); 498 dev_info(dev->dev, "nfc: failed to find the client\n");
504 ret = -ENOTTY; 499 ret = -ENOTTY;
505 goto err; 500 goto err;
506 } 501 }
@@ -518,7 +513,7 @@ int mei_nfc_host_init(struct mei_device *dev)
518 /* check for valid client id */ 513 /* check for valid client id */
519 me_cl = mei_me_cl_by_uuid(dev, &mei_nfc_guid); 514 me_cl = mei_me_cl_by_uuid(dev, &mei_nfc_guid);
520 if (!me_cl) { 515 if (!me_cl) {
521 dev_info(&dev->pdev->dev, "nfc: failed to find the client\n"); 516 dev_info(dev->dev, "nfc: failed to find the client\n");
522 ret = -ENOTTY; 517 ret = -ENOTTY;
523 goto err; 518 goto err;
524 } 519 }
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index a0e9422b55a2..83e88920f738 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -451,7 +451,7 @@ static inline void mei_me_set_pm_domain(struct mei_device *dev)
451static inline void mei_me_unset_pm_domain(struct mei_device *dev) 451static inline void mei_me_unset_pm_domain(struct mei_device *dev)
452{ 452{
453 /* stop using pm callbacks if any */ 453 /* stop using pm callbacks if any */
454 dev->pdev->dev.pm_domain = NULL; 454 dev->dev->pm_domain = NULL;
455} 455}
456#endif /* CONFIG_PM_RUNTIME */ 456#endif /* CONFIG_PM_RUNTIME */
457 457
diff --git a/drivers/misc/mei/pci-txe.c b/drivers/misc/mei/pci-txe.c
index a5ce2ab98af2..a1f60be873f5 100644
--- a/drivers/misc/mei/pci-txe.c
+++ b/drivers/misc/mei/pci-txe.c
@@ -399,7 +399,7 @@ static inline void mei_txe_set_pm_domain(struct mei_device *dev)
399static inline void mei_txe_unset_pm_domain(struct mei_device *dev) 399static inline void mei_txe_unset_pm_domain(struct mei_device *dev)
400{ 400{
401 /* stop using pm callbacks if any */ 401 /* stop using pm callbacks if any */
402 dev->pdev->dev.pm_domain = NULL; 402 dev->dev->pm_domain = NULL;
403} 403}
404#endif /* CONFIG_PM_RUNTIME */ 404#endif /* CONFIG_PM_RUNTIME */
405 405
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}