2018-02-27 22:08:19

by Hernán Gonzalez

[permalink] [raw]
Subject: [PATCH 1/2] IB/qib: Remove unused variable (char *qib_sdma_event_names[])

Note: This is compile only tested as I have no access to the hw.

This variable was not used anywhere in the code. Removing it saves 88 bytes.

add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-88 (-88)
Function old new delta
qib_sdma_event_names 88 - -88
Total: Before=2874565, After=2874477, chg -0.00%

Signed-off-by: Hernán Gonzalez <[email protected]>
---
drivers/infiniband/hw/qib/qib.h | 1 -
drivers/infiniband/hw/qib/qib_sdma.c | 14 --------------
2 files changed, 15 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
index 0235f76b..b709ebd 100644
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
@@ -473,7 +473,6 @@ enum qib_sdma_events {
};

extern char *qib_sdma_state_names[];
-extern char *qib_sdma_event_names[];

struct sdma_set_state_action {
unsigned op_enable:1;
diff --git a/drivers/infiniband/hw/qib/qib_sdma.c b/drivers/infiniband/hw/qib/qib_sdma.c
index c3690bd..1f2d7a0 100644
--- a/drivers/infiniband/hw/qib/qib_sdma.c
+++ b/drivers/infiniband/hw/qib/qib_sdma.c
@@ -64,20 +64,6 @@ char *qib_sdma_state_names[] = {
[qib_sdma_state_s99_running] = "s99_Running",
};

-char *qib_sdma_event_names[] = {
- [qib_sdma_event_e00_go_hw_down] = "e00_GoHwDown",
- [qib_sdma_event_e10_go_hw_start] = "e10_GoHwStart",
- [qib_sdma_event_e20_hw_started] = "e20_HwStarted",
- [qib_sdma_event_e30_go_running] = "e30_GoRunning",
- [qib_sdma_event_e40_sw_cleaned] = "e40_SwCleaned",
- [qib_sdma_event_e50_hw_cleaned] = "e50_HwCleaned",
- [qib_sdma_event_e60_hw_halted] = "e60_HwHalted",
- [qib_sdma_event_e70_go_idle] = "e70_GoIdle",
- [qib_sdma_event_e7220_err_halted] = "e7220_ErrHalted",
- [qib_sdma_event_e7322_err_halted] = "e7322_ErrHalted",
- [qib_sdma_event_e90_timer_tick] = "e90_TimerTick",
-};
-
/* declare all statics here rather than keep sorting */
static int alloc_sdma(struct qib_pportdata *);
static void sdma_complete(struct kref *);
--
2.7.4



2018-02-27 22:07:12

by Hernán Gonzalez

[permalink] [raw]
Subject: [PATCH 2/2] IB/qib: Move char *qib_sdma_state_names[] and constify while there.

Note: This is compile only tested as I have no access to the hw.
This variable was not used in qib_sdma.c but in qib_iba7322.c. Declaring it
there, as static, saves 56 bytes.

add/remove: 0/2 grow/shrink: 0/0 up/down: 0/-144 (-144)
Function old new delta
qib_sdma_state_names 56 - -56
qib_sdma_event_names 88 - -88
Total: Before=2874565, After=2874421, chg -0.01%

Signed-off-by: Hernán Gonzalez <[email protected]>
---
drivers/infiniband/hw/qib/qib.h | 2 --
drivers/infiniband/hw/qib/qib_iba7322.c | 10 ++++++++++
drivers/infiniband/hw/qib/qib_sdma.c | 10 ----------
3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
index b709ebd..4607245 100644
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
@@ -472,8 +472,6 @@ enum qib_sdma_events {
qib_sdma_event_e90_timer_tick,
};

-extern char *qib_sdma_state_names[];
-
struct sdma_set_state_action {
unsigned op_enable:1;
unsigned op_intenable:1;
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
index 6265dac..8414ae4 100644
--- a/drivers/infiniband/hw/qib/qib_iba7322.c
+++ b/drivers/infiniband/hw/qib/qib_iba7322.c
@@ -463,6 +463,16 @@ static u8 ib_rate_to_delay[IB_RATE_120_GBPS + 1] = {
[IB_RATE_40_GBPS] = 1
};

+static const char * const qib_sdma_state_names[] = {
+ [qib_sdma_state_s00_hw_down] = "s00_HwDown",
+ [qib_sdma_state_s10_hw_start_up_wait] = "s10_HwStartUpWait",
+ [qib_sdma_state_s20_idle] = "s20_Idle",
+ [qib_sdma_state_s30_sw_clean_up_wait] = "s30_SwCleanUpWait",
+ [qib_sdma_state_s40_hw_clean_up_wait] = "s40_HwCleanUpWait",
+ [qib_sdma_state_s50_hw_halt_wait] = "s50_HwHaltWait",
+ [qib_sdma_state_s99_running] = "s99_Running",
+};
+
#define IBA7322_LINKSPEED_SHIFT SYM_LSB(IBCStatusA_0, LinkSpeedActive)
#define IBA7322_LINKWIDTH_SHIFT SYM_LSB(IBCStatusA_0, LinkWidthActive)

diff --git a/drivers/infiniband/hw/qib/qib_sdma.c b/drivers/infiniband/hw/qib/qib_sdma.c
index 1f2d7a0..d0723d4 100644
--- a/drivers/infiniband/hw/qib/qib_sdma.c
+++ b/drivers/infiniband/hw/qib/qib_sdma.c
@@ -54,16 +54,6 @@ MODULE_PARM_DESC(sdma_descq_cnt, "Number of SDMA descq entries");
#define SDMA_DESC_COUNT_LSB 16
#define SDMA_DESC_GEN_LSB 30

-char *qib_sdma_state_names[] = {
- [qib_sdma_state_s00_hw_down] = "s00_HwDown",
- [qib_sdma_state_s10_hw_start_up_wait] = "s10_HwStartUpWait",
- [qib_sdma_state_s20_idle] = "s20_Idle",
- [qib_sdma_state_s30_sw_clean_up_wait] = "s30_SwCleanUpWait",
- [qib_sdma_state_s40_hw_clean_up_wait] = "s40_HwCleanUpWait",
- [qib_sdma_state_s50_hw_halt_wait] = "s50_HwHaltWait",
- [qib_sdma_state_s99_running] = "s99_Running",
-};
-
/* declare all statics here rather than keep sorting */
static int alloc_sdma(struct qib_pportdata *);
static void sdma_complete(struct kref *);
--
2.7.4


2018-02-28 21:17:57

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH 1/2] IB/qib: Remove unused variable (char *qib_sdma_event_names[])

On Tue, Feb 27, 2018 at 07:05:42PM -0300, Hernán Gonzalez wrote:
> Note: This is compile only tested as I have no access to the hw.
>
> This variable was not used anywhere in the code. Removing it saves 88 bytes.
>
> add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-88 (-88)
> Function old new delta
> qib_sdma_event_names 88 - -88
> Total: Before=2874565, After=2874477, chg -0.00%
>
> Signed-off-by: Hernán Gonzalez <[email protected]>
> drivers/infiniband/hw/qib/qib.h | 1 -
> drivers/infiniband/hw/qib/qib_sdma.c | 14 --------------
> 2 files changed, 15 deletions(-)

Applied the series to for-next, thanks

Jason

2018-03-03 15:32:46

by Dennis Dalessandro

[permalink] [raw]
Subject: Re: [PATCH 2/2] IB/qib: Move char *qib_sdma_state_names[] and constify while there.

On 2/27/2018 5:05 PM, Hernán Gonzalez wrote:
> Note: This is compile only tested as I have no access to the hw.
> This variable was not used in qib_sdma.c but in qib_iba7322.c. Declaring it
> there, as static, saves 56 bytes.
>
> add/remove: 0/2 grow/shrink: 0/0 up/down: 0/-144 (-144)
> Function old new delta
> qib_sdma_state_names 56 - -56
> qib_sdma_event_names 88 - -88
> Total: Before=2874565, After=2874421, chg -0.01%
>
> Signed-off-by: Hernán Gonzalez <[email protected]>

Looks OK to me, thanks.

Reviewed-by: Dennis Dalessandro <[email protected]>