Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+37 -32
+1 -1
drivers/gpu/host1x/channel.c
··· 83 83 struct host1x_channel *host1x_channel_request(struct device *dev) 84 84 { 85 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 87 struct host1x_channel *channel = NULL; 88 88 int index, err; 89 89
+4 -3
drivers/gpu/host1x/debug.c
··· 62 62 63 63 static void show_syncpts(struct host1x *m, struct output *o) 64 64 { 65 - int i; 65 + unsigned int i; 66 66 host1x_debug_output(o, "---- syncpts ----\n"); 67 67 for (i = 0; i < host1x_syncpt_nb_pts(m); i++) { 68 68 u32 max = host1x_syncpt_read_max(m->syncpt + i); 69 69 u32 min = host1x_syncpt_load(m->syncpt + i); 70 70 if (!min && !max) 71 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 74 i, m->syncpt[i].name, min, max); 74 75 } 75 76 ··· 78 77 u32 base_val; 79 78 base_val = host1x_syncpt_load_wait_base(m->syncpt + i); 80 79 if (base_val) 81 - host1x_debug_output(o, "waitbase id %d val %d\n", i, 80 + host1x_debug_output(o, "waitbase id %u val %d\n", i, 82 81 base_val); 83 82 } 84 83
+7 -7
drivers/gpu/host1x/dev.h
··· 90 90 }; 91 91 92 92 struct host1x_info { 93 - int nb_channels; /* host1x: num channels supported */ 94 - int nb_pts; /* host1x: num syncpoints supported */ 95 - int nb_bases; /* host1x: num syncpoints supported */ 96 - int nb_mlocks; /* host1x: number of mlocks */ 97 - int (*init)(struct host1x *); /* initialize per SoC ops */ 98 - int sync_offset; 99 - u64 dma_mask; /* mask of addressable memory */ 93 + unsigned int nb_channels; /* host1x: number of channels supported */ 94 + unsigned int nb_pts; /* host1x: number of syncpoints supported */ 95 + unsigned int nb_bases; /* host1x: number of syncpoint bases supported */ 96 + unsigned int nb_mlocks; /* host1x: number of mlocks supported */ 97 + int (*init)(struct host1x *host1x); /* initialize per SoC ops */ 98 + unsigned int sync_offset; /* offset of syncpoint registers */ 99 + u64 dma_mask; /* mask of addressable memory */ 100 100 }; 101 101 102 102 struct host1x {
+1 -1
drivers/gpu/host1x/hw/cdma_hw.c
··· 41 41 { 42 42 struct host1x *host1x = cdma_to_host1x(cdma); 43 43 struct push_buffer *pb = &cdma->push_buffer; 44 - u32 i; 44 + unsigned int i; 45 45 46 46 for (i = 0; i < syncpt_incrs; i++) 47 47 host1x_syncpt_incr(cdma->timeout.syncpt);
+6 -5
drivers/gpu/host1x/hw/debug_hw.c
··· 143 143 struct host1x_job *job; 144 144 145 145 list_for_each_entry(job, &cdma->sync_queue, list) { 146 - int i; 146 + unsigned int i; 147 + 147 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 149 job, job->syncpt_id, job->syncpt_end, 149 150 job->first_get, job->timeout, ··· 291 290 292 291 static void host1x_debug_show_mlocks(struct host1x *host, struct output *o) 293 292 { 294 - int i; 293 + unsigned int i; 295 294 296 295 host1x_debug_output(o, "---- mlocks ----\n"); 297 296 for (i = 0; i < host1x_syncpt_nb_mlocks(host); i++) { 298 297 u32 owner = 299 298 host1x_sync_readl(host, HOST1X_SYNC_MLOCK_OWNER(i)); 300 299 if (HOST1X_SYNC_MLOCK_OWNER_CH_OWNS_V(owner)) 301 - host1x_debug_output(o, "%d: locked by channel %d\n", 300 + host1x_debug_output(o, "%u: locked by channel %u\n", 302 301 i, HOST1X_SYNC_MLOCK_OWNER_CHID_V(owner)); 303 302 else if (HOST1X_SYNC_MLOCK_OWNER_CPU_OWNS_V(owner)) 304 - host1x_debug_output(o, "%d: locked by cpu\n", i); 303 + host1x_debug_output(o, "%u: locked by cpu\n", i); 305 304 else 306 - host1x_debug_output(o, "%d: unlocked\n", i); 305 + host1x_debug_output(o, "%u: unlocked\n", i); 307 306 } 308 307 host1x_debug_output(o, "\n"); 309 308 }
+5 -4
drivers/gpu/host1x/hw/intr_hw.c
··· 45 45 { 46 46 struct host1x *host = dev_id; 47 47 unsigned long reg; 48 - int i, id; 48 + unsigned int i, id; 49 49 50 50 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); i++) { 51 51 reg = host1x_sync_readl(host, ··· 62 62 63 63 static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host) 64 64 { 65 - u32 i; 65 + unsigned int i; 66 66 67 67 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); ++i) { 68 68 host1x_sync_writel(host, 0xffffffffu, ··· 75 75 static int _host1x_intr_init_host_sync(struct host1x *host, u32 cpm, 76 76 void (*syncpt_thresh_work)(struct work_struct *)) 77 77 { 78 - int i, err; 78 + unsigned int i; 79 + int err; 79 80 80 81 host1x_hw_intr_disable_all_syncpt_intrs(host); 81 82 ··· 128 127 129 128 static int _host1x_free_syncpt_irq(struct host1x *host) 130 129 { 131 - int i; 130 + unsigned int i; 132 131 133 132 devm_free_irq(host->dev, host->intr_syncpt_irq, host); 134 133
+2 -1
drivers/gpu/host1x/hw/syncpt_hw.c
··· 26 26 */ 27 27 static void syncpt_restore(struct host1x_syncpt *sp) 28 28 { 29 + u32 min = host1x_syncpt_read_min(sp); 29 30 struct host1x *host = sp->host; 30 - int min = host1x_syncpt_read_min(sp); 31 + 31 32 host1x_sync_writel(host, min, HOST1X_SYNC_SYNCPT(sp->id)); 32 33 } 33 34
+8 -7
drivers/gpu/host1x/syncpt.c
··· 110 110 void host1x_syncpt_restore(struct host1x *host) 111 111 { 112 112 struct host1x_syncpt *sp_base = host->syncpt; 113 - u32 i; 113 + unsigned int i; 114 114 115 115 for (i = 0; i < host1x_syncpt_nb_pts(host); i++) 116 116 host1x_hw_syncpt_restore(host, sp_base + i); ··· 126 126 void host1x_syncpt_save(struct host1x *host) 127 127 { 128 128 struct host1x_syncpt *sp_base = host->syncpt; 129 - u32 i; 129 + unsigned int i; 130 130 131 131 for (i = 0; i < host1x_syncpt_nb_pts(host); i++) { 132 132 if (host1x_syncpt_client_managed(sp_base + i)) ··· 341 341 { 342 342 struct host1x_syncpt_base *bases; 343 343 struct host1x_syncpt *syncpt; 344 - int i; 344 + unsigned int i; 345 345 346 346 syncpt = devm_kzalloc(host->dev, sizeof(*syncpt) * host->info->nb_pts, 347 347 GFP_KERNEL); ··· 398 398 399 399 void host1x_syncpt_deinit(struct host1x *host) 400 400 { 401 - int i; 402 401 struct host1x_syncpt *sp = host->syncpt; 402 + unsigned int i; 403 + 403 404 for (i = 0; i < host->info->nb_pts; i++, sp++) 404 405 kfree(sp->name); 405 406 } ··· 432 431 } 433 432 EXPORT_SYMBOL(host1x_syncpt_read); 434 433 435 - int host1x_syncpt_nb_pts(struct host1x *host) 434 + unsigned int host1x_syncpt_nb_pts(struct host1x *host) 436 435 { 437 436 return host->info->nb_pts; 438 437 } 439 438 440 - int host1x_syncpt_nb_bases(struct host1x *host) 439 + unsigned int host1x_syncpt_nb_bases(struct host1x *host) 441 440 { 442 441 return host->info->nb_bases; 443 442 } 444 443 445 - int host1x_syncpt_nb_mlocks(struct host1x *host) 444 + unsigned int host1x_syncpt_nb_mlocks(struct host1x *host) 446 445 { 447 446 return host->info->nb_mlocks; 448 447 }
+3 -3
drivers/gpu/host1x/syncpt.h
··· 58 58 void host1x_syncpt_deinit(struct host1x *host); 59 59 60 60 /* Return number of sync point supported. */ 61 - int host1x_syncpt_nb_pts(struct host1x *host); 61 + unsigned int host1x_syncpt_nb_pts(struct host1x *host); 62 62 63 63 /* Return number of wait bases supported. */ 64 - int host1x_syncpt_nb_bases(struct host1x *host); 64 + unsigned int host1x_syncpt_nb_bases(struct host1x *host); 65 65 66 66 /* Return number of mlocks supported. */ 67 - int host1x_syncpt_nb_mlocks(struct host1x *host); 67 + unsigned int host1x_syncpt_nb_mlocks(struct host1x *host); 68 68 69 69 /* 70 70 * Check sync point sanity. If max is larger than min, there have too many