diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-03-31 06:49:41 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-04-03 11:55:19 -0400 |
commit | 42852f182a783e7bcd157fa0a9390c77e9376a60 (patch) | |
tree | 1a781297018d65c5ef9c5b5aa61b44639f5a0ae2 /drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c | |
parent | 468d6888fc6db207cb239e270752f3f8f2f0ed87 (diff) |
gpu: nvgpu: use nvgpu list for cycle stats snapshot clients
Use nvgpu list APIs instead of linux list APIs
for cycle stats snapshot clients list
Jira NVGPU-13
Change-Id: I124812b70ca8deb26ee1644d4d79cc404fd2aed9
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1454010
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c index 53d5f78d..640e6179 100644 --- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c | |||
@@ -118,7 +118,7 @@ static int css_gr_create_shared_data(struct gr_gk20a *gr) | |||
118 | if (!data) | 118 | if (!data) |
119 | return -ENOMEM; | 119 | return -ENOMEM; |
120 | 120 | ||
121 | INIT_LIST_HEAD(&data->clients); | 121 | nvgpu_init_list_node(&data->clients); |
122 | gr->cs_data = data; | 122 | gr->cs_data = data; |
123 | 123 | ||
124 | return 0; | 124 | return 0; |
@@ -243,14 +243,12 @@ static void css_gr_free_shared_data(struct gr_gk20a *gr) | |||
243 | 243 | ||
244 | 244 | ||
245 | static struct gk20a_cs_snapshot_client* | 245 | static struct gk20a_cs_snapshot_client* |
246 | css_gr_search_client(struct list_head *clients, u32 perfmon) | 246 | css_gr_search_client(struct nvgpu_list_node *clients, u32 perfmon) |
247 | { | 247 | { |
248 | struct list_head *pos; | 248 | struct gk20a_cs_snapshot_client *client; |
249 | 249 | ||
250 | list_for_each(pos, clients) { | 250 | nvgpu_list_for_each_entry(client, clients, |
251 | struct gk20a_cs_snapshot_client *client = | 251 | gk20a_cs_snapshot_client, list) { |
252 | container_of(pos, | ||
253 | struct gk20a_cs_snapshot_client, list); | ||
254 | if (CONTAINS_PERFMON(client, perfmon)) | 252 | if (CONTAINS_PERFMON(client, perfmon)) |
255 | return client; | 253 | return client; |
256 | } | 254 | } |
@@ -284,7 +282,7 @@ static int css_gr_flush_snapshots(struct channel_gk20a *ch) | |||
284 | if (!css) | 282 | if (!css) |
285 | return -EINVAL; | 283 | return -EINVAL; |
286 | 284 | ||
287 | if (list_empty(&css->clients)) | 285 | if (nvgpu_list_empty(&css->clients)) |
288 | return -EBADF; | 286 | return -EBADF; |
289 | 287 | ||
290 | /* check data available */ | 288 | /* check data available */ |
@@ -296,11 +294,8 @@ static int css_gr_flush_snapshots(struct channel_gk20a *ch) | |||
296 | return 0; | 294 | return 0; |
297 | 295 | ||
298 | if (hw_overflow) { | 296 | if (hw_overflow) { |
299 | struct list_head *pos; | 297 | nvgpu_list_for_each_entry(cur, &css->clients, |
300 | 298 | gk20a_cs_snapshot_client, list) { | |
301 | list_for_each(pos, &css->clients) { | ||
302 | cur = container_of(pos, | ||
303 | struct gk20a_cs_snapshot_client, list); | ||
304 | cur->snapshot->hw_overflow_events_occured++; | 299 | cur->snapshot->hw_overflow_events_occured++; |
305 | } | 300 | } |
306 | 301 | ||
@@ -445,7 +440,7 @@ static int css_gr_free_client_data(struct gk20a *g, | |||
445 | int ret = 0; | 440 | int ret = 0; |
446 | 441 | ||
447 | if (client->list.next && client->list.prev) | 442 | if (client->list.next && client->list.prev) |
448 | list_del(&client->list); | 443 | nvgpu_list_del(&client->list); |
449 | 444 | ||
450 | if (client->perfmon_start && client->perfmon_count | 445 | if (client->perfmon_start && client->perfmon_count |
451 | && g->ops.css.release_perfmon_ids) { | 446 | && g->ops.css.release_perfmon_ids) { |
@@ -524,7 +519,7 @@ static int css_gr_create_client_data(struct gk20a *g, | |||
524 | } | 519 | } |
525 | } | 520 | } |
526 | 521 | ||
527 | list_add_tail(&cur->list, &data->clients); | 522 | nvgpu_list_add_tail(&cur->list, &data->clients); |
528 | *client = cur; | 523 | *client = cur; |
529 | 524 | ||
530 | return 0; | 525 | return 0; |
@@ -590,7 +585,7 @@ failed: | |||
590 | *cs_client = NULL; | 585 | *cs_client = NULL; |
591 | } | 586 | } |
592 | 587 | ||
593 | if (list_empty(&gr->cs_data->clients)) | 588 | if (nvgpu_list_empty(&gr->cs_data->clients)) |
594 | css_gr_free_shared_data(gr); | 589 | css_gr_free_shared_data(gr); |
595 | } | 590 | } |
596 | nvgpu_mutex_release(&gr->cs_lock); | 591 | nvgpu_mutex_release(&gr->cs_lock); |
@@ -620,7 +615,7 @@ int gr_gk20a_css_detach(struct channel_gk20a *ch, | |||
620 | g->ops.css.detach_snapshot(ch, cs_client); | 615 | g->ops.css.detach_snapshot(ch, cs_client); |
621 | 616 | ||
622 | ret = css_gr_free_client_data(g, data, cs_client); | 617 | ret = css_gr_free_client_data(g, data, cs_client); |
623 | if (list_empty(&data->clients)) | 618 | if (nvgpu_list_empty(&data->clients)) |
624 | css_gr_free_shared_data(gr); | 619 | css_gr_free_shared_data(gr); |
625 | } else { | 620 | } else { |
626 | ret = -EBADF; | 621 | ret = -EBADF; |