diff mbox series

[3/7] gpu: host1x: Cleanup loop variable usage

Message ID 20180517153430.9602-4-thierry.reding@gmail.com
State Deferred
Headers show
Series gpu: host1x: Preparation work for destaging ABI | expand

Commit Message

Thierry Reding May 17, 2018, 3:34 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

Use unsigned int where possible and don't unnecessarily initialize the
loop variable.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/host1x/debug.c  | 2 +-
 drivers/gpu/host1x/intr.c   | 2 +-
 drivers/gpu/host1x/job.c    | 4 ++--
 drivers/gpu/host1x/syncpt.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

Comments

Dmitry Osipenko May 18, 2018, 1:36 p.m. UTC | #1
On 17.05.2018 18:34, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Use unsigned int where possible and don't unnecessarily initialize the
> loop variable.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/gpu/host1x/debug.c  | 2 +-
>  drivers/gpu/host1x/intr.c   | 2 +-
>  drivers/gpu/host1x/job.c    | 4 ++--
>  drivers/gpu/host1x/syncpt.c | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
> index dc77ec452ffc..329e4a3d8ae7 100644
> --- a/drivers/gpu/host1x/debug.c
> +++ b/drivers/gpu/host1x/debug.c
> @@ -103,7 +103,7 @@ static void show_syncpts(struct host1x *m, struct output *o)
>  
>  static void show_all(struct host1x *m, struct output *o, bool show_fifo)
>  {
> -	int i;
> +	unsigned int i;
>  
>  	host1x_hw_show_mlocks(m, o);
>  	show_syncpts(m, o);
> diff --git a/drivers/gpu/host1x/intr.c b/drivers/gpu/host1x/intr.c
> index 8b4fad0ab35d..6028cf7b681f 100644
> --- a/drivers/gpu/host1x/intr.c
> +++ b/drivers/gpu/host1x/intr.c
> @@ -144,7 +144,7 @@ static const action_handler action_handlers[HOST1X_INTR_ACTION_COUNT] = {
>  static void run_handlers(struct list_head completed[HOST1X_INTR_ACTION_COUNT])
>  {
>  	struct list_head *head = completed;
> -	int i;
> +	unsigned int i;
>  
>  	for (i = 0; i < HOST1X_INTR_ACTION_COUNT; ++i, ++head) {
>  		action_handler handler = action_handlers[i];
> diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
> index 3cbfc6e37668..2be0bcaf8288 100644
> --- a/drivers/gpu/host1x/job.c
> +++ b/drivers/gpu/host1x/job.c
> @@ -196,10 +196,10 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
>  
>  static int do_relocs(struct host1x_job *job, struct host1x_job_gather *g)
>  {
> -	int i = 0;
>  	u32 last_page = ~0;
>  	void *cmdbuf_page_addr = NULL;
>  	struct host1x_bo *cmdbuf = g->bo;
> +	unsigned int i;
>  
>  	/* pin & patch the relocs for one gather */
>  	for (i = 0; i < job->num_relocs; i++) {
> @@ -451,7 +451,7 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev)
>  	struct host1x_firewall fw;
>  	size_t size = 0;
>  	size_t offset = 0;
> -	int i;
> +	unsigned int i;
>  
>  	fw.job = job;
>  	fw.dev = dev;
> diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
> index a108669188e8..088c05dd884c 100644
> --- a/drivers/gpu/host1x/syncpt.c
> +++ b/drivers/gpu/host1x/syncpt.c
> @@ -57,8 +57,8 @@ static struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
>  						 struct host1x_client *client,
>  						 unsigned long flags)
>  {
> -	int i;
>  	struct host1x_syncpt *sp = host->syncpt;
> +	unsigned int i;
>  	char *name;
>  
>  	mutex_lock(&host->syncpt_mutex);
> 

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
index dc77ec452ffc..329e4a3d8ae7 100644
--- a/drivers/gpu/host1x/debug.c
+++ b/drivers/gpu/host1x/debug.c
@@ -103,7 +103,7 @@  static void show_syncpts(struct host1x *m, struct output *o)
 
 static void show_all(struct host1x *m, struct output *o, bool show_fifo)
 {
-	int i;
+	unsigned int i;
 
 	host1x_hw_show_mlocks(m, o);
 	show_syncpts(m, o);
diff --git a/drivers/gpu/host1x/intr.c b/drivers/gpu/host1x/intr.c
index 8b4fad0ab35d..6028cf7b681f 100644
--- a/drivers/gpu/host1x/intr.c
+++ b/drivers/gpu/host1x/intr.c
@@ -144,7 +144,7 @@  static const action_handler action_handlers[HOST1X_INTR_ACTION_COUNT] = {
 static void run_handlers(struct list_head completed[HOST1X_INTR_ACTION_COUNT])
 {
 	struct list_head *head = completed;
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < HOST1X_INTR_ACTION_COUNT; ++i, ++head) {
 		action_handler handler = action_handlers[i];
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index 3cbfc6e37668..2be0bcaf8288 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -196,10 +196,10 @@  static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
 
 static int do_relocs(struct host1x_job *job, struct host1x_job_gather *g)
 {
-	int i = 0;
 	u32 last_page = ~0;
 	void *cmdbuf_page_addr = NULL;
 	struct host1x_bo *cmdbuf = g->bo;
+	unsigned int i;
 
 	/* pin & patch the relocs for one gather */
 	for (i = 0; i < job->num_relocs; i++) {
@@ -451,7 +451,7 @@  static inline int copy_gathers(struct host1x_job *job, struct device *dev)
 	struct host1x_firewall fw;
 	size_t size = 0;
 	size_t offset = 0;
-	int i;
+	unsigned int i;
 
 	fw.job = job;
 	fw.dev = dev;
diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
index a108669188e8..088c05dd884c 100644
--- a/drivers/gpu/host1x/syncpt.c
+++ b/drivers/gpu/host1x/syncpt.c
@@ -57,8 +57,8 @@  static struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
 						 struct host1x_client *client,
 						 unsigned long flags)
 {
-	int i;
 	struct host1x_syncpt *sp = host->syncpt;
+	unsigned int i;
 	char *name;
 
 	mutex_lock(&host->syncpt_mutex);