diff mbox series

[1/3] drm/i915/mocs: use to_gt() instead of direct &i915->gt

Message ID 63e644f056c7745eb0e8e165c990c392a38ec85c.1696236329.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: nuke i915->gt0 | expand

Commit Message

Jani Nikula Oct. 2, 2023, 8:47 a.m. UTC
Have to give up the const on i915 pointer, but it's not big of a deal
considering non-const i915 gets passed all over the place.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_mocs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Gustavo Sousa Oct. 2, 2023, 2:10 p.m. UTC | #1
Quoting Jani Nikula (2023-10-02 05:47:02-03:00)
>Have to give up the const on i915 pointer, but it's not big of a deal

What if patch #2 ("drm/i915: allocate i915->gt0 dynamically") was the first in
the series? I see it changes to_gt() to receive a const struct drm_i915_private
*i915.

Either way,

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>

>considering non-const i915 gets passed all over the place.
>
>Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>---
> drivers/gpu/drm/i915/gt/intel_mocs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/gt/intel_mocs.c b/drivers/gpu/drm/i915/gt/intel_mocs.c
>index 07269ff3be13..353f93baaca0 100644
>--- a/drivers/gpu/drm/i915/gt/intel_mocs.c
>+++ b/drivers/gpu/drm/i915/gt/intel_mocs.c
>@@ -487,7 +487,7 @@ static bool has_mocs(const struct drm_i915_private *i915)
>         return !IS_DGFX(i915);
> }
> 
>-static unsigned int get_mocs_settings(const struct drm_i915_private *i915,
>+static unsigned int get_mocs_settings(struct drm_i915_private *i915,
>                                       struct drm_i915_mocs_table *table)
> {
>         unsigned int flags;
>@@ -495,7 +495,7 @@ static unsigned int get_mocs_settings(const struct drm_i915_private *i915,
>         memset(table, 0, sizeof(struct drm_i915_mocs_table));
> 
>         table->unused_entries_index = I915_MOCS_PTE;
>-        if (IS_GFX_GT_IP_RANGE(&i915->gt0, IP_VER(12, 70), IP_VER(12, 71))) {
>+        if (IS_GFX_GT_IP_RANGE(to_gt(i915), IP_VER(12, 70), IP_VER(12, 71))) {
>                 table->size = ARRAY_SIZE(mtl_mocs_table);
>                 table->table = mtl_mocs_table;
>                 table->n_entries = MTL_NUM_MOCS_ENTRIES;
>-- 
>2.39.2
>
Andi Shyti Oct. 3, 2023, 6:26 a.m. UTC | #2
Hi Jani,

On Mon, Oct 02, 2023 at 11:47:02AM +0300, Jani Nikula wrote:
> Have to give up the const on i915 pointer, but it's not big of a deal
> considering non-const i915 gets passed all over the place.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Thanks,
Andi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_mocs.c b/drivers/gpu/drm/i915/gt/intel_mocs.c
index 07269ff3be13..353f93baaca0 100644
--- a/drivers/gpu/drm/i915/gt/intel_mocs.c
+++ b/drivers/gpu/drm/i915/gt/intel_mocs.c
@@ -487,7 +487,7 @@  static bool has_mocs(const struct drm_i915_private *i915)
 	return !IS_DGFX(i915);
 }
 
-static unsigned int get_mocs_settings(const struct drm_i915_private *i915,
+static unsigned int get_mocs_settings(struct drm_i915_private *i915,
 				      struct drm_i915_mocs_table *table)
 {
 	unsigned int flags;
@@ -495,7 +495,7 @@  static unsigned int get_mocs_settings(const struct drm_i915_private *i915,
 	memset(table, 0, sizeof(struct drm_i915_mocs_table));
 
 	table->unused_entries_index = I915_MOCS_PTE;
-	if (IS_GFX_GT_IP_RANGE(&i915->gt0, IP_VER(12, 70), IP_VER(12, 71))) {
+	if (IS_GFX_GT_IP_RANGE(to_gt(i915), IP_VER(12, 70), IP_VER(12, 71))) {
 		table->size = ARRAY_SIZE(mtl_mocs_table);
 		table->table = mtl_mocs_table;
 		table->n_entries = MTL_NUM_MOCS_ENTRIES;