diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-08-24 12:08:55 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-23 22:57:47 -0700 |
commit | d320832f64666089a06778782e42fac29abd7bf7 (patch) | |
tree | 19fd44ea6cd1b93a178763345a736f193284132f /drivers/misc/mei/amthif.c | |
parent | 68d1aa65978b86b2ca5bdf7211b27cfd32c3212d (diff) | |
download | lwn-d320832f64666089a06778782e42fac29abd7bf7.tar.gz lwn-d320832f64666089a06778782e42fac29abd7bf7.zip |
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/amthif.c')
-rw-r--r-- | drivers/misc/mei/amthif.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index ab6095988620..c1fc6dd8faae 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c @@ -68,27 +68,26 @@ void mei_amthif_reset_params(struct mei_device *dev) int mei_amthif_host_init(struct mei_device *dev) { struct mei_cl *cl = &dev->iamthif_cl; + struct mei_me_client *me_cl; unsigned char *msg_buf; - int ret, i; + int ret; dev->iamthif_state = MEI_IAMTHIF_IDLE; mei_cl_init(cl, dev); - i = mei_me_cl_by_uuid(dev, &mei_amthif_guid); - if (i < 0) { - dev_info(&dev->pdev->dev, - "amthif: failed to find the client %d\n", i); + me_cl = mei_me_cl_by_uuid(dev, &mei_amthif_guid); + if (!me_cl) { + dev_info(&dev->pdev->dev, "amthif: failed to find the client"); return -ENOTTY; } - cl->me_client_id = dev->me_clients[i].client_id; + cl->me_client_id = me_cl->client_id; /* Assign iamthif_mtu to the value received from ME */ - dev->iamthif_mtu = dev->me_clients[i].props.max_msg_length; - dev_dbg(&dev->pdev->dev, "IAMTHIF_MTU = %d\n", - dev->me_clients[i].props.max_msg_length); + dev->iamthif_mtu = me_cl->props.max_msg_length; + dev_dbg(&dev->pdev->dev, "IAMTHIF_MTU = %d\n", dev->iamthif_mtu); kfree(dev->iamthif_msg_buf); dev->iamthif_msg_buf = NULL; @@ -157,12 +156,11 @@ struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev, int mei_amthif_read(struct mei_device *dev, struct file *file, char __user *ubuf, size_t length, loff_t *offset) { - int rets; - int wait_ret; - struct mei_cl_cb *cb = NULL; struct mei_cl *cl = file->private_data; + struct mei_cl_cb *cb; unsigned long timeout; - int i; + int rets; + int wait_ret; /* Only possible if we are in timeout */ if (!cl) { @@ -170,11 +168,6 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, return -ETIME; } - i = mei_me_cl_by_id(dev, dev->iamthif_cl.me_client_id); - if (i < 0) { - dev_dbg(&dev->pdev->dev, "amthif client not found.\n"); - return -ENOTTY; - } dev_dbg(&dev->pdev->dev, "checking amthif data\n"); cb = mei_amthif_find_read_list_entry(dev, file); |