Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14c95fc8 authored by Thierry Reding's avatar Thierry Reding
Browse files

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: default avatarThierry Reding <treding@nvidia.com>
parent 57574bd7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(host1x_channel_put);
struct host1x_channel *host1x_channel_request(struct device *dev)
struct host1x_channel *host1x_channel_request(struct device *dev)
{
{
	struct host1x *host = dev_get_drvdata(dev->parent);
	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;
	struct host1x_channel *channel = NULL;
	int index, err;
	int index, err;


+4 −3
Original line number Original line Diff line number Diff line
@@ -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)
static void show_syncpts(struct host1x *m, struct output *o)
{
{
	int i;
	unsigned int i;
	host1x_debug_output(o, "---- syncpts ----\n");
	host1x_debug_output(o, "---- syncpts ----\n");
	for (i = 0; i < host1x_syncpt_nb_pts(m); i++) {
	for (i = 0; i < host1x_syncpt_nb_pts(m); i++) {
		u32 max = host1x_syncpt_read_max(m->syncpt + i);
		u32 max = host1x_syncpt_read_max(m->syncpt + i);
		u32 min = host1x_syncpt_load(m->syncpt + i);
		u32 min = host1x_syncpt_load(m->syncpt + i);
		if (!min && !max)
		if (!min && !max)
			continue;
			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);
				    i, m->syncpt[i].name, min, max);
	}
	}


@@ -77,7 +78,7 @@ static void show_syncpts(struct host1x *m, struct output *o)
		u32 base_val;
		u32 base_val;
		base_val = host1x_syncpt_load_wait_base(m->syncpt + i);
		base_val = host1x_syncpt_load_wait_base(m->syncpt + i);
		if (base_val)
		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);
					    base_val);
	}
	}


+7 −7
Original line number Original line Diff line number Diff line
@@ -90,12 +90,12 @@ struct host1x_intr_ops {
};
};


struct host1x_info {
struct host1x_info {
	int	nb_channels;		/* host1x: num channels supported */
	unsigned int nb_channels; /* host1x: number of channels supported */
	int	nb_pts;			/* host1x: num syncpoints supported */
	unsigned int nb_pts; /* host1x: number of syncpoints supported */
	int	nb_bases;		/* host1x: num syncpoints supported */
	unsigned int nb_bases; /* host1x: number of syncpoint bases supported */
	int	nb_mlocks;		/* host1x: number of mlocks */
	unsigned int nb_mlocks; /* host1x: number of mlocks supported */
	int	(*init)(struct host1x *); /* initialize per SoC ops */
	int (*init)(struct host1x *host1x); /* initialize per SoC ops */
	int	sync_offset;
	unsigned int sync_offset; /* offset of syncpoint registers */
	u64 dma_mask; /* mask of addressable memory */
	u64 dma_mask; /* mask of addressable memory */
};
};


+1 −1
Original line number Original line Diff line number Diff line
@@ -41,7 +41,7 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
{
{
	struct host1x *host1x = cdma_to_host1x(cdma);
	struct host1x *host1x = cdma_to_host1x(cdma);
	struct push_buffer *pb = &cdma->push_buffer;
	struct push_buffer *pb = &cdma->push_buffer;
	u32 i;
	unsigned int i;


	for (i = 0; i < syncpt_incrs; i++)
	for (i = 0; i < syncpt_incrs; i++)
		host1x_syncpt_incr(cdma->timeout.syncpt);
		host1x_syncpt_incr(cdma->timeout.syncpt);
+6 −5
Original line number Original line Diff line number Diff line
@@ -143,7 +143,8 @@ static void show_channel_gathers(struct output *o, struct host1x_cdma *cdma)
	struct host1x_job *job;
	struct host1x_job *job;


	list_for_each_entry(job, &cdma->sync_queue, list) {
	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",
		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, job->syncpt_id, job->syncpt_end,
				    job->first_get, job->timeout,
				    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)
static void host1x_debug_show_mlocks(struct host1x *host, struct output *o)
{
{
	int i;
	unsigned int i;


	host1x_debug_output(o, "---- mlocks ----\n");
	host1x_debug_output(o, "---- mlocks ----\n");
	for (i = 0; i < host1x_syncpt_nb_mlocks(host); i++) {
	for (i = 0; i < host1x_syncpt_nb_mlocks(host); i++) {
		u32 owner =
		u32 owner =
			host1x_sync_readl(host, HOST1X_SYNC_MLOCK_OWNER(i));
			host1x_sync_readl(host, HOST1X_SYNC_MLOCK_OWNER(i));
		if (HOST1X_SYNC_MLOCK_OWNER_CH_OWNS_V(owner))
		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));
				i, HOST1X_SYNC_MLOCK_OWNER_CHID_V(owner));
		else if (HOST1X_SYNC_MLOCK_OWNER_CPU_OWNS_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
		else
			host1x_debug_output(o, "%d: unlocked\n", i);
			host1x_debug_output(o, "%u: unlocked\n", i);
	}
	}
	host1x_debug_output(o, "\n");
	host1x_debug_output(o, "\n");
}
}
Loading