Skip to contentSkip to conversation

bnx2x: Define bnx2x_tests_str_arr as const

PATCH In review Merav Sicron 3 participants 4 messages Jun 27, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bnx2x: Define bnx2x_tests_str_arr as const

This patch changes the definition of bnx2x_tests_str_arr from static char to static const char.

---
Hi Dave,

Please consider applying this patch to net-next.

Thanks,
Merav

 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +1 -1
index bff3129..81cadb6 100644
@@ -1600,7 +1600,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
 	return 0;
 }
 
-static char *bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF] = {
+static const char *bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF] = {
 	"register_test (offline)    ",
 	"memory_test (offline)      ",
 	"int_loopback_test (offline)",
Signature · 1 line
1.7.10
#1 lore raw

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c static int bnx2x_set_pauseparam(struct net_device *dev, · line 1606

Quoted 6 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +1 -1
-static char *bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF] = {
+static const char *bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF] = {
 	"register_test (offline)    ",
 	"memory_test (offline)      ",
 	"int_loopback_test (offline)",

You are still missing a 'const'.
You probably want:
static const char *const bnx2x_tests_str_arr[] ...

However if you are going to pad the strings to [28]
you might as well remove the layer of indirection - ie:
static const char bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF][28] = { ...
}
Or pad to 32 chars to (probably) remove some code bytes.

David

#2 lore raw
Quoted 10 lines · David Laight

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c static int bnx2x_set_pauseparam(struct net_device *dev, · line 1606

Quoted 5 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +1 -1
-static char *bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF] = {
+static const char *bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF] = {
 	"register_test (offline)    ",
 	"memory_test (offline)      ",
 	"int_loopback_test (offline)",

You are still missing a 'const'.
You probably want:
static const char *const bnx2x_tests_str_arr[] ...

Quoted 8 lines

However if you are going to pad the strings to [28]
you might as well remove the layer of indirection - ie:
static const char bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF][28] = { ...
}
Or pad to 32 chars to (probably) remove some code bytes.

David

Thanks David, let me think about it.
Dave, please ignore this patch for now.
Thanks,
Merav