All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Unnecessary code in gfx_v7_0.c
@ 2022-04-05 21:37 ` Grigory Vasilyev
  0 siblings, 0 replies; 7+ messages in thread
From: Grigory Vasilyev @ 2022-04-05 21:37 UTC (permalink / raw)
  To: Rodrigo Siqueira, Melissa Wen
  Cc: Grigory Vasilyev, Alex Deucher, Christian König, Pan,
	Xinhui, David Airlie, Daniel Vetter, Guchun Chen,
	Joseph Greathouse, Bhaskar Chowdhury, Lee Jones, Evan Quan,
	amd-gfx, dri-devel, linux-kernel

The code is useless and doesn't change the value.

(0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT) = 0
gb_addr_config | 0 = gb_addr_config

Perhaps there could be 1 instead of 0, but this does not correspond with
the logic of the switch.

Signed-off-by: Grigory Vasilyev <h0tc0d3@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 1cb5db17d2b9..5ed84a6467ee 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -4409,16 +4409,14 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)
 	/* fix up row size */
 	gb_addr_config &= ~GB_ADDR_CONFIG__ROW_SIZE_MASK;
 	switch (adev->gfx.config.mem_row_size_in_kb) {
-	case 1:
-	default:
-		gb_addr_config |= (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
-		break;
 	case 2:
 		gb_addr_config |= (1 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
 		break;
 	case 4:
 		gb_addr_config |= (2 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
 		break;
+	default:
+		break;
 	}
 	adev->gfx.config.gb_addr_config = gb_addr_config;
 }
-- 
2.35.1


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

* [PATCH] drm/amdgpu: Unnecessary code in gfx_v7_0.c
@ 2022-04-05 21:37 ` Grigory Vasilyev
  0 siblings, 0 replies; 7+ messages in thread
From: Grigory Vasilyev @ 2022-04-05 21:37 UTC (permalink / raw)
  To: Rodrigo Siqueira, Melissa Wen
  Cc: Bhaskar Chowdhury, Joseph Greathouse, Guchun Chen,
	Grigory Vasilyev, Pan, Xinhui, linux-kernel, amd-gfx,
	David Airlie, dri-devel, Alex Deucher, Evan Quan, Lee Jones,
	Christian König

The code is useless and doesn't change the value.

(0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT) = 0
gb_addr_config | 0 = gb_addr_config

Perhaps there could be 1 instead of 0, but this does not correspond with
the logic of the switch.

