Skip to content

Commit 631ae0c

Browse files
ausyskingregkh
authored andcommitted
mei: more prints with client prefix
Use client-aware print macro instead of usual device print in more places to expand debug-ability. The client-aware print macro prefixes the usual device print with current connection endpoints. Signed-off-by: Alexander Usyskin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3fd97f2 commit 631ae0c

File tree

3 files changed

+34
-37
lines changed

3 files changed

+34
-37
lines changed

drivers/misc/mei/hbm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ int mei_hbm_cl_notify_req(struct mei_device *dev,
510510

511511
ret = mei_hbm_write_message(dev, &mei_hdr, &req);
512512
if (ret)
513-
dev_err(dev->dev, "notify request failed: ret = %d\n", ret);
513+
cl_err(dev, cl, "notify request failed: ret = %d\n", ret);
514514

515515
return ret;
516516
}
@@ -626,7 +626,7 @@ int mei_hbm_cl_dma_map_req(struct mei_device *dev, struct mei_cl *cl)
626626

627627
ret = mei_hbm_write_message(dev, &mei_hdr, &req);
628628
if (ret)
629-
dev_err(dev->dev, "dma map request failed: ret = %d\n", ret);
629+
cl_err(dev, cl, "dma map request failed: ret = %d\n", ret);
630630

631631
return ret;
632632
}
@@ -654,7 +654,7 @@ int mei_hbm_cl_dma_unmap_req(struct mei_device *dev, struct mei_cl *cl)
654654

655655
ret = mei_hbm_write_message(dev, &mei_hdr, &req);
656656
if (ret)
657-
dev_err(dev->dev, "dma unmap request failed: ret = %d\n", ret);
657+
cl_err(dev, cl, "dma unmap request failed: ret = %d\n", ret);
658658

659659
return ret;
660660
}
@@ -679,10 +679,10 @@ static void mei_hbm_cl_dma_map_res(struct mei_device *dev,
679679
return;
680680

681681
if (res->status) {
682-
dev_err(dev->dev, "cl dma map failed %d\n", res->status);
682+
cl_err(dev, cl, "cl dma map failed %d\n", res->status);
683683
cl->status = -EFAULT;
684684
} else {
685-
dev_dbg(dev->dev, "cl dma map succeeded\n");
685+
cl_dbg(dev, cl, "cl dma map succeeded\n");
686686
cl->dma_mapped = 1;
687687
cl->status = 0;
688688
}
@@ -709,10 +709,10 @@ static void mei_hbm_cl_dma_unmap_res(struct mei_device *dev,
709709
return;
710710

711711
if (res->status) {
712-
dev_err(dev->dev, "cl dma unmap failed %d\n", res->status);
712+
cl_err(dev, cl, "cl dma unmap failed %d\n", res->status);
713713
cl->status = -EFAULT;
714714
} else {
715-
dev_dbg(dev->dev, "cl dma unmap succeeded\n");
715+
cl_dbg(dev, cl, "cl dma unmap succeeded\n");
716716
cl->dma_mapped = 0;
717717
cl->status = 0;
718718
}

drivers/misc/mei/interrupt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void mei_irq_compl_handler(struct mei_device *dev, struct list_head *cmpl_list)
3535
cl = cb->cl;
3636
list_del_init(&cb->list);
3737

38-
dev_dbg(dev->dev, "completing call back.\n");
38+
cl_dbg(dev, cl, "completing call back.\n");
3939
mei_cl_complete(cl, cb);
4040
}
4141
}

drivers/misc/mei/main.c

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
256256
length = min_t(size_t, length, cb->buf_idx - *offset);
257257

258258
if (copy_to_user(ubuf, cb->buf.data + *offset, length)) {
259-
dev_dbg(dev->dev, "failed to copy data to userland\n");
259+
cl_dbg(dev, cl, "failed to copy data to userland\n");
260260
rets = -EFAULT;
261261
goto free;
262262
}
@@ -379,7 +379,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
379379

