All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915/gt: Return bool values from a boolean helper
@ 2026-06-26 21:52 Andi Shyti
  2026-06-26 21:55 ` sashiko-bot
  2026-06-27  4:58 ` Raag Jadav
  0 siblings, 2 replies; 3+ messages in thread
From: Andi Shyti @ 2026-06-26 21:52 UTC (permalink / raw)
  To: dri-devel, intel-gfx
  Cc: Jani Nikula, Raag Jadav, Andi Shyti, Andi Shyti,
	Sebastian Brzezinka

intel_has_gpu_reset() returns logically correct values by
returning a function pointer when GPU reset is supported and
NULL otherwise. However, as a boolean helper, it is more
appropriate to return explicit true or false values.

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Link: https://lore.kernel.org/r/20260625114442.2912230-1-andi.shyti@linux.intel.com
---
v1 -> v2
- don't use '!!' when returning function pointers. (Jani)

 drivers/gpu/drm/i915/gt/intel_reset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
index b2cf672564dd..6053f3e8aa27 100644
--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -797,7 +797,7 @@ static int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask
 bool intel_has_gpu_reset(const struct intel_gt *gt)
 {
 	if (!gt->i915->params.reset)
-		return NULL;
+		return false;
 
 	return intel_get_gpu_reset(gt);
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] drm/i915/gt: Return bool values from a boolean helper
  2026-06-26 21:52 [PATCH v2] drm/i915/gt: Return bool values from a boolean helper Andi Shyti
@ 2026-06-26 21:55 ` sashiko-bot
  2026-06-27  4:58 ` Raag Jadav
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-06-26 21:55 UTC (permalink / raw)
  To: Andi Shyti; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch fails to fully implement the explicit boolean returns claimed in the commit message.
--

commit 0d74cf5750ffd2182532ac4105376be52c64bca2
Author: Andi Shyti <andi.shyti@linux.intel.com>

drm/i915/gt: Return bool values from a boolean helper

This commit updates intel_has_gpu_reset() to return false instead of NULL
when GPU reset is disabled via parameters. The stated goal is to have the
boolean helper return explicit true or false values.

Link: https://lore.kernel.org/r/20260625114442.2912230-1-andi.shyti@linux.intel.com

> diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
> index b2cf672564dd9..6053f3e8aa27c 100644
> --- a/drivers/gpu/drm/i915/gt/intel_reset.c
> +++ b/drivers/gpu/drm/i915/gt/intel_reset.c
> @@ -797,7 +797,7 @@ static int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask
>  bool intel_has_gpu_reset(const struct intel_gt *gt)
>  {
>  	if (!gt->i915->params.reset)
> -		return NULL;
> +		return false;
>  
>  	return intel_get_gpu_reset(gt);

[Severity: Medium]
Does this fully achieve the goal stated in the commit message?

Looking at intel_has_gpu_reset() in drivers/gpu/drm/i915/gt/intel_reset.c,
intel_get_gpu_reset() returns a function pointer (reset_func).

By returning intel_get_gpu_reset(gt) directly, the code still relies on the C
compiler's implicit pointer-to-bool conversion.

Would it be better to return an explicit boolean value here as well, such as
!!intel_get_gpu_reset(gt) or intel_get_gpu_reset(gt) != NULL, to fully align
with the commit message's intent?

>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260626215232.861416-1-andi.shyti@linux.intel.com?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] drm/i915/gt: Return bool values from a boolean helper
  2026-06-26 21:52 [PATCH v2] drm/i915/gt: Return bool values from a boolean helper Andi Shyti
  2026-06-26 21:55 ` sashiko-bot
@ 2026-06-27  4:58 ` Raag Jadav
  1 sibling, 0 replies; 3+ messages in thread
From: Raag Jadav @ 2026-06-27  4:58 UTC (permalink / raw)
  To: Andi Shyti
  Cc: dri-devel, intel-gfx, Jani Nikula, Andi Shyti,
	Sebastian Brzezinka

On Fri, Jun 26, 2026 at 11:52:32PM +0200, Andi Shyti wrote:
> intel_has_gpu_reset() returns logically correct values by
> returning a function pointer when GPU reset is supported and
> NULL otherwise. However, as a boolean helper, it is more
> appropriate to return explicit true or false values.
> 
> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
> Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
> Link: https://lore.kernel.org/r/20260625114442.2912230-1-andi.shyti@linux.intel.com

Reviewed-by: Raag Jadav <raag.jadav@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-27  4:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 21:52 [PATCH v2] drm/i915/gt: Return bool values from a boolean helper Andi Shyti
2026-06-26 21:55 ` sashiko-bot
2026-06-27  4:58 ` Raag Jadav

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.