All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: make array encoded_lanes static
@ 2021-09-15 11:36 Colin King
  2021-09-15 15:18 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-09-15 11:36 UTC (permalink / raw)
  To: Alex Deucher, Christian König, Xinhui.Pan, David Airlie,
	Daniel Vetter, amd-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate the read-only array encoded_lanes on the stack but instead it
static. Also makes the object code smaller by 97 bytes:

Before:
   text    data    bss     dec    hex filename
  38899    8064      0   46963   b773 ./drivers/gpu/drm/radeon/r600_dpm.o

After:
   text    data    bss     dec    hex filename
  38738    8128      0   46866   b712 ./drivers/gpu/drm/radeon/r600_dpm.o

(gcc version 11.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/radeon/r600_dpm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
index fd4226b99862..9d2bcb9551e6 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -1361,7 +1361,9 @@ u16 r600_get_pcie_lane_support(struct radeon_device *rdev,
 
 u8 r600_encode_pci_lane_width(u32 lanes)
 {
-	u8 encoded_lanes[] = { 0, 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6 };
+	static const u8 encoded_lanes[] = {
+		0, 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6
+	};
 
 	if (lanes > 16)
 		return 0;
-- 
2.32.0


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

* Re: [PATCH] drm/radeon: make array encoded_lanes static
  2021-09-15 11:36 [PATCH] drm/radeon: make array encoded_lanes static Colin King
@ 2021-09-15 15:18 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2021-09-15 15:18 UTC (permalink / raw)
  To: Colin King
  Cc: Alex Deucher, Christian König, xinhui pan, David Airlie,
	Daniel Vetter, amd-gfx list, Maling list - DRI developers,
	kernel-janitors, LKML

On Wed, Sep 15, 2021 at 7:36 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Don't populate the read-only array encoded_lanes on the stack but instead it
> static. Also makes the object code smaller by 97 bytes:
>
> Before:
>    text    data    bss     dec    hex filename
>   38899    8064      0   46963   b773 ./drivers/gpu/drm/radeon/r600_dpm.o
>
> After:
>    text    data    bss     dec    hex filename
>   38738    8128      0   46866   b712 ./drivers/gpu/drm/radeon/r600_dpm.o
>
> (gcc version 11.2.0)
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/r600_dpm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
> index fd4226b99862..9d2bcb9551e6 100644
> --- a/drivers/gpu/drm/radeon/r600_dpm.c
> +++ b/drivers/gpu/drm/radeon/r600_dpm.c
> @@ -1361,7 +1361,9 @@ u16 r600_get_pcie_lane_support(struct radeon_device *rdev,
>
>  u8 r600_encode_pci_lane_width(u32 lanes)
>  {
> -       u8 encoded_lanes[] = { 0, 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6 };
> +       static const u8 encoded_lanes[] = {
> +               0, 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6
> +       };
>
>         if (lanes > 16)
>                 return 0;
> --
> 2.32.0
>

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

end of thread, other threads:[~2021-09-15 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 11:36 [PATCH] drm/radeon: make array encoded_lanes static Colin King
2021-09-15 15:18 ` Alex Deucher

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.