380380
rets = copy_from_user(cb->buf.data, ubuf, length);
381381
if (rets) {
382-
dev_dbg(dev->dev, "failed to copy data from userland\n");
382+
cl_dbg(dev, cl, "failed to copy data from userland\n");
383383
rets = -EFAULT;
384384
mei_io_cb_free(cb);
385385
goto out;
@@ -421,7 +421,7 @@ static int mei_ioctl_connect_client(struct file *file,
421421
/* find ME client we're trying to connect to */
422422
me_cl = mei_me_cl_by_uuid(dev, in_client_uuid);
423423
if (!me_cl) {
424-
dev_dbg(dev->dev, "Cannot connect to FW Client UUID = %pUl\n",
424+
cl_dbg(dev, cl, "Cannot connect to FW Client UUID = %pUl\n",
425425
in_client_uuid);
426426
rets = -ENOTTY;
427427
goto end;
@@ -431,24 +431,21 @@ static int mei_ioctl_connect_client(struct file *file,
431431
bool forbidden = dev->override_fixed_address ?
432432
!dev->allow_fixed_address : !dev->hbm_f_fa_supported;
433433
if (forbidden) {
434-
dev_dbg(dev->dev, "Connection forbidden to FW Client UUID = %pUl\n",
434+
cl_dbg(dev, cl, "Connection forbidden to FW Client UUID = %pUl\n",
435435
in_client_uuid);
436436
rets = -ENOTTY;
437437
goto end;
438438
}
439439
}
440440

441-
dev_dbg(dev->dev, "Connect to FW Client ID = %d\n",
442-
me_cl->client_id);
443-
dev_dbg(dev->dev, "FW Client - Protocol Version = %d\n",
444-
me_cl->props.protocol_version);
445-
dev_dbg(dev->dev, "FW Client - Max Msg Len = %d\n",
446-
me_cl->props.max_msg_length);
441+
cl_dbg(dev, cl, "Connect to FW Client ID = %d\n", me_cl->client_id);
442+
cl_dbg(dev, cl, "FW Client - Protocol Version = %d\n", me_cl->props.protocol_version);
443+
cl_dbg(dev, cl, "FW Client - Max Msg Len = %d\n", me_cl->props.max_msg_length);
447444

448445
/* prepare the output buffer */
449446
client->max_msg_length = me_cl->props.max_msg_length;
450447
client->protocol_version = me_cl->props.protocol_version;
451-
dev_dbg(dev->dev, "Can connect?\n");
448+
cl_dbg(dev, cl, "Can connect?\n");
452449

453450
rets = mei_cl_connect(cl, me_cl, file);
454451

@@ -515,19 +512,19 @@ static int mei_ioctl_connect_vtag(struct file *file,
515512
cl = file->private_data;
516513
dev = cl->dev;
517514

518-
dev_dbg(dev->dev, "FW Client %pUl vtag %d\n", in_client_uuid, vtag);
515+
cl_dbg(dev, cl, "FW Client %pUl vtag %d\n", in_client_uuid, vtag);
519516

520517
switch (cl->state) {
521518
case MEI_FILE_DISCONNECTED:
522519
if (mei_cl_vtag_by_fp(cl, file) != vtag) {
523-
dev_err(dev->dev, "reconnect with different vtag\n");
520+
cl_err(dev, cl, "reconnect with different vtag\n");
524521
return -EINVAL;
525522
}
526523
break;
527524
case MEI_FILE_INITIALIZING:
528525
/* malicious connect from another thread may push vtag */
529526
if (!IS_ERR(mei_cl_fp_by_vtag(cl, vtag))) {
530-
dev_err(dev->dev, "vtag already filled\n");
527+
cl_err(dev, cl, "vtag already filled\n");
531528
return -EINVAL;
532529
}
533530

@@ -546,7 +543,7 @@ static int mei_ioctl_connect_vtag(struct file *file,
546543
continue;
547544

548545
/* replace cl with acquired one */
549-
dev_dbg(dev->dev, "replacing with existing cl\n");
546+
cl_dbg(dev, cl, "replacing with existing cl\n");
550547
mei_cl_unlink(cl);
551548
kfree(cl);
552549
file->private_data = pos;
@@ -656,7 +653,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
656653

657654
dev = cl->dev;
658655

659-
dev_dbg(dev->dev, "IOCTL cmd = 0x%x", cmd);
656+
cl_dbg(dev, cl, "IOCTL cmd = 0x%x", cmd);
660657

661658
mutex_lock(&dev->device_lock);
662659
if (dev->dev_state != MEI_DEV_ENABLED) {
@@ -666,9 +663,9 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
666663

667664
switch (cmd) {
668665
case IOCTL_MEI_CONNECT_CLIENT:
669-
dev_dbg(dev->dev, ": IOCTL_MEI_CONNECT_CLIENT.\n");
666+
cl_dbg(dev, cl, "IOCTL_MEI_CONNECT_CLIENT\n");
670667
if (copy_from_user(&conn, (char __user *)data, sizeof(conn))) {
671-
dev_dbg(dev->dev, "failed to copy data from userland\n");
668+
cl_dbg(dev, cl, "failed to copy data from userland\n");
672669
rets = -EFAULT;
673670
goto out;
674671
}
@@ -689,18 +686,18 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
689686

690687
/* if all is ok, copying the data back to user. */
691688
if (copy_to_user((char __user *)data, &conn, sizeof(conn))) {
692-
dev_dbg(dev->dev, "failed to copy data to userland\n");
689+
cl_dbg(dev, cl, "failed to copy data to userland\n");
693690
rets = -EFAULT;
694691
goto out;
695692
}
696693

697694
break;
698695

699696
case IOCTL_MEI_CONNECT_CLIENT_VTAG:
700-
dev_dbg(dev->dev, "IOCTL_MEI_CONNECT_CLIENT_VTAG\n");
697+
cl_dbg(dev, cl, "IOCTL_MEI_CONNECT_CLIENT_VTAG\n");
701698
if (copy_from_user(&conn_vtag, (char __user *)data,
702699
sizeof(conn_vtag))) {
703-
dev_dbg(dev->dev, "failed to copy data from userland\n");
700+
cl_dbg(dev, cl, "failed to copy data from userland\n");
704701
rets = -EFAULT;
705702
goto out;
706703
}
@@ -711,13 +708,13 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
711708

712709
rets = mei_vt_support_check(dev, cl_uuid);
713710
if (rets == -EOPNOTSUPP)
714-
dev_dbg(dev->dev, "FW Client %pUl does not support vtags\n",
711+
cl_dbg(dev, cl, "FW Client %pUl does not support vtags\n",
715712
cl_uuid);
716713
if (rets)
717714
goto out;
718715

719716
if (!vtag) {
720-
dev_dbg(dev->dev, "vtag can't be zero\n");
717+
cl_dbg(dev, cl, "vtag can't be zero\n");
721718
rets = -EINVAL;
722719
goto out;
723720
}
@@ -729,34 +726,34 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
729726
/* if all is ok, copying the data back to user. */
730727
if (copy_to_user((char __user *)data, &conn_vtag,
731728
sizeof(conn_vtag))) {
732-
dev_dbg(dev->dev, "failed to copy data to userland\n");
729+
cl_dbg(dev, cl, "failed to copy data to userland\n");
733730
rets = -EFAULT;
734731
goto out;
735732
}
736733

737734
break;
738735

739736
case IOCTL_MEI_NOTIFY_SET:
740-
dev_dbg(dev->dev, ": IOCTL_MEI_NOTIFY_SET.\n");
737+
cl_dbg(dev, cl, "IOCTL_MEI_NOTIFY_SET\n");
741738
if (copy_from_user(&notify_req,
742739
(char __user *)data, sizeof(notify_req))) {
743-
dev_dbg(dev->dev, "failed to copy data from userland\n");
740+
cl_dbg(dev, cl, "failed to copy data from userland\n");
744741
rets = -EFAULT;
745742
goto out;
746743
}
747744
rets = mei_ioctl_client_notify_request(file, notify_req);
748745
break;
749746

750747
case IOCTL_MEI_NOTIFY_GET:
751-
dev_dbg(dev->dev, ": IOCTL_MEI_NOTIFY_GET.\n");
748+
cl_dbg(dev, cl, "IOCTL_MEI_NOTIFY_GET\n");
752749
rets = mei_ioctl_client_notify_get(file, &notify_get);
753750
if (rets)
754751
goto out;
755752

756-
dev_dbg(dev->dev, "copy connect data to user\n");
753+
cl_dbg(dev, cl, "copy connect data to user\n");
757754
if (copy_to_user((char __user *)data,
758755
&notify_get, sizeof(notify_get))) {
759-
dev_dbg(dev->dev, "failed to copy data to userland\n");
756+
cl_dbg(dev, cl, "failed to copy data to userland\n");
760757
rets = -EFAULT;
761758
goto out;
762759

0 commit comments

Comments
 (0)