aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2009-11-07 06:53:52 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-10 23:28:50 -0500
commit34336ec032878d1a32e7df881f16ce2145e53f83 (patch)
tree72fb084316a285f16ffd1a87c7e9e7e803c38c32 /drivers/net/cxgb3
parent45229b420f90bb6736dfeb7e491eb46cb02a3e9c (diff)
cxgb3: declare MODULE_FIRMWARE
Replace run-time string formatting with preprocessor string manipulation. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Acked-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r--drivers/net/cxgb3/common.h8
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c25
2 files changed, 19 insertions, 14 deletions
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 1b2c305fb82b..6ff356d4c7ab 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -125,11 +125,9 @@ enum { /* adapter interrupt-maintained statistics */
125 IRQ_NUM_STATS /* keep last */ 125 IRQ_NUM_STATS /* keep last */
126}; 126};
127 127
128enum { 128#define TP_VERSION_MAJOR 1
129 TP_VERSION_MAJOR = 1, 129#define TP_VERSION_MINOR 1
130 TP_VERSION_MINOR = 1, 130#define TP_VERSION_MICRO 0
131 TP_VERSION_MICRO = 0
132};
133 131
134#define S_TP_VERSION_MAJOR 16 132#define S_TP_VERSION_MAJOR 16
135#define M_TP_VERSION_MAJOR 0xFF 133#define M_TP_VERSION_MAJOR 0xFF
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index c9113d3297ee..b1a5a00a78cd 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -44,6 +44,7 @@
44#include <linux/rtnetlink.h> 44#include <linux/rtnetlink.h>
45#include <linux/firmware.h> 45#include <linux/firmware.h>
46#include <linux/log2.h> 46#include <linux/log2.h>
47#include <linux/stringify.h>
47#include <asm/uaccess.h> 48#include <asm/uaccess.h>
48 49
49#include "common.h" 50#include "common.h"
@@ -992,11 +993,21 @@ static int bind_qsets(struct adapter *adap)
992 return err; 993 return err;
993} 994}
994 995
995#define FW_FNAME "cxgb3/t3fw-%d.%d.%d.bin" 996#define FW_VERSION __stringify(FW_VERSION_MAJOR) "." \
996#define TPSRAM_NAME "cxgb3/t3%c_psram-%d.%d.%d.bin" 997 __stringify(FW_VERSION_MINOR) "." __stringify(FW_VERSION_MICRO)
998#define FW_FNAME "cxgb3/t3fw-" FW_VERSION ".bin"
999#define TPSRAM_VERSION __stringify(TP_VERSION_MAJOR) "." \
1000 __stringify(TP_VERSION_MINOR) "." __stringify(TP_VERSION_MICRO)
1001#define TPSRAM_NAME "cxgb3/t3%c_psram-" TPSRAM_VERSION ".bin"
997#define AEL2005_OPT_EDC_NAME "cxgb3/ael2005_opt_edc.bin" 1002#define AEL2005_OPT_EDC_NAME "cxgb3/ael2005_opt_edc.bin"
998#define AEL2005_TWX_EDC_NAME "cxgb3/ael2005_twx_edc.bin" 1003#define AEL2005_TWX_EDC_NAME "cxgb3/ael2005_twx_edc.bin"
999#define AEL2020_TWX_EDC_NAME "cxgb3/ael2020_twx_edc.bin" 1004#define AEL2020_TWX_EDC_NAME "cxgb3/ael2020_twx_edc.bin"
1005MODULE_FIRMWARE(FW_FNAME);
1006MODULE_FIRMWARE("cxgb3/t3b_psram-" TPSRAM_VERSION ".bin");
1007MODULE_FIRMWARE("cxgb3/t3c_psram-" TPSRAM_VERSION ".bin");
1008MODULE_FIRMWARE(AEL2005_OPT_EDC_NAME);
1009MODULE_FIRMWARE(AEL2005_TWX_EDC_NAME);
1010MODULE_FIRMWARE(AEL2020_TWX_EDC_NAME);
1000 1011
1001static inline const char *get_edc_fw_name(int edc_idx) 1012static inline const char *get_edc_fw_name(int edc_idx)
1002{ 1013{
@@ -1067,16 +1078,13 @@ int t3_get_edc_fw(struct cphy *phy, int edc_idx, int size)
1067static int upgrade_fw(struct adapter *adap) 1078static int upgrade_fw(struct adapter *adap)
1068{ 1079{
1069 int ret; 1080 int ret;
1070 char buf[64];
1071 const struct firmware *fw; 1081 const struct firmware *fw;
1072 struct device *dev = &adap->pdev->dev; 1082 struct device *dev = &adap->pdev->dev;
1073 1083
1074 snprintf(buf, sizeof(buf), FW_FNAME, FW_VERSION_MAJOR, 1084 ret = request_firmware(&fw, FW_FNAME, dev);
1075 FW_VERSION_MINOR, FW_VERSION_MICRO);
1076 ret = request_firmware(&fw, buf, dev);
1077 if (ret < 0) { 1085 if (ret < 0) {
1078 dev_err(dev, "could not upgrade firmware: unable to load %s\n", 1086 dev_err(dev, "could not upgrade firmware: unable to load %s\n",
1079 buf); 1087 FW_FNAME);
1080 return ret; 1088 return ret;
1081 } 1089 }
1082 ret = t3_load_fw(adap, fw->data, fw->size); 1090 ret = t3_load_fw(adap, fw->data, fw->size);
@@ -1120,8 +1128,7 @@ static int update_tpsram(struct adapter *adap)
1120 if (!rev) 1128 if (!rev)
1121 return 0; 1129 return 0;
1122 1130
1123 snprintf(buf, sizeof(buf), TPSRAM_NAME, rev, 1131 snprintf(buf, sizeof(buf), TPSRAM_NAME, rev);
1124 TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
1125 1132
1126 ret = request_firmware(&tpsram, buf, dev); 1133 ret = request_firmware(&tpsram, buf, dev);
1127 if (ret < 0) { 1134 if (ret < 0) {