diff options
author | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2010-12-01 14:59:50 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2010-12-11 01:12:32 -0500 |
commit | 667445008db3f45a760c235d771be0c9671e59e5 (patch) | |
tree | 6b6fea62bfcfeb78a6deeb851b70c8eda0700c17 /drivers/net/ixgbe | |
parent | 19a0b67afd174c4db261d587b5c67704dcd53c17 (diff) |
Intel Wired LAN drivers: Use static const
Based on work by Joe Perches <joe@perches.com>
Using static const to decrease data and overall object size.
CC: Joe Perches <joe@perches.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: Emil Tantilov <emil.s.tantilov@intel.com>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index ef3f9105a05d..90a740d77e5d 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1157,7 +1157,7 @@ struct ixgbe_reg_test { | |||
1157 | #define TABLE64_TEST_HI 6 | 1157 | #define TABLE64_TEST_HI 6 |
1158 | 1158 | ||
1159 | /* default 82599 register test */ | 1159 | /* default 82599 register test */ |
1160 | static struct ixgbe_reg_test reg_test_82599[] = { | 1160 | static const struct ixgbe_reg_test reg_test_82599[] = { |
1161 | { IXGBE_FCRTL_82599(0), 1, PATTERN_TEST, 0x8007FFF0, 0x8007FFF0 }, | 1161 | { IXGBE_FCRTL_82599(0), 1, PATTERN_TEST, 0x8007FFF0, 0x8007FFF0 }, |
1162 | { IXGBE_FCRTH_82599(0), 1, PATTERN_TEST, 0x8007FFF0, 0x8007FFF0 }, | 1162 | { IXGBE_FCRTH_82599(0), 1, PATTERN_TEST, 0x8007FFF0, 0x8007FFF0 }, |
1163 | { IXGBE_PFCTOP, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, | 1163 | { IXGBE_PFCTOP, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
@@ -1181,7 +1181,7 @@ static struct ixgbe_reg_test reg_test_82599[] = { | |||
1181 | }; | 1181 | }; |
1182 | 1182 | ||
1183 | /* default 82598 register test */ | 1183 | /* default 82598 register test */ |
1184 | static struct ixgbe_reg_test reg_test_82598[] = { | 1184 | static const struct ixgbe_reg_test reg_test_82598[] = { |
1185 | { IXGBE_FCRTL(0), 1, PATTERN_TEST, 0x8007FFF0, 0x8007FFF0 }, | 1185 | { IXGBE_FCRTL(0), 1, PATTERN_TEST, 0x8007FFF0, 0x8007FFF0 }, |
1186 | { IXGBE_FCRTH(0), 1, PATTERN_TEST, 0x8007FFF0, 0x8007FFF0 }, | 1186 | { IXGBE_FCRTH(0), 1, PATTERN_TEST, 0x8007FFF0, 0x8007FFF0 }, |
1187 | { IXGBE_PFCTOP, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, | 1187 | { IXGBE_PFCTOP, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
@@ -1208,18 +1208,22 @@ static struct ixgbe_reg_test reg_test_82598[] = { | |||
1208 | { 0, 0, 0, 0 } | 1208 | { 0, 0, 0, 0 } |
1209 | }; | 1209 | }; |
1210 | 1210 | ||
1211 | static const u32 register_test_patterns[] = { | ||
1212 | 0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF | ||
1213 | }; | ||
1214 | |||
1211 | #define REG_PATTERN_TEST(R, M, W) \ | 1215 | #define REG_PATTERN_TEST(R, M, W) \ |
1212 | { \ | 1216 | { \ |
1213 | u32 pat, val, before; \ | 1217 | u32 pat, val, before; \ |
1214 | const u32 _test[] = {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \ | 1218 | for (pat = 0; pat < ARRAY_SIZE(register_test_patterns); pat++) { \ |
1215 | for (pat = 0; pat < ARRAY_SIZE(_test); pat++) { \ | ||
1216 | before = readl(adapter->hw.hw_addr + R); \ | 1219 | before = readl(adapter->hw.hw_addr + R); \ |
1217 | writel((_test[pat] & W), (adapter->hw.hw_addr + R)); \ | 1220 | writel((register_test_patterns[pat] & W), \ |
1221 | (adapter->hw.hw_addr + R)); \ | ||
1218 | val = readl(adapter->hw.hw_addr + R); \ | 1222 | val = readl(adapter->hw.hw_addr + R); \ |
1219 | if (val != (_test[pat] & W & M)) { \ | 1223 | if (val != (register_test_patterns[pat] & W & M)) { \ |
1220 | e_err(drv, "pattern test reg %04X failed: got " \ | 1224 | e_err(drv, "pattern test reg %04X failed: got " \ |
1221 | "0x%08X expected 0x%08X\n", \ | 1225 | "0x%08X expected 0x%08X\n", \ |
1222 | R, val, (_test[pat] & W & M)); \ | 1226 | R, val, (register_test_patterns[pat] & W & M)); \ |
1223 | *data = R; \ | 1227 | *data = R; \ |
1224 | writel(before, adapter->hw.hw_addr + R); \ | 1228 | writel(before, adapter->hw.hw_addr + R); \ |
1225 | return 1; \ | 1229 | return 1; \ |
@@ -1246,7 +1250,7 @@ static struct ixgbe_reg_test reg_test_82598[] = { | |||
1246 | 1250 | ||
1247 | static int ixgbe_reg_test(struct ixgbe_adapter *adapter, u64 *data) | 1251 | static int ixgbe_reg_test(struct ixgbe_adapter *adapter, u64 *data) |
1248 | { | 1252 | { |
1249 | struct ixgbe_reg_test *test; | 1253 | const struct ixgbe_reg_test *test; |
1250 | u32 value, before, after; | 1254 | u32 value, before, after; |
1251 | u32 i, toggle; | 1255 | u32 i, toggle; |
1252 | 1256 | ||