diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-08-21 13:29:13 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-24 07:57:48 +0200 |
commit | 5ca2d3882d60c040285d0b45df731e11f5da7c64 (patch) | |
tree | 1c66e2f92e47ed378b512034cbc4c2e22eaaddc2 /drivers/misc/mei/debugfs.c | |
parent | mei: me_client lookup function to return me_client object (diff) | |
download | linux-5ca2d3882d60c040285d0b45df731e11f5da7c64.tar.xz linux-5ca2d3882d60c040285d0b45df731e11f5da7c64.zip |
mei: use list for me clients book keeping
To support dynamic addition/remove of clients
it is more convenient to use list instead of
static array
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/debugfs.c')
-rw-r--r-- | drivers/misc/mei/debugfs.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c index ced5b777c70f..3b032881622d 100644 --- a/drivers/misc/mei/debugfs.c +++ b/drivers/misc/mei/debugfs.c @@ -28,10 +28,10 @@ static ssize_t mei_dbgfs_read_meclients(struct file *fp, char __user *ubuf, size_t cnt, loff_t *ppos) { struct mei_device *dev = fp->private_data; - struct mei_me_client *cl; + struct mei_me_client *me_cl; const size_t bufsz = 1024; char *buf = kzalloc(bufsz, GFP_KERNEL); - int i; + int i = 0; int pos = 0; int ret; @@ -47,20 +47,19 @@ static ssize_t mei_dbgfs_read_meclients(struct file *fp, char __user *ubuf, if (dev->dev_state != MEI_DEV_ENABLED) goto out; - for (i = 0; i < dev->me_clients_num; i++) { - cl = &dev->me_clients[i]; + list_for_each_entry(me_cl, &dev->me_clients, list) { /* skip me clients that cannot be connected */ - if (cl->props.max_number_of_connections == 0) + if (me_cl->props.max_number_of_connections == 0) continue; pos += scnprintf(buf + pos, bufsz - pos, "%2d|%2d|%4d|%pUl|%3d|%7d|\n", - i, cl->client_id, - cl->props.fixed_address, - &cl->props.protocol_name, - cl->props.max_number_of_connections, - cl->props.max_msg_length); + i++, me_cl->client_id, + me_cl->props.fixed_address, + &me_cl->props.protocol_name, + me_cl->props.max_number_of_connections, + me_cl->props.max_msg_length); } out: mutex_unlock(&dev->device_lock); |