]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
gpu: host1x: Consistently use unsigned int for counts
authorThierry Reding <treding@nvidia.com>
Wed, 22 Jun 2016 14:44:07 +0000 (16:44 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 23 Jun 2016 09:59:23 +0000 (11:59 +0200)
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>
drivers/gpu/host1x/channel.c
drivers/gpu/host1x/debug.c
drivers/gpu/host1x/dev.h
drivers/gpu/host1x/hw/cdma_hw.c
drivers/gpu/host1x/hw/debug_hw.c
drivers/gpu/host1x/hw/intr_hw.c
drivers/gpu/host1x/hw/syncpt_hw.c
drivers/gpu/host1x/syncpt.c
drivers/gpu/host1x/syncpt.h

index b4ae3affb987bb92ed7dcd1f3317714b260fd61d..78f0ef0f6c89bdb1a658e6d44271ffccd48d6d45 100644 (file)
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(host1x_channel_put);
 struct host1x_channel *host1x_channel_request(struct device *dev)
 {
        struct host1x *host = dev_get_drvdata(dev->parent);
-       int max_channels = host->info->nb_channels;
+       unsigned int max_channels = host->info->nb_channels;
        struct host1x_channel *channel = NULL;
        int index, err;
 
index ee3d12b51c50a036b89c48c3e60576a2a14acf5b..797f8f048117ddc3814a6a26a914a21ac1229e5c 100644 (file)
@@ -62,14 +62,15 @@ static int show_channels(struct host1x_channel *ch, void *data, bool show_fifo)
 
 static void show_syncpts(struct host1x *m, struct output *o)
 {
-       int i;
+       unsigned int i;
        host1x_debug_output(o, "---- syncpts ----\n");
        for (i = 0; i < host1x_syncpt_nb_pts(m); i++) {
                u32 max = host1x_syncpt_read_max(m->syncpt + i);
                u32 min = host1x_syncpt_load(m->syncpt + i);
                if (!min && !max)
                        continue;
-               host1x_debug_output(o, "id %d (%s) min %d max %d\n",
+
+               host1x_debug_output(o, "id %u (%s) min %d max %d\n",
                                    i, m->syncpt[i].name, min, max);
        }
 
@@ -77,7 +78,7 @@ static void show_syncpts(struct host1x *m, struct output *o)
                u32 base_val;
                base_val = host1x_syncpt_load_wait_base(m->syncpt + i);
                if (base_val)
-                       host1x_debug_output(o, "waitbase id %d val %d\n", i,
+                       host1x_debug_output(o, "waitbase id %u val %d\n", i,
                                            base_val);
        }
 
index 136c3a9d4997630aa48cc96061c0cd8e02b4b936..e3fd1f0694c678507749531aa4ca4648587b442f 100644 (file)
@@ -90,13 +90,13 @@ struct host1x_intr_ops {
 };
 
 struct host1x_info {
-       int     nb_channels;            /* host1x: num channels supported */
-       int     nb_pts;                 /* host1x: num syncpoints supported */
-       int     nb_bases;               /* host1x: num syncpoints supported */
-       int     nb_mlocks;              /* host1x: number of mlocks */
-       int     (*init)(struct host1x *); /* initialize per SoC ops */
-       int     sync_offset;
-       u64     dma_mask;               /* mask of addressable memory */
+       unsigned int nb_channels; /* host1x: number of channels supported */
+       unsigned int nb_pts; /* host1x: number of syncpoints supported */
+       unsigned int nb_bases; /* host1x: number of syncpoint bases supported */
+       unsigned int nb_mlocks; /* host1x: number of mlocks supported */
+       int (*init)(struct host1x *host1x); /* initialize per SoC ops */
+       unsigned int sync_offset; /* offset of syncpoint registers */
+       u64 dma_mask; /* mask of addressable memory */
 };
 
 struct host1x {
index 305ea8f3382d22da2611e6de7025695265d97699..233246e1235ab8eb616889e9f540d0611540603f 100644 (file)
@@ -41,7 +41,7 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
 {
        struct host1x *host1x = cdma_to_host1x(cdma);
        struct push_buffer *pb = &cdma->push_buffer;
-       u32 i;
+       unsigned int i;
 
        for (i = 0; i < syncpt_incrs; i++)
                host1x_syncpt_incr(cdma->timeout.syncpt);
index cc3f1825c735e5cf10aad66ff72c11003bc15737..81e94fef5e428a60eb3f633ffb852557bff39e47 100644 (file)
@@ -143,7 +143,8 @@ static void show_channel_gathers(struct output *o, struct host1x_cdma *cdma)
        struct host1x_job *job;
 
        list_for_each_entry(job, &cdma->sync_queue, list) {
-               int i;
+               unsigned int i;
+
                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",
                                    job, job->syncpt_id, job->syncpt_end,
                                    job->first_get, job->timeout,
@@ -290,19 +291,19 @@ static void host1x_debug_show_channel_fifo(struct host1x *host,
 
 static void host1x_debug_show_mlocks(struct host1x *host, struct output *o)
 {
-       int i;
+       unsigned int i;
 
        host1x_debug_output(o, "---- mlocks ----\n");
        for (i = 0; i < host1x_syncpt_nb_mlocks(host); i++) {
                u32 owner =
                        host1x_sync_readl(host, HOST1X_SYNC_MLOCK_OWNER(i));
                if (HOST1X_SYNC_MLOCK_OWNER_CH_OWNS_V(owner))
-                       host1x_debug_output(o, "%d: locked by channel %d\n",
+                       host1x_debug_output(o, "%u: locked by channel %u\n",
                                i, HOST1X_SYNC_MLOCK_OWNER_CHID_V(owner));
                else if (HOST1X_SYNC_MLOCK_OWNER_CPU_OWNS_V(owner))
-                       host1x_debug_output(o, "%d: locked by cpu\n", i);
+                       host1x_debug_output(o, "%u: locked by cpu\n", i);
                else
-                       host1x_debug_output(o, "%d: unlocked\n", i);
+                       host1x_debug_output(o, "%u: unlocked\n", i);
        }
        host1x_debug_output(o, "\n");
 }
index 10f81687b566ae31ef8ebd44a3f0b88b406c5a97..cf49d72fb1720753a2321445346c0b3ea784e448 100644 (file)
@@ -45,7 +45,7 @@ static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id)
 {
        struct host1x *host = dev_id;
        unsigned long reg;
-       int i, id;
+       unsigned int i, id;
 
        for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); i++) {
                reg = host1x_sync_readl(host,
@@ -62,7 +62,7 @@ static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id)
 
 static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host)
 {
-       u32 i;
+       unsigned int i;
 
        for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); ++i) {
                host1x_sync_writel(host, 0xffffffffu,
@@ -75,7 +75,8 @@ static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host)
 static int _host1x_intr_init_host_sync(struct host1x *host, u32 cpm,
        void (*syncpt_thresh_work)(struct work_struct *))
 {
-       int i, err;
+       unsigned int i;
+       int err;
 
        host1x_hw_intr_disable_all_syncpt_intrs(host);
 
@@ -127,7 +128,7 @@ static void _host1x_intr_disable_syncpt_intr(struct host1x *host, u32 id)
 
 static int _host1x_free_syncpt_irq(struct host1x *host)
 {
-       int i;
+       unsigned int i;
 
        devm_free_irq(host->dev, host->intr_syncpt_irq, host);
 
index 56e85395ac24112faf17b4b06a1aa950e671df0b..b60a4b97e4a84cda7d257ccdb127c29ac6326ea0 100644 (file)
@@ -26,8 +26,9 @@
  */
 static void syncpt_restore(struct host1x_syncpt *sp)
 {
+       u32 min = host1x_syncpt_read_min(sp);
        struct host1x *host = sp->host;
-       int min = host1x_syncpt_read_min(sp);
+
        host1x_sync_writel(host, min, HOST1X_SYNC_SYNCPT(sp->id));
 }
 
index 6b7fdc1e2ed078c337c8fa235633fcc105c4ccde..e2c499aa33e1d88d7e5e246f44a28ea71ca22487 100644 (file)
@@ -110,7 +110,7 @@ EXPORT_SYMBOL(host1x_syncpt_incr_max);
 void host1x_syncpt_restore(struct host1x *host)
 {
        struct host1x_syncpt *sp_base = host->syncpt;
-       u32 i;
+       unsigned int i;
 
        for (i = 0; i < host1x_syncpt_nb_pts(host); i++)
                host1x_hw_syncpt_restore(host, sp_base + i);
@@ -126,7 +126,7 @@ void host1x_syncpt_restore(struct host1x *host)
 void host1x_syncpt_save(struct host1x *host)
 {
        struct host1x_syncpt *sp_base = host->syncpt;
-       u32 i;
+       unsigned int i;
 
        for (i = 0; i < host1x_syncpt_nb_pts(host); i++) {
                if (host1x_syncpt_client_managed(sp_base + i))
@@ -341,7 +341,7 @@ int host1x_syncpt_init(struct host1x *host)
 {
        struct host1x_syncpt_base *bases;
        struct host1x_syncpt *syncpt;
-       int i;
+       unsigned int i;
 
        syncpt = devm_kzalloc(host->dev, sizeof(*syncpt) * host->info->nb_pts,
                              GFP_KERNEL);
@@ -398,8 +398,9 @@ EXPORT_SYMBOL(host1x_syncpt_free);
 
 void host1x_syncpt_deinit(struct host1x *host)
 {
-       int i;
        struct host1x_syncpt *sp = host->syncpt;
+       unsigned int i;
+
        for (i = 0; i < host->info->nb_pts; i++, sp++)
                kfree(sp->name);
 }
@@ -431,17 +432,17 @@ u32 host1x_syncpt_read(struct host1x_syncpt *sp)
 }
 EXPORT_SYMBOL(host1x_syncpt_read);
 
-int host1x_syncpt_nb_pts(struct host1x *host)
+unsigned int host1x_syncpt_nb_pts(struct host1x *host)
 {
        return host->info->nb_pts;
 }
 
-int host1x_syncpt_nb_bases(struct host1x *host)
+unsigned int host1x_syncpt_nb_bases(struct host1x *host)
 {
        return host->info->nb_bases;
 }
 
-int host1x_syncpt_nb_mlocks(struct host1x *host)
+unsigned int host1x_syncpt_nb_mlocks(struct host1x *host)
 {
        return host->info->nb_mlocks;
 }
index 9056465ecd3f1ea88963c397b6f2fdd0ae5f407a..6916feff0c294c11398c43f8e69a86ea7106fe3f 100644 (file)
@@ -58,13 +58,13 @@ int host1x_syncpt_init(struct host1x *host);
 void host1x_syncpt_deinit(struct host1x *host);
 
 /* Return number of sync point supported. */
-int host1x_syncpt_nb_pts(struct host1x *host);
+unsigned int host1x_syncpt_nb_pts(struct host1x *host);
 
 /* Return number of wait bases supported. */
-int host1x_syncpt_nb_bases(struct host1x *host);
+unsigned int host1x_syncpt_nb_bases(struct host1x *host);
 
 /* Return number of mlocks supported. */
-int host1x_syncpt_nb_mlocks(struct host1x *host);
+unsigned int host1x_syncpt_nb_mlocks(struct host1x *host);
 
 /*
  * Check sync point sanity. If max is larger than min, there have too many