diff options
author | Alexander Usyskin <alexander.usyskin@intel.com> | 2014-02-17 08:13:23 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-18 13:05:33 -0500 |
commit | 12d0066526f386538de80b4d86d2008461b36674 (patch) | |
tree | fcde1b185663b1fecbb9ffc683c59baf2e6ca3ee /drivers/misc/mei/hbm.c | |
parent | a27a76d3c07de08a0d0d298b6bc280c5b820e997 (diff) |
mei: use helper function to find me client by id
We already have a helper to find me client by id, let's
use it in all relevant places.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/hbm.c')
-rw-r--r-- | drivers/misc/mei/hbm.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index 46743e2349b1..7e99e4149626 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "mei_dev.h" | 22 | #include "mei_dev.h" |
23 | #include "hbm.h" | 23 | #include "hbm.h" |
24 | #include "hw-me.h" | 24 | #include "hw-me.h" |
25 | #include "client.h" | ||
25 | 26 | ||
26 | static const char *mei_cl_conn_status_str(enum mei_cl_connect_status status) | 27 | static const char *mei_cl_conn_status_str(enum mei_cl_connect_status status) |
27 | { | 28 | { |
@@ -340,27 +341,34 @@ int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl) | |||
340 | * | 341 | * |
341 | * @dev: the device structure | 342 | * @dev: the device structure |
342 | * @flow: flow control. | 343 | * @flow: flow control. |
344 | * | ||
345 | * return 0 on success, < 0 otherwise | ||
343 | */ | 346 | */ |
344 | static void mei_hbm_add_single_flow_creds(struct mei_device *dev, | 347 | static int mei_hbm_add_single_flow_creds(struct mei_device *dev, |
345 | struct hbm_flow_control *flow) | 348 | struct hbm_flow_control *flow) |
346 | { | 349 | { |
347 | struct mei_me_client *client; | 350 | struct mei_me_client *me_cl; |
348 | int i; | 351 | int id; |
349 | 352 | ||
350 | for (i = 0; i < dev->me_clients_num; i++) { | 353 | id = mei_me_cl_by_id(dev, flow->me_addr); |
351 | client = &dev->me_clients[i]; | 354 | if (id < 0) { |
352 | if (client && flow->me_addr == client->client_id) { | 355 | dev_err(&dev->pdev->dev, "no such me client %d\n", |
353 | if (client->props.single_recv_buf) { | 356 | flow->me_addr); |
354 | client->mei_flow_ctrl_creds++; | 357 | return id; |
355 | dev_dbg(&dev->pdev->dev, "recv flow ctrl msg ME %d (single).\n", | ||
356 | flow->me_addr); | ||
357 | dev_dbg(&dev->pdev->dev, "flow control credentials =%d.\n", | ||
358 | client->mei_flow_ctrl_creds); | ||
359 | } else { | ||
360 | BUG(); /* error in flow control */ | ||
361 | } | ||
362 | } | ||
363 | } | 358 | } |
359 | |||
360 | me_cl = &dev->me_clients[id]; | ||
361 | if (me_cl->props.single_recv_buf) { | ||
362 | me_cl->mei_flow_ctrl_creds++; | ||
363 | dev_dbg(&dev->pdev->dev, "recv flow ctrl msg ME %d (single).\n", | ||
364 | flow->me_addr); | ||
365 | dev_dbg(&dev->pdev->dev, "flow control credentials =%d.\n", | ||
366 | me_cl->mei_flow_ctrl_creds); | ||
367 | } else { | ||
368 | BUG(); /* error in flow control */ | ||
369 | } | ||
370 | |||
371 | return 0; | ||
364 | } | 372 | } |
365 | 373 | ||
366 | /** | 374 | /** |