diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-09-14 17:10:16 -0400 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-10-19 02:56:02 -0400 |
commit | 7b43ca708a767a5f68eeeb732c569c0f11a7d6f7 (patch) | |
tree | 8811c30691a5e4355c56e9b52a7f8fb9fe9108fb /drivers/net/wimax/i2400m/i2400m.h | |
parent | 3ef6129e57b04c116b1907b72c7a20720e6dde75 (diff) |
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; | |||
424 | * @fw_hdrs: NULL terminated array of pointers to the firmware | 424 | * @fw_hdrs: NULL terminated array of pointers to the firmware |
425 | * headers. This is only available during firmware load time. | 425 | * headers. This is only available during firmware load time. |
426 | * | 426 | * |
427 | * @fw_cached: Used to cache firmware when the system goes to | ||
428 | * suspend/standby/hibernation (as on resume we can't read it). If | ||
429 | * NULL, no firmware was cached, read it. If ~0, you can't read | ||
430 | * any firmware files (the system still didn't come out of suspend | ||
431 | * and failed to cache one), so abort; otherwise, a valid cached | ||
432 | * firmware to be used. Access to this variable is protected by | ||
433 | * the spinlock i2400m->rx_lock. | ||
434 | * | ||
427 | * @barker: barker type that the device uses; this is initialized by | 435 | * @barker: barker type that the device uses; this is initialized by |
428 | * i2400m_is_boot_barker() the first time it is called. Then it | 436 | * i2400m_is_boot_barker() the first time it is called. Then it |
429 | * won't change during the life cycle of the device and everytime | 437 | * won't change during the life cycle of the device and everytime |
430 | * a boot barker is received, it is just verified for it being the | 438 | * a boot barker is received, it is just verified for it being the |
431 | * same. | 439 | * same. |
440 | * | ||
441 | * @pm_notifier: used to register for PM events | ||
432 | */ | 442 | */ |
433 | struct i2400m { | 443 | struct i2400m { |
434 | struct wimax_dev wimax_dev; /* FIRST! See doc */ | 444 | struct wimax_dev wimax_dev; /* FIRST! See doc */ |
@@ -495,7 +505,10 @@ struct i2400m { | |||
495 | const char *fw_name; /* name of the current firmware image */ | 505 | const char *fw_name; /* name of the current firmware image */ |
496 | unsigned long fw_version; /* version of the firmware interface */ | 506 | unsigned long fw_version; /* version of the firmware interface */ |
497 | const struct i2400m_bcf_hdr **fw_hdrs; | 507 | const struct i2400m_bcf_hdr **fw_hdrs; |
508 | struct i2400m_fw *fw_cached; /* protected by rx_lock */ | ||
498 | struct i2400m_barker_db *barker; | 509 | struct i2400m_barker_db *barker; |
510 | |||
511 | struct notifier_block pm_notifier; | ||
499 | }; | 512 | }; |
500 | 513 | ||
501 | 514 | ||
@@ -671,6 +684,9 @@ extern void i2400m_tx_release(struct i2400m *); | |||
671 | extern int i2400m_rx_setup(struct i2400m *); | 684 | extern int i2400m_rx_setup(struct i2400m *); |
672 | extern void i2400m_rx_release(struct i2400m *); | 685 | extern void i2400m_rx_release(struct i2400m *); |
673 | 686 | ||
687 | extern void i2400m_fw_cache(struct i2400m *); | ||
688 | extern void i2400m_fw_uncache(struct i2400m *); | ||
689 | |||
674 | extern void i2400m_net_rx(struct i2400m *, struct sk_buff *, unsigned, | 690 | extern void i2400m_net_rx(struct i2400m *, struct sk_buff *, unsigned, |
675 | const void *, int); | 691 | const void *, int); |
676 | extern void i2400m_net_erx(struct i2400m *, struct sk_buff *, | 692 | extern void i2400m_net_erx(struct i2400m *, struct sk_buff *, |