diff options
author | David Woodhouse <dwmw2@infradead.org> | 2008-05-29 17:17:17 +0300 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-07-10 14:47:51 +0100 |
commit | 79682499d9f3eaea4e6a970d8aa0b9bc1ac2a97f (patch) | |
tree | 16dd99c5e220af63e651f983a48b0ae49089695d /drivers/net/usb/kaweth.c | |
parent | 0f805b86c9492c294c710de8539a8be68b521a86 (diff) | |
download | blackbird-op-linux-79682499d9f3eaea4e6a970d8aa0b9bc1ac2a97f.tar.gz blackbird-op-linux-79682499d9f3eaea4e6a970d8aa0b9bc1ac2a97f.zip |
kaweth: use request_firmware()
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/net/usb/kaweth.c')
-rw-r--r-- | drivers/net/usb/kaweth.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 7c66b052f55a..d6829db51b45 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c @@ -57,13 +57,12 @@ #include <linux/ethtool.h> #include <linux/dma-mapping.h> #include <linux/wait.h> +#include <linux/firmware.h> #include <asm/uaccess.h> #include <asm/byteorder.h> #undef DEBUG -#include "kawethfw.h" - #define KAWETH_MTU 1514 #define KAWETH_BUF_SIZE 1664 #define KAWETH_TX_TIMEOUT (5 * HZ) @@ -108,6 +107,10 @@ MODULE_AUTHOR("Michael Zappe <zapman@interlan.net>, Stephane Alnet <stephane@u-picardie.fr>, Brad Hards <bhards@bigpond.net.au> and Oliver Neukum <oliver@neukum.org>"); MODULE_DESCRIPTION("KL5USB101 USB Ethernet driver"); MODULE_LICENSE("GPL"); +MODULE_FIRMWARE("kaweth/new_code.bin"); +MODULE_FIRMWARE("kaweth/new_code_fix.bin"); +MODULE_FIRMWARE("kaweth/trigger_code.bin"); +MODULE_FIRMWARE("kaweth/trigger_code_fix.bin"); static const char driver_name[] = "kaweth"; @@ -385,17 +388,28 @@ static int kaweth_set_receive_filter(struct kaweth_device *kaweth, * kaweth_download_firmware ****************************************************************/ static int kaweth_download_firmware(struct kaweth_device *kaweth, - __u8 *data, - __u16 data_len, + const char *fwname, __u8 interrupt, __u8 type) { - if(data_len > KAWETH_FIRMWARE_BUF_SIZE) { - err("Firmware too big: %d", data_len); + const struct firmware *fw; + int data_len; + int ret; + + ret = request_firmware(&fw, fwname, &kaweth->dev->dev); + if (ret) { + err("Firmware request failed\n"); + return ret; + } + + if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) { + err("Firmware too big: %zu", fw->size); return -ENOSPC; } + data_len = fw->size; + memcpy(kaweth->firmware_buf, fw->data, fw->size); - memcpy(kaweth->firmware_buf, data, data_len); + release_firmware(fw); kaweth->firmware_buf[2] = (data_len & 0xFF) - 7; kaweth->firmware_buf[3] = data_len >> 8; @@ -406,8 +420,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth, kaweth->firmware_buf[2]); dbg("Downloading firmware at %p to kaweth device at %p", - data, - kaweth); + fw->data, kaweth); dbg("Firmware length: %d", data_len); return kaweth_control(kaweth, @@ -1009,8 +1022,7 @@ static int kaweth_probe( info("Downloading firmware..."); kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL); if ((result = kaweth_download_firmware(kaweth, - kaweth_new_code, - len_kaweth_new_code, + "kaweth/new_code.bin", 100, 2)) < 0) { err("Error downloading firmware (%d)", result); @@ -1018,8 +1030,7 @@ static int kaweth_probe( } if ((result = kaweth_download_firmware(kaweth, - kaweth_new_code_fix, - len_kaweth_new_code_fix, + "kaweth/new_code_fix.bin", 100, 3)) < 0) { err("Error downloading firmware fix (%d)", result); @@ -1027,8 +1038,7 @@ static int kaweth_probe( } if ((result = kaweth_download_firmware(kaweth, - kaweth_trigger_code, - len_kaweth_trigger_code, + "kaweth/trigger_code.bin", 126, 2)) < 0) { err("Error downloading trigger code (%d)", result); @@ -1037,8 +1047,7 @@ static int kaweth_probe( } if ((result = kaweth_download_firmware(kaweth, - kaweth_trigger_code_fix, - len_kaweth_trigger_code_fix, + "kaweth/trigger_code_fix.bin", 126, 3)) < 0) { err("Error downloading trigger code fix (%d)", result); |