aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/nfc.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2014-08-24 05:08:55 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-24 01:57:47 -0400
commitd320832f64666089a06778782e42fac29abd7bf7 (patch)
tree19fd44ea6cd1b93a178763345a736f193284132f /drivers/misc/mei/nfc.c
parent68d1aa65978b86b2ca5bdf7211b27cfd32c3212d (diff)
mei: me_client lookup function to return me_client object
For support of dynamic addition and removal of me clients it is more convenient to use a list instead of static array as is use now. As the first step of the transition to the new data structure we change the lookup function so it returns me client address instead of an index. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/nfc.c')
-rw-r--r--drivers/misc/mei/nfc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c
index 5ccc23bc7690..964b4c606646 100644
--- a/drivers/misc/mei/nfc.c
+++ b/drivers/misc/mei/nfc.c
@@ -480,7 +480,8 @@ int mei_nfc_host_init(struct mei_device *dev)
480{ 480{
481 struct mei_nfc_dev *ndev = &nfc_dev; 481 struct mei_nfc_dev *ndev = &nfc_dev;
482 struct mei_cl *cl_info, *cl = NULL; 482 struct mei_cl *cl_info, *cl = NULL;
483 int i, ret; 483 struct mei_me_client *me_cl;
484 int ret;
484 485
485 /* already initialized */ 486 /* already initialized */
486 if (ndev->cl_info) 487 if (ndev->cl_info)
@@ -498,14 +499,14 @@ int mei_nfc_host_init(struct mei_device *dev)
498 } 499 }
499 500
500 /* check for valid client id */ 501 /* check for valid client id */
501 i = mei_me_cl_by_uuid(dev, &mei_nfc_info_guid); 502 me_cl = mei_me_cl_by_uuid(dev, &mei_nfc_info_guid);
502 if (i < 0) { 503 if (!me_cl) {
503 dev_info(&dev->pdev->dev, "nfc: failed to find the client\n"); 504 dev_info(&dev->pdev->dev, "nfc: failed to find the client\n");
504 ret = -ENOTTY; 505 ret = -ENOTTY;
505 goto err; 506 goto err;
506 } 507 }
507 508
508 cl_info->me_client_id = dev->me_clients[i].client_id; 509 cl_info->me_client_id = me_cl->client_id;
509 510
510 ret = mei_cl_link(cl_info, MEI_HOST_CLIENT_ID_ANY); 511 ret = mei_cl_link(cl_info, MEI_HOST_CLIENT_ID_ANY);
511 if (ret) 512 if (ret)
@@ -516,14 +517,14 @@ int mei_nfc_host_init(struct mei_device *dev)
516 list_add_tail(&cl_info->device_link, &dev->device_list); 517 list_add_tail(&cl_info->device_link, &dev->device_list);
517 518
518 /* check for valid client id */ 519 /* check for valid client id */
519 i = mei_me_cl_by_uuid(dev, &mei_nfc_guid); 520 me_cl = mei_me_cl_by_uuid(dev, &mei_nfc_guid);
520 if (i < 0) { 521 if (!me_cl) {
521 dev_info(&dev->pdev->dev, "nfc: failed to find the client\n"); 522 dev_info(&dev->pdev->dev, "nfc: failed to find the client\n");
522 ret = -ENOTTY; 523 ret = -ENOTTY;
523 goto err; 524 goto err;
524 } 525 }
525 526
526 cl->me_client_id = dev->me_clients[i].client_id; 527 cl->me_client_id = me_cl->client_id;
527 528
528 ret = mei_cl_link(cl, MEI_HOST_CLIENT_ID_ANY); 529 ret = mei_cl_link(cl, MEI_HOST_CLIENT_ID_ANY);
529 if (ret) 530 if (ret)