aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2016-06-22 10:44:07 -0400
committerThierry Reding <treding@nvidia.com>2016-06-23 05:59:23 -0400
commit14c95fc896e1d3929abde448fd86c07bdbae56d5 (patch)
tree78b837fe661ba226e33e4ff824b1ef475f5867cc
parent57574bd779852bb7328ade70c951b681b54a7ece (diff)
gpu: host1x: Consistently use unsigned int for counts
The number of channels, syncpoints, bases and mlocks can never be negative, so use unsigned int instead of int. Also make loop variables the same type for consistency. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/gpu/host1x/channel.c2
-rw-r--r--drivers/gpu/host1x/debug.c7
-rw-r--r--drivers/gpu/host1x/dev.h14
-rw-r--r--drivers/gpu/host1x/hw/cdma_hw.c2
-rw-r--r--drivers/gpu/host1x/hw/debug_hw.c11
-rw-r--r--drivers/gpu/host1x/hw/intr_hw.c9
-rw-r--r--drivers/gpu/host1x/hw/syncpt_hw.c3
-rw-r--r--drivers/gpu/host1x/syncpt.c15
-rw-r--r--drivers/gpu/host1x/syncpt.h6
9 files changed, 37 insertions, 32 deletions
diff --git a/drivers/gpu/host1x/channel.c b/drivers/gpu/host1x/channel.c
index b4ae3affb987..78f0ef0f6c89 100644
--- a/drivers/gpu/host1x/channel.c
+++ b/drivers/gpu/host1x/channel.c
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(host1x_channel_put);
83struct host1x_channel *host1x_channel_request(struct device *dev) 83struct host1x_channel *host1x_channel_request(struct device *dev)
84{ 84{
85 struct host1x *host = dev_get_drvdata(dev->parent); 85 struct host1x *host = dev_get_drvdata(dev->parent);
86 int max_channels = host->info->nb_channels; 86 unsigned int max_channels = host->info->nb_channels;
87 struct host1x_channel *channel = NULL; 87 struct host1x_channel *channel = NULL;
88 int index, err; 88 int index, err;
89 89
diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
index ee3d12b51c50..797f8f048117 100644
--- a/drivers/gpu/host1x/debug.c
+++ b/drivers/gpu/host1x/debug.c
@@ -62,14 +62,15 @@ static int show_channels(struct host1x_channel *ch, void *data, bool show_fifo)
62 62
63static void show_syncpts(struct host1x *m, struct output *o) 63static void show_syncpts(struct host1x *m, struct output *o)
64{ 64{
65 int i; 65 unsigned int i;
66 host1x_debug_output(o, "---- syncpts ----\n"); 66 host1x_debug_output(o, "---- syncpts ----\n");
67 for (i = 0; i < host1x_syncpt_nb_pts(m); i++) { 67 for (i = 0; i < host1x_syncpt_nb_pts(m); i++) {
68 u32 max = host1x_syncpt_read_max(m->syncpt + i); 68 u32 max = host1x_syncpt_read_max(m->syncpt + i);
69 u32 min = host1x_syncpt_load(m->syncpt + i); 69 u32 min = host1x_syncpt_load(m->syncpt + i);
70 if (!min && !max) 70 if (!min && !max)
71 continue; 71 continue;
72 host1x_debug_output(o, "id %d (%s) min %d max %d\n", 72
73 host1x_debug_output(o, "id %u (%s) min %d max %d\n",
73 i, m->syncpt[i].name, min, max); 74 i, m->syncpt[i].name, min, max);
74 } 75 }
75 76
@@ -77,7 +78,7 @@ static void show_syncpts(struct host1x *m, struct output *o)
77 u32 base_val; 78 u32 base_val;
78 base_val = host1x_syncpt_load_wait_base(m->syncpt + i); 79 base_val = host1x_syncpt_load_wait_base(m->syncpt + i);
79 if (base_val) 80 if (base_val)
80 host1x_debug_output(o, "waitbase id %d val %d\n", i, 81 host1x_debug_output(o, "waitbase id %u val %d\n", i,
81 base_val); 82 base_val);
82 } 83 }
83 84
diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
index 136c3a9d4997..e3fd1f0694c6 100644
--- a/drivers/gpu/host1x/dev.h
+++ b/drivers/gpu/host1x/dev.h
@@ -90,13 +90,13 @@ struct host1x_intr_ops {
90}; 90};
91 91
92struct host1x_info { 92struct host1x_info {
93 int nb_channels; /* host1x: num channels supported */ 93 unsigned int nb_channels; /* host1x: number of channels supported */
94 int nb_pts; /* host1x: num syncpoints supported */ 94 unsigned int nb_pts; /* host1x: number of syncpoints supported */
95 int nb_bases; /* host1x: num syncpoints supported */ 95 unsigned int nb_bases; /* host1x: number of syncpoint bases supported */
96 int nb_mlocks; /* host1x: number of mlocks */ 96 unsigned int nb_mlocks; /* host1x: number of mlocks supported */
97 int (*init)(struct host1x *); /* initialize per SoC ops */ 97 int (*init)(struct host1x *host1x); /* initialize per SoC ops */
98 int sync_offset; 98 unsigned int sync_offset; /* offset of syncpoint registers */
99 u64 dma_mask; /* mask of addressable memory */ 99 u64 dma_mask; /* mask of addressable memory */
100}; 100};
101 101
102struct host1x { 102struct host1x {
diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c
index 305ea8f3382d..233246e1235a 100644
--- a/drivers/gpu/host1x/hw/cdma_hw.c
+++ b/drivers/gpu/host1x/hw/cdma_hw.c
@@ -41,7 +41,7 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
41{ 41{
42 struct host1x *host1x = cdma_to_host1x(cdma); 42 struct host1x *host1x = cdma_to_host1x(cdma);
43 struct push_buffer *pb = &cdma->push_buffer; 43 struct push_buffer *pb = &cdma->push_buffer;
44 u32 i; 44 unsigned int i;
45 45
46 for (i = 0; i < syncpt_incrs; i++) 46 for (i = 0; i < syncpt_incrs; i++)
47 host1x_syncpt_incr(cdma->timeout.syncpt); 47 host1x_syncpt_incr(cdma->timeout.syncpt);
diff --git a/drivers/gpu/host1x/hw/debug_hw.c b/drivers/gpu/host1x/hw/debug_hw.c
index cc3f1825c735..81e94fef5e42 100644
--- a/drivers/gpu/host1x/hw/debug_hw.c
+++ b/drivers/gpu/host1x/hw/debug_hw.c
@@ -143,7 +143,8 @@ static void show_channel_gathers(struct output *o, struct host1x_cdma *cdma)
143 struct host1x_job *job; 143 struct host1x_job *job;
144 144
145 list_for_each_entry(job, &cdma->sync_queue, list) { 145 list_for_each_entry(job, &cdma->sync_queue, list) {
146 int i; 146 unsigned int i;
147
147 host1x_debug_output(o, "\n%p: JOB, syncpt_id=%d, syncpt_val=%d, first_get=%08x, timeout=%d num_slots=%d, num_handles=%d\n", 148 host1x_debug_output(o, "\n%p: JOB, syncpt_id=%d, syncpt_val=%d, first_get=%08x, timeout=%d num_slots=%d, num_handles=%d\n",
148 job, job->syncpt_id, job->syncpt_end, 149 job, job->syncpt_id, job->syncpt_end,
149 job->first_get, job->timeout, 150 job->first_get, job->timeout,
@@ -290,19 +291,19 @@ static void host1x_debug_show_channel_fifo(struct host1x *host,
290 291
291static void host1x_debug_show_mlocks(struct host1x *host, struct output *o) 292static void host1x_debug_show_mlocks(struct host1x *host, struct output *o)
292{ 293{
293 int i; 294 unsigned int i;
294 295
295 host1x_debug_output(o, "---- mlocks ----\n"); 296 host1x_debug_output(o, "---- mlocks ----\n");
296 for (i = 0; i < host1x_syncpt_nb_mlocks(host); i++) { 297 for (i = 0; i < host1x_syncpt_nb_mlocks(host); i++) {
297 u32 owner = 298 u32 owner =
298 host1x_sync_readl(host, HOST1X_SYNC_MLOCK_OWNER(i)); 299 host1x_sync_readl(host, HOST1X_SYNC_MLOCK_OWNER(i));
299 if (HOST1X_SYNC_MLOCK_OWNER_CH_OWNS_V(owner)) 300 if (HOST1X_SYNC_MLOCK_OWNER_CH_OWNS_V(owner))
300 host1x_debug_output(o, "%d: locked by channel %d\n", 301 host1x_debug_output(o, "%u: locked by channel %u\n",
301 i, HOST1X_SYNC_MLOCK_OWNER_CHID_V(owner)); 302 i, HOST1X_SYNC_MLOCK_OWNER_CHID_V(owner));
302 else if (HOST1X_SYNC_MLOCK_OWNER_CPU_OWNS_V(owner)) 303 else if (HOST1X_SYNC_MLOCK_OWNER_CPU_OWNS_V(owner))
303 host1x_debug_output(o, "%d: locked by cpu\n", i); 304 host1x_debug_output(o, "%u: locked by cpu\n", i);
304 else 305 else
305 host1x_debug_output(o, "%d: unlocked\n", i); 306 host1x_debug_output(o, "%u: unlocked\n", i);
306 } 307 }
307 host1x_debug_output(o, "\n"); 308 host1x_debug_output(o, "\n");
308} 309}
diff --git a/drivers/gpu/host1x/hw/intr_hw.c b/drivers/gpu/host1x/hw/intr_hw.c
index 10f81687b566..cf49d72fb172 100644
--- a/drivers/gpu/host1x/hw/intr_hw.c
+++ b/drivers/gpu/host1x/hw/intr_hw.c
@@ -45,7 +45,7 @@ static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id)
45{ 45{
46 struct host1x *host = dev_id; 46 struct host1x *host = dev_id;
47 unsigned long reg; 47 unsigned long reg;
48 int i, id; 48 unsigned int i, id;
49 49
50 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); i++) { 50 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); i++) {
51 reg = host1x_sync_readl(host, 51 reg = host1x_sync_readl(host,
@@ -62,7 +62,7 @@ static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id)
62 62
63static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host) 63static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host)
64{ 64{
65 u32 i; 65 unsigned int i;
66 66
67 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); ++i) { 67 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); ++i) {
68 host1x_sync_writel(host, 0xffffffffu, 68 host1x_sync_writel(host, 0xffffffffu,
@@ -75,7 +75,8 @@ static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host)
75static int _host1x_intr_init_host_sync(struct host1x *host, u32 cpm, 75static int _host1x_intr_init_host_sync(struct host1x *host, u32 cpm,
76 void (*syncpt_thresh_work)(struct work_struct *)) 76 void (*syncpt_thresh_work)(struct work_struct *))
77{ 77{
78 int i, err; 78 unsigned int i;
79 int err;
79 80
80 host1x_hw_intr_disable_all_syncpt_intrs(host); 81 host1x_hw_intr_disable_all_syncpt_intrs(host);
81 82
@@ -127,7 +128,7 @@ static void _host1x_intr_disable_syncpt_intr(struct host1x *host, u32 id)
127 128
128static int _host1x_free_syncpt_irq(struct host1x *host) 129static int _host1x_free_syncpt_irq(struct host1x *host)
129{ 130{
130 int i; 131 unsigned int i;
131 132
132 devm_free_irq(host->dev, host->intr_syncpt_irq, host); 133 devm_free_irq(host->dev, host->intr_syncpt_irq, host);
133 134
diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c
index 56e85395ac24..b60a4b97e4a8 100644
--- a/drivers/gpu/host1x/hw/syncpt_hw.c
+++ b/drivers/gpu/host1x/hw/syncpt_hw.c
@@ -26,8 +26,9 @@
26 */ 26 */
27static void syncpt_restore(struct host1x_syncpt *sp) 27static void syncpt_restore(struct host1x_syncpt *sp)
28{ 28{
29 u32 min = host1x_syncpt_read_min(sp);
29 struct host1x *host = sp->host; 30 struct host1x *host = sp->host;
30 int min = host1x_syncpt_read_min(sp); 31
31 host1x_sync_writel(host, min, HOST1X_SYNC_SYNCPT(sp->id)); 32 host1x_sync_writel(host, min, HOST1X_SYNC_SYNCPT(sp->id));
32} 33}
33 34
diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
index 6b7fdc1e2ed0..e2c499aa33e1 100644
--- a/drivers/gpu/host1x/syncpt.c
+++ b/drivers/gpu/host1x/syncpt.c
@@ -110,7 +110,7 @@ EXPORT_SYMBOL(host1x_syncpt_incr_max);
110void host1x_syncpt_restore(struct host1x *host) 110void host1x_syncpt_restore(struct host1x *host)
111{ 111{
112 struct host1x_syncpt *sp_base = host->syncpt; 112 struct host1x_syncpt *sp_base = host->syncpt;
113 u32 i; 113 unsigned int i;
114 114
115 for (i = 0; i < host1x_syncpt_nb_pts(host); i++) 115 for (i = 0; i < host1x_syncpt_nb_pts(host); i++)
116 host1x_hw_syncpt_restore(host, sp_base + i); 116 host1x_hw_syncpt_restore(host, sp_base + i);
@@ -126,7 +126,7 @@ void host1x_syncpt_restore(struct host1x *host)
126void host1x_syncpt_save(struct host1x *host) 126void host1x_syncpt_save(struct host1x *host)
127{ 127{
128 struct host1x_syncpt *sp_base = host->syncpt; 128 struct host1x_syncpt *sp_base = host->syncpt;
129 u32 i; 129 unsigned int i;
130 130
131 for (i = 0; i < host1x_syncpt_nb_pts(host); i++) { 131 for (i = 0; i < host1x_syncpt_nb_pts(host); i++) {
132 if (host1x_syncpt_client_managed(sp_base + i)) 132 if (host1x_syncpt_client_managed(sp_base + i))
@@ -341,7 +341,7 @@ int host1x_syncpt_init(struct host1x *host)
341{ 341{
342 struct host1x_syncpt_base *bases; 342 struct host1x_syncpt_base *bases;
343 struct host1x_syncpt *syncpt; 343 struct host1x_syncpt *syncpt;
344 int i; 344 unsigned int i;
345 345
346 syncpt = devm_kzalloc(host->dev, sizeof(*syncpt) * host->info->nb_pts, 346 syncpt = devm_kzalloc(host->dev, sizeof(*syncpt) * host->info->nb_pts,
347 GFP_KERNEL); 347 GFP_KERNEL);
@@ -398,8 +398,9 @@ EXPORT_SYMBOL(host1x_syncpt_free);
398 398
399void host1x_syncpt_deinit(struct host1x *host) 399void host1x_syncpt_deinit(struct host1x *host)
400{ 400{
401 int i;
402 struct host1x_syncpt *sp = host->syncpt; 401 struct host1x_syncpt *sp = host->syncpt;
402 unsigned int i;
403
403 for (i = 0; i < host->info->nb_pts; i++, sp++) 404 for (i = 0; i < host->info->nb_pts; i++, sp++)
404 kfree(sp->name); 405 kfree(sp->name);
405} 406}
@@ -431,17 +432,17 @@ u32 host1x_syncpt_read(struct host1x_syncpt *sp)
431} 432}
432EXPORT_SYMBOL(host1x_syncpt_read); 433EXPORT_SYMBOL(host1x_syncpt_read);
433 434
434int host1x_syncpt_nb_pts(struct host1x *host) 435unsigned int host1x_syncpt_nb_pts(struct host1x *host)
435{ 436{
436 return host->info->nb_pts; 437 return host->info->nb_pts;
437} 438}
438 439
439int host1x_syncpt_nb_bases(struct host1x *host) 440unsigned int host1x_syncpt_nb_bases(struct host1x *host)
440{ 441{
441 return host->info->nb_bases; 442 return host->info->nb_bases;
442} 443}
443 444
444int host1x_syncpt_nb_mlocks(struct host1x *host) 445unsigned int host1x_syncpt_nb_mlocks(struct host1x *host)
445{ 446{
446 return host->info->nb_mlocks; 447 return host->info->nb_mlocks;
447} 448}
diff --git a/drivers/gpu/host1x/syncpt.h b/drivers/gpu/host1x/syncpt.h
index 9056465ecd3f..6916feff0c29 100644
--- a/drivers/gpu/host1x/syncpt.h
+++ b/drivers/gpu/host1x/syncpt.h
@@ -58,13 +58,13 @@ int host1x_syncpt_init(struct host1x *host);
58void host1x_syncpt_deinit(struct host1x *host); 58void host1x_syncpt_deinit(struct host1x *host);
59 59
60/* Return number of sync point supported. */ 60/* Return number of sync point supported. */
61int host1x_syncpt_nb_pts(struct host1x *host); 61unsigned int host1x_syncpt_nb_pts(struct host1x *host);
62 62
63/* Return number of wait bases supported. */ 63/* Return number of wait bases supported. */
64int host1x_syncpt_nb_bases(struct host1x *host); 64unsigned int host1x_syncpt_nb_bases(struct host1x *host);
65 65
66/* Return number of mlocks supported. */ 66/* Return number of mlocks supported. */
67int host1x_syncpt_nb_mlocks(struct host1x *host); 67unsigned int host1x_syncpt_nb_mlocks(struct host1x *host);
68 68
69/* 69/*
70 * Check sync point sanity. If max is larger than min, there have too many 70 * Check sync point sanity. If max is larger than min, there have too many