aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-06-02 21:45:55 -0400
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-06-11 06:30:23 -0400
commitb4013f91cdda10f3f15530914f3c7f39738b0b50 (patch)
tree8dc5ab721c3f2028de4e2372436f76bb059a9fff /drivers/net
parent59063afa0afabc68d2b6ca0d106da9165e1c7d39 (diff)
wimax/i2400m: if a device reboot happens during probe, handle it
When a device reboot happens when we are under probe, with init_mutex taken, make sure we can recover. Have dev_reset_handle set boot mode and i2400m_msg_to_dev() will see it and fail gracefully instead of timing out. Found and diagnosed by Cindy H. Kao. Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wimax/i2400m/control.c1
-rw-r--r--drivers/net/wimax/i2400m/driver.c2
-rw-r--r--drivers/net/wimax/i2400m/fw.c2
3 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/wimax/i2400m/control.c b/drivers/net/wimax/i2400m/control.c
index d8e0cdfa35d5..f9399f2597f3 100644
--- a/drivers/net/wimax/i2400m/control.c
+++ b/drivers/net/wimax/i2400m/control.c
@@ -695,6 +695,7 @@ struct sk_buff *i2400m_msg_to_dev(struct i2400m *i2400m,
695 d_fnstart(3, dev, "(i2400m %p buf %p len %zu)\n", 695 d_fnstart(3, dev, "(i2400m %p buf %p len %zu)\n",
696 i2400m, buf, buf_len); 696 i2400m, buf, buf_len);
697 697
698 rmb(); /* Make sure we see what i2400m_dev_reset_handle() */
698 if (i2400m->boot_mode) 699 if (i2400m->boot_mode)
699 return ERR_PTR(-ENODEV); 700 return ERR_PTR(-ENODEV);
700 701
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
index 897794c9209e..e8d022d58427 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -610,6 +610,8 @@ out:
610 */ 610 */
611int i2400m_dev_reset_handle(struct i2400m *i2400m) 611int i2400m_dev_reset_handle(struct i2400m *i2400m)
612{ 612{
613 i2400m->boot_mode = 1;
614 wmb(); /* Make sure i2400m_msg_to_dev() sees boot_mode */
613 return i2400m_schedule_work(i2400m, __i2400m_dev_reset_handle, 615 return i2400m_schedule_work(i2400m, __i2400m_dev_reset_handle,
614 GFP_ATOMIC); 616 GFP_ATOMIC);
615} 617}
diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c
index 26924f17f19d..01c926ed309e 100644
--- a/drivers/net/wimax/i2400m/fw.c
+++ b/drivers/net/wimax/i2400m/fw.c
@@ -985,6 +985,7 @@ int i2400m_fw_dnload(struct i2400m *i2400m, const struct i2400m_bcf_hdr *bcf,
985 d_fnstart(5, dev, "(i2400m %p bcf %p size %zu)\n", 985 d_fnstart(5, dev, "(i2400m %p bcf %p size %zu)\n",
986 i2400m, bcf, bcf_size); 986 i2400m, bcf, bcf_size);
987 i2400m->boot_mode = 1; 987 i2400m->boot_mode = 1;
988 wmb(); /* Make sure other readers see it */
988hw_reboot: 989hw_reboot:
989 if (count-- == 0) { 990 if (count-- == 0) {
990 ret = -ERESTARTSYS; 991 ret = -ERESTARTSYS;
@@ -1033,6 +1034,7 @@ hw_reboot:
1033 d_printf(2, dev, "fw %s successfully uploaded\n", 1034 d_printf(2, dev, "fw %s successfully uploaded\n",
1034 i2400m->fw_name); 1035 i2400m->fw_name);
1035 i2400m->boot_mode = 0; 1036 i2400m->boot_mode = 0;
1037 wmb(); /* Make sure i2400m_msg_to_dev() sees boot_mode */
1036error_dnload_finalize: 1038error_dnload_finalize:
1037error_dnload_bcf: 1039error_dnload_bcf:
1038error_dnload_init: 1040error_dnload_init: