diff options
author | Pavel Roskin <proski@gnu.org> | 2007-06-08 03:16:19 -0400 |
---|---|---|
committer | Guido Guenther <agx@sigxcpu.org> | 2007-06-09 17:34:05 +0200 |
commit | 3a9d7b626de02fdda23750f8ac10ebb97aaf961f (patch) | |
tree | b8073ecb444fe882d27a2f576741705749d382a1 /at76_usb.h | |
parent | 94ac6f9695da6288cb2944ae5f06e9fb3f2e847a (diff) |
[PATCH] Decouple networking from firmware download
Move all firmware related data from struct at76_priv to struct fwentry.
Move struct fwentry to the header file. Share the firmware data between
devices.
Never load firmware version or anything else into firmwares[], as one
broken device can mess it for others. Use temporary structures instead.
Change at76_load_internal_fw() and at76_load_external_fw() not to
require struct at76_priv, which is allocated as part of the network
device. at76_disconnect() should check if priv is allocated.
Don't use priv->istate to track the firmware loading, as it's done in a
predictable consecutive manner now. No state machine is needed at this
point. There should be no priv at all before the firmware is loaded.
Until the device is fully initialized, priv->istate should be INIT.
Don't use mutexes during firmware download for the same reason. In
fact, they were used incorrectly since priv is not the same during
internal and external firmware download.
Parse firmware immediately after loading in a new function
at76_load_firmware() replacing at76_parse_fw() and parts of
at76_probe().
Don't access udev before usb_get_dev() is called and be careful to call
usb_put_dev() for all errors.
Improve error handling and diagnostics in the affected code.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Diffstat (limited to 'at76_usb.h')
-rw-r--r-- | at76_usb.h | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -388,9 +388,6 @@ enum infra_state { JOINING, CONNECTED, STARTIBSS, - INTFW_DOWNLOAD, - EXTFW_DOWNLOAD, - WAIT_FOR_DISCONNECT, MONITORING, }; @@ -447,6 +444,20 @@ struct rx_data_buf { /* how often do we try to submit a rx urb until giving up */ #define NR_SUBMIT_RX_TRIES 8 +/* Data for one loaded firmware file */ +struct fwentry { + const char *const fwname; + const struct firmware *fw; + int extfw_size; + int intfw_size; + /* these point into a buffer managed by the firmware dl functions, no need to dealloc */ + u8 *extfw; /* points to external firmware part, extfw_size bytes long */ + u8 *intfw; /* points to internal firmware part, intfw_size bytes long */ + u32 board_type; /* BOARDTYPE_* in at76_usb_ids.h */ + struct mib_fw_version fw_version; + int loaded; /* Loaded and parsed successfully */ +}; + struct at76_priv { struct usb_device *udev; /* USB device pointer */ struct net_device *netdev; /* net device pointer */ @@ -547,7 +558,6 @@ struct at76_priv { int retries; /* counts backwards while re-trying to send auth/assoc_req's */ u8 pm_mode; /* power management mode: AT76_PM_{OFF, ON, SMART} */ u32 pm_period; /* power manag. period in us */ - u32 board_type; /* BOARDTYPE_* in at76_usb_ids.h */ struct reg_domain const *domain; /* the description of the regulatory domain */ int international_roaming; @@ -564,7 +574,6 @@ struct at76_priv { u8 regulatory_domain; struct at76_card_config card_config; - struct mib_fw_version fw_version; int rx_data_fcs_len; /* length of the trailing FCS (0 for fw <= 0.84.x, 4 otherwise) */ @@ -572,11 +581,7 @@ struct at76_priv { /* store rx fragments until complete */ struct rx_data_buf rx_data[NR_RX_DATA_BUF]; - int extfw_size; - int intfw_size; - /* these point into a buffer managed by the firmware dl functions, no need to dealloc */ - u8 *extfw; /* points to external firmware part, extfw_size bytes long */ - u8 *intfw; /* points to internal firmware part, intfw_size bytes long */ + struct fwentry *fwe; unsigned int device_unplugged:1; unsigned int netdev_registered:1; char obuf[2 * 256 + 1]; /* global debug output buffer to reduce stack usage */ |