diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-09-15 01:10:16 +0400 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-10-19 10:56:02 +0400 |
commit | 7b43ca708a767a5f68eeeb732c569c0f11a7d6f7 (patch) | |
tree | 8811c30691a5e4355c56e9b52a7f8fb9fe9108fb /drivers/net/wimax/i2400m/i2400m.h | |
parent | 3ef6129e57b04c116b1907b72c7a20720e6dde75 (diff) | |
download | linux-7b43ca708a767a5f68eeeb732c569c0f11a7d6f7.tar.xz |
wimax/i2400m: cache firmware on system suspend
In preparation for a reset_resume implementation, have the firmware
image be cached in memory when the system goes to suspend and released
when out.
This is needed in case the device resets during suspend; the driver
can't load firmware until resume is completed or bad deadlocks
happen.
The modus operandi for this was copied from the Orinoco USB driver.
The caching is done with a kobject to avoid race conditions when
releasing it. The fw loader path is altered only to first check for a
cached image before trying to load from disk. A Power Management event
notifier is register to call i2400m_fw_cache() or i2400m_fw_uncache()
which take care of the actual cache management.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'drivers/net/wimax/i2400m/i2400m.h')
-rw-r--r-- | drivers/net/wimax/i2400m/i2400m.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h index 0c165de89b2d..916b1d319299 100644 --- a/drivers/net/wimax/i2400m/i2400m.h +++ b/drivers/net/wimax/i2400m/i2400m.h @@ -424,11 +424,21 @@ struct i2400m_barker_db; * @fw_hdrs: NULL terminated array of pointers to the firmware * headers. This is only available during firmware load time. * + * @fw_cached: Used to cache firmware when the system goes to + * suspend/standby/hibernation (as on resume we can't read it). If + * NULL, no firmware was cached, read it. If ~0, you can't read + * any firmware files (the system still didn't come out of suspend + * and failed to cache one), so abort; otherwise, a valid cached + * firmware to be used. Access to this variable is protected by + * the spinlock i2400m->rx_lock. + * * @barker: barker type that the device uses; this is initialized by * i2400m_is_boot_barker() the first time it is called. Then it * won't change during the life cycle of the device and everytime * a boot barker is received, it is just verified for it being the * same. + * + * @pm_notifier: used to register for PM events */ struct i2400m { struct wimax_dev wimax_dev; /* FIRST! See doc */ @@ -495,7 +505,10 @@ struct i2400m { const char *fw_name; /* name of the current firmware image */ unsigned long fw_version; /* version of the firmware interface */ const struct i2400m_bcf_hdr **fw_hdrs; + struct i2400m_fw *fw_cached; /* protected by rx_lock */ struct i2400m_barker_db *barker; + + struct notifier_block pm_notifier; }; @@ -671,6 +684,9 @@ extern void i2400m_tx_release(struct i2400m *); extern int i2400m_rx_setup(struct i2400m *); extern void i2400m_rx_release(struct i2400m *); +extern void i2400m_fw_cache(struct i2400m *); +extern void i2400m_fw_uncache(struct i2400m *); + extern void i2400m_net_rx(struct i2400m *, struct sk_buff *, unsigned, const void *, int); extern void i2400m_net_erx(struct i2400m *, struct sk_buff *, |