diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2009-11-19 02:29:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-19 02:29:57 -0500 |
commit | 0e4817470be8d233fb58b5af7b938185dae94d67 (patch) | |
tree | 64b3d707b1f8b2225e59bf731bf9f54304215d33 /drivers/misc | |
parent | a0607fd3a25ba1848a63a0d925e36d914735ab47 (diff) |
iwmc3200top: revamp fw name handling
1. define macro for handling firmware api version
2. add MODULE_FIRMWARE
3. cleanup iwmct_fw_load style
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/iwmc3200top/fw-download.c | 24 | ||||
-rw-r--r-- | drivers/misc/iwmc3200top/iwmc3200top.h | 3 | ||||
-rw-r--r-- | drivers/misc/iwmc3200top/main.c | 1 |
3 files changed, 14 insertions, 14 deletions
diff --git a/drivers/misc/iwmc3200top/fw-download.c b/drivers/misc/iwmc3200top/fw-download.c index 33cb693dd37c..50d431e469f5 100644 --- a/drivers/misc/iwmc3200top/fw-download.c +++ b/drivers/misc/iwmc3200top/fw-download.c | |||
@@ -291,35 +291,31 @@ static int iwmct_kick_fw(struct iwmct_priv *priv, bool jump) | |||
291 | 291 | ||
292 | int iwmct_fw_load(struct iwmct_priv *priv) | 292 | int iwmct_fw_load(struct iwmct_priv *priv) |
293 | { | 293 | { |
294 | const struct firmware *raw = NULL; | 294 | const u8 *fw_name = FW_NAME(FW_API_VER); |
295 | __le32 addr; | 295 | const struct firmware *raw; |
296 | size_t len; | ||
297 | const u8 *pdata; | 296 | const u8 *pdata; |
298 | const u8 *name = "iwmc3200top.1.fw"; | 297 | size_t len; |
299 | int ret = 0; | 298 | __le32 addr; |
299 | int ret; | ||
300 | 300 | ||
301 | /* clear parser struct */ | 301 | /* clear parser struct */ |
302 | memset(&priv->parser, 0, sizeof(struct iwmct_parser)); | 302 | memset(&priv->parser, 0, sizeof(struct iwmct_parser)); |
303 | if (!name) { | ||
304 | ret = -EINVAL; | ||
305 | goto exit; | ||
306 | } | ||
307 | 303 | ||
308 | /* get the firmware */ | 304 | /* get the firmware */ |
309 | ret = request_firmware(&raw, name, &priv->func->dev); | 305 | ret = request_firmware(&raw, fw_name, &priv->func->dev); |
310 | if (ret < 0) { | 306 | if (ret < 0) { |
311 | LOG_ERROR(priv, FW_DOWNLOAD, "%s request_firmware failed %d\n", | 307 | LOG_ERROR(priv, FW_DOWNLOAD, "%s request_firmware failed %d\n", |
312 | name, ret); | 308 | fw_name, ret); |
313 | goto exit; | 309 | goto exit; |
314 | } | 310 | } |
315 | 311 | ||
316 | if (raw->size < sizeof(struct iwmct_fw_sec_hdr)) { | 312 | if (raw->size < sizeof(struct iwmct_fw_sec_hdr)) { |
317 | LOG_ERROR(priv, FW_DOWNLOAD, "%s smaller then (%zd) (%zd)\n", | 313 | LOG_ERROR(priv, FW_DOWNLOAD, "%s smaller then (%zd) (%zd)\n", |
318 | name, sizeof(struct iwmct_fw_sec_hdr), raw->size); | 314 | fw_name, sizeof(struct iwmct_fw_sec_hdr), raw->size); |
319 | goto exit; | 315 | goto exit; |
320 | } | 316 | } |
321 | 317 | ||
322 | LOG_INFO(priv, FW_DOWNLOAD, "Read firmware '%s'\n", name); | 318 | LOG_INFO(priv, FW_DOWNLOAD, "Read firmware '%s'\n", fw_name); |
323 | 319 | ||
324 | ret = iwmct_fw_parser_init(priv, raw->data, raw->size, priv->trans_len); | 320 | ret = iwmct_fw_parser_init(priv, raw->data, raw->size, priv->trans_len); |
325 | if (ret < 0) { | 321 | if (ret < 0) { |
@@ -339,7 +335,7 @@ int iwmct_fw_load(struct iwmct_priv *priv) | |||
339 | while (iwmct_parse_next_section(priv, &pdata, &len, &addr)) { | 335 | while (iwmct_parse_next_section(priv, &pdata, &len, &addr)) { |
340 | if (iwmct_download_section(priv, pdata, len, addr)) { | 336 | if (iwmct_download_section(priv, pdata, len, addr)) { |
341 | LOG_ERROR(priv, FW_DOWNLOAD, | 337 | LOG_ERROR(priv, FW_DOWNLOAD, |
342 | "%s download section failed\n", name); | 338 | "%s download section failed\n", fw_name); |
343 | ret = -EIO; | 339 | ret = -EIO; |
344 | goto exit; | 340 | goto exit; |
345 | } | 341 | } |
diff --git a/drivers/misc/iwmc3200top/iwmc3200top.h b/drivers/misc/iwmc3200top/iwmc3200top.h index f572fcf177a1..43bd510e1872 100644 --- a/drivers/misc/iwmc3200top/iwmc3200top.h +++ b/drivers/misc/iwmc3200top/iwmc3200top.h | |||
@@ -30,6 +30,9 @@ | |||
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
31 | 31 | ||
32 | #define DRV_NAME "iwmc3200top" | 32 | #define DRV_NAME "iwmc3200top" |
33 | #define FW_API_VER 1 | ||
34 | #define _FW_NAME(api) DRV_NAME "." #api ".fw" | ||
35 | #define FW_NAME(api) _FW_NAME(api) | ||
33 | 36 | ||
34 | #define IWMC_SDIO_BLK_SIZE 256 | 37 | #define IWMC_SDIO_BLK_SIZE 256 |
35 | #define IWMC_DEFAULT_TR_BLK 64 | 38 | #define IWMC_DEFAULT_TR_BLK 64 |
diff --git a/drivers/misc/iwmc3200top/main.c b/drivers/misc/iwmc3200top/main.c index 02b3dadc8abd..fafcaa481d74 100644 --- a/drivers/misc/iwmc3200top/main.c +++ b/drivers/misc/iwmc3200top/main.c | |||
@@ -47,6 +47,7 @@ MODULE_DESCRIPTION(DRIVER_DESCRIPTION); | |||
47 | MODULE_VERSION(DRIVER_VERSION); | 47 | MODULE_VERSION(DRIVER_VERSION); |
48 | MODULE_LICENSE("GPL"); | 48 | MODULE_LICENSE("GPL"); |
49 | MODULE_AUTHOR(DRIVER_COPYRIGHT); | 49 | MODULE_AUTHOR(DRIVER_COPYRIGHT); |
50 | MODULE_FIRMWARE(FW_NAME(FW_API_VER)); | ||
50 | 51 | ||
51 | /* | 52 | /* |
52 | * This workers main task is to wait for OP_OPR_ALIVE | 53 | * This workers main task is to wait for OP_OPR_ALIVE |