diff mbox

drm/i915: Use execlists_num_ports instead of size of array

Message ID 20171010114857.13108-1-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Oct. 10, 2017, 11:48 a.m. UTC
There is function to tell how many ports we have, so use it.
We still have direct relationship with array size and port count,
so no harm was done.

Fixes: 76e70087d360 ("drm/i915: Make execlist port count variable")
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 2 +-
 drivers/gpu/drm/i915/intel_lrc.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Chris Wilson Oct. 10, 2017, 12:09 p.m. UTC | #1
Quoting Mika Kuoppala (2017-10-10 12:48:57)
> There is function to tell how many ports we have, so use it.
> We still have direct relationship with array size and port count,
> so no harm was done.
> 
> Fixes: 76e70087d360 ("drm/i915: Make execlist port count variable")
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>

I had a sweepstake on how long that ARRAY_SIZE would last.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Joonas Lahtinen Oct. 10, 2017, 12:59 p.m. UTC | #2
On Tue, 2017-10-10 at 14:48 +0300, Mika Kuoppala wrote:
> There is function to tell how many ports we have, so use it.
> We still have direct relationship with array size and port count,
> so no harm was done.
> 
> Fixes: 76e70087d360 ("drm/i915: Make execlist port count variable")
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>

<SNIP>

> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> @@ -500,7 +500,7 @@ static void i915_guc_submit(struct intel_engine_cs *engine)
>  	const unsigned int engine_id = engine->id;
>  	unsigned int n;
>  
> -	for (n = 0; n < ARRAY_SIZE(execlists->port); n++) {
> +	for (n = 0; n < execlists_num_ports(execlists); n++) {

For a while I was looking this delta in reverse and could not figure it
out.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
Mika Kuoppala Oct. 10, 2017, 1:42 p.m. UTC | #3
Joonas Lahtinen <joonas.lahtinen@linux.intel.com> writes:

> On Tue, 2017-10-10 at 14:48 +0300, Mika Kuoppala wrote:
>> There is function to tell how many ports we have, so use it.
>> We still have direct relationship with array size and port count,
>> so no harm was done.
>> 
>> Fixes: 76e70087d360 ("drm/i915: Make execlist port count variable")
>> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
>
> <SNIP>
>
>> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
>> @@ -500,7 +500,7 @@ static void i915_guc_submit(struct intel_engine_cs *engine)
>>  	const unsigned int engine_id = engine->id;
>>  	unsigned int n;
>>  
>> -	for (n = 0; n < ARRAY_SIZE(execlists->port); n++) {
>> +	for (n = 0; n < execlists_num_ports(execlists); n++) {
>
> For a while I was looking this delta in reverse and could not figure it
> out.
>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>

I think I messed atleast on one of these missing on the countless
rebases.

Thanks for reviews. Pushed.
-Mika
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 31381a327347..f15de4dcefde 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -500,7 +500,7 @@  static void i915_guc_submit(struct intel_engine_cs *engine)
 	const unsigned int engine_id = engine->id;
 	unsigned int n;
 
-	for (n = 0; n < ARRAY_SIZE(execlists->port); n++) {
+	for (n = 0; n < execlists_num_ports(execlists); n++) {
 		struct drm_i915_gem_request *rq;
 		unsigned int count;
 
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 721432ddf403..fbfcf88d7fe3 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -691,7 +691,7 @@  static void
 execlist_cancel_port_requests(struct intel_engine_execlists *execlists)
 {
 	struct execlist_port *port = execlists->port;
-	unsigned int num_ports = ARRAY_SIZE(execlists->port);
+	unsigned int num_ports = execlists_num_ports(execlists);
 
 	while (num_ports-- && port_isset(port)) {
 		struct drm_i915_gem_request *rq = port_request(port);