Signed-off-by: Grigory Vasilyev <h0tc0d3@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 1cb5db17d2b9..5ed84a6467ee 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -4409,16 +4409,14 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)
 	/* fix up row size */
 	gb_addr_config &= ~GB_ADDR_CONFIG__ROW_SIZE_MASK;
 	switch (adev->gfx.config.mem_row_size_in_kb) {
-	case 1:
-	default:
-		gb_addr_config |= (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
-		break;
 	case 2:
 		gb_addr_config |= (1 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
 		break;
 	case 4:
 		gb_addr_config |= (2 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
 		break;
+	default:
+		break;
 	}
 	adev->gfx.config.gb_addr_config = gb_addr_config;
 }
-- 
2.35.1


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

* [PATCH] drm/amdgpu: Unnecessary code in gfx_v7_0.c
@ 2022-04-05 21:37 ` Grigory Vasilyev
  0 siblings, 0 replies; 7+ messages in thread
From: Grigory Vasilyev @ 2022-04-05 21:37 UTC (permalink / raw)
  To: Rodrigo Siqueira, Melissa Wen
  Cc: Bhaskar Chowdhury, Joseph Greathouse, Guchun Chen,
	Grigory Vasilyev, Pan, Xinhui, linux-kernel, amd-gfx,
	David Airlie, dri-devel, Daniel Vetter, Alex Deucher, Evan Quan,
	Lee Jones, Christian König

The code is useless and doesn't change the value.

(0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT) = 0
gb_addr_config | 0 = gb_addr_config

Perhaps there could be 1 instead of 0, but this does not correspond with
the logic of the switch.

Signed-off-by: Grigory Vasilyev <h0tc0d3@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 1cb5db17d2b9..5ed84a6467ee 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -4409,16 +4409,14 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)
 	/* fix up row size */
 	gb_addr_config &= ~GB_ADDR_CONFIG__ROW_SIZE_MASK;
 	switch (adev->gfx.config.mem_row_size_in_kb) {
-	case 1:
-	default:
-		gb_addr_config |= (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
-		break;
 	case 2:
 		gb_addr_config |= (1 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
 		break;
 	case 4:
 		gb_addr_config |= (2 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
 		break;
+	default:
+		break;
 	}
 	adev->gfx.config.gb_addr_config = gb_addr_config;
 }
-- 
2.35.1


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

* Re: [PATCH] drm/amdgpu: Unnecessary code in gfx_v7_0.c
  2022-04-05 21:37 ` Grigory Vasilyev
@ 2022-04-06 13:19   ` Alex Deucher
  -1 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2022-04-06 13:19 UTC (permalink / raw)
  To: Grigory Vasilyev
  Cc: Bhaskar Chowdhury, Guchun Chen, David Airlie, Pan, Xinhui,
	Rodrigo Siqueira, LKML, amd-gfx list, Melissa Wen,
	Maling list - DRI developers, Joseph Greathouse, Alex Deucher,
	Evan Quan, Lee Jones, Christian König

On Wed, Apr 6, 2022 at 4:00 AM Grigory Vasilyev <h0tc0d3@gmail.com> wrote:
>
> The code is useless and doesn't change the value.
>
> (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT) = 0
> gb_addr_config | 0 = gb_addr_config
>
> Perhaps there could be 1 instead of 0, but this does not correspond with
> the logic of the switch.

It doesn't do anything, but it helps the developer to understand how
the driver state maps to hardware state.

Alex

>
> Signed-off-by: Grigory Vasilyev <h0tc0d3@gmail.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> index 1cb5db17d2b9..5ed84a6467ee 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> @@ -4409,16 +4409,14 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)
>         /* fix up row size */
>         gb_addr_config &= ~GB_ADDR_CONFIG__ROW_SIZE_MASK;
>         switch (adev->gfx.config.mem_row_size_in_kb) {
> -       case 1:
> -       default:
> -               gb_addr_config |= (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
> -               break;
>         case 2:
>                 gb_addr_config |= (1 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
>                 break;
>         case 4:
>                 gb_addr_config |= (2 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
>                 break;
> +       default:
> +               break;
>         }
>         adev->gfx.config.gb_addr_config = gb_addr_config;
>  }
> --
> 2.35.1
>

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

* Re: [PATCH] drm/amdgpu: Unnecessary code in gfx_v7_0.c
@ 2022-04-06 13:19   ` Alex Deucher
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2022-04-06 13:19 UTC (permalink / raw)
  To: Grigory Vasilyev
  Cc: Rodrigo Siqueira, Melissa Wen, Bhaskar Chowdhury,
	Joseph Greathouse, Guchun Chen, Pan, Xinhui, LKML, amd-gfx list,
	David Airlie, Maling list - DRI developers, Alex Deucher,
	Evan Quan, Lee Jones, Christian König

On Wed, Apr 6, 2022 at 4:00 AM Grigory Vasilyev <h0tc0d3@gmail.com> wrote:
>
> The code is useless and doesn't change the value.
>
> (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT) = 0
> gb_addr_config | 0 = gb_addr_config
>
> Perhaps there could be 1 instead of 0, but this does not correspond with
> the logic of the switch.

It doesn't do anything, but it helps the developer to understand how
the driver state maps to hardware state.

Alex

>
> Signed-off-by: Grigory Vasilyev <h0tc0d3@gmail.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> index 1cb5db17d2b9..5ed84a6467ee 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> @@ -4409,16 +4409,14 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)
>         /* fix up row size */
>         gb_addr_config &= ~GB_ADDR_CONFIG__ROW_SIZE_MASK;
>         switch (adev->gfx.config.mem_row_size_in_kb) {
> -       case 1:
> -       default:
> -               gb_addr_config |= (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
> -               break;
>         case 2:
>                 gb_addr_config |= (1 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
>                 break;
>         case 4:
>                 gb_addr_config |= (2 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
>                 break;
> +       default:
> +               break;
>         }
>         adev->gfx.config.gb_addr_config = gb_addr_config;
>  }
> --
> 2.35.1
>

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

* Re: [PATCH] drm/amdgpu: Unnecessary code in gfx_v7_0.c
  2022-04-06 13:19   ` Alex Deucher
@ 2022-04-06 13:39     ` Григорий
  -1 siblings, 0 replies; 7+ messages in thread
From: Григорий @ 2022-04-06 13:39 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Bhaskar Chowdhury, Guchun Chen, David Airlie, Pan, Xinhui,
	Rodrigo Siqueira, LKML, amd-gfx list, Melissa Wen,
	Maling list - DRI developers, Joseph Greathouse, Alex Deucher,
	Evan Quan, Lee Jones, Christian König

Alex Deucher, Thanks, that's what I thought too. But this code is
uninformative, and without it is clear what this code is doing. If you
need to provide additional information on how the code works, then for
me it's better to leave a comment.
This is actually more like a bug than an explanation of what the code is doing.

ср, 6 апр. 2022 г. в 16:20, Alex Deucher <alexdeucher@gmail.com>:
>
> On Wed, Apr 6, 2022 at 4:00 AM Grigory Vasilyev <h0tc0d3@gmail.com> wrote:
> >
> > The code is useless and doesn't change the value.
> >
> > (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT) = 0
> > gb_addr_config | 0 = gb_addr_config
> >
> > Perhaps there could be 1 instead of 0, but this does not correspond with
> > the logic of the switch.
>
> It doesn't do anything, but it helps the developer to understand how
> the driver state maps to hardware state.
>
> Alex
>
> >
> > Signed-off-by: Grigory Vasilyev <h0tc0d3@gmail.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > index 1cb5db17d2b9..5ed84a6467ee 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > @@ -4409,16 +4409,14 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)
> >         /* fix up row size */
> >         gb_addr_config &= ~GB_ADDR_CONFIG__ROW_SIZE_MASK;
> >         switch (adev->gfx.config.mem_row_size_in_kb) {
> > -       case 1:
> > -       default:
> > -               gb_addr_config |= (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
> > -               break;
> >         case 2:
> >                 gb_addr_config |= (1 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
> >                 break;
> >         case 4:
> >                 gb_addr_config |= (2 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
> >                 break;
> > +       default:
> > +               break;
> >         }
> >         adev->gfx.config.gb_addr_config = gb_addr_config;
> >  }
> > --
> > 2.35.1
> >

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

* Re: [PATCH] drm/amdgpu: Unnecessary code in gfx_v7_0.c
@ 2022-04-06 13:39     ` Григорий
  0 siblings, 0 replies; 7+ messages in thread
From: Григорий @ 2022-04-06 13:39 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Rodrigo Siqueira, Melissa Wen, Bhaskar Chowdhury,
	Joseph Greathouse, Guchun Chen, Pan, Xinhui, LKML, amd-gfx list,
	David Airlie, Maling list - DRI developers, Alex Deucher,
	Evan Quan, Lee Jones, Christian König

Alex Deucher, Thanks, that's what I thought too. But this code is
uninformative, and without it is clear what this code is doing. If you
need to provide additional information on how the code works, then for
me it's better to leave a comment.
This is actually more like a bug than an explanation of what the code is doing.

ср, 6 апр. 2022 г. в 16:20, Alex Deucher <alexdeucher@gmail.com>:
>
> On Wed, Apr 6, 2022 at 4:00 AM Grigory Vasilyev <h0tc0d3@gmail.com> wrote:
> >
> > The code is useless and doesn't change the value.
> >
> > (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT) = 0
> > gb_addr_config | 0 = gb_addr_config
> >
> > Perhaps there could be 1 instead of 0, but this does not correspond with
> > the logic of the switch.
>
> It doesn't do anything, but it helps the developer to understand how
> the driver state maps to hardware state.
>
> Alex
>
> >
> > Signed-off-by: Grigory Vasilyev <h0tc0d3@gmail.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > index 1cb5db17d2b9..5ed84a6467ee 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > @@ -4409,16 +4409,14 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)
> >         /* fix up row size */
> >         gb_addr_config &= ~GB_ADDR_CONFIG__ROW_SIZE_MASK;
> >         switch (adev->gfx.config.mem_row_size_in_kb) {
> > -       case 1:
> > -       default:
> > -               gb_addr_config |= (0 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
> > -               break;
> >         case 2:
> >                 gb_addr_config |= (1 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
> >                 break;
> >         case 4:
> >                 gb_addr_config |= (2 << GB_ADDR_CONFIG__ROW_SIZE__SHIFT);
> >                 break;
> > +       default:
> > +               break;
> >         }
> >         adev->gfx.config.gb_addr_config = gb_addr_config;
> >  }
> > --
> > 2.35.1
> >

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

end of thread, other threads:[~2022-04-07  7:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 21:37 [PATCH] drm/amdgpu: Unnecessary code in gfx_v7_0.c Grigory Vasilyev
2022-04-05 21:37 ` Grigory Vasilyev
2022-04-05 21:37 ` Grigory Vasilyev
2022-04-06 13:19 ` Alex Deucher
2022-04-06 13:19   ` Alex Deucher
2022-04-06 13:39   ` Григорий
2022-04-06 13:39     ` Григорий

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.