aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-09-14 17:05:19 -0400
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-10-19 02:56:01 -0400
commit3ef6129e57b04c116b1907b72c7a20720e6dde75 (patch)
treea560950398c057010f9f591d10ed0dfe0eb8e98a /drivers
parentb0fbcb2a0b54ee201fa8af61fdebe14c050f18fe (diff)
wimax/i2400m: add reason argument to i2400m_dev_reset_handle()
In preparation for reset_resume support, in which the same code path is going to be used, add a diagnostic message to dev_reset_handle() that can be used to distinguish how the device got there. This uses the new payload argument added to i2400m_schedule_work() by the previous commit. Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wimax/i2400m/driver.c27
-rw-r--r--drivers/net/wimax/i2400m/i2400m.h2
-rw-r--r--drivers/net/wimax/i2400m/sdio-rx.c2
-rw-r--r--drivers/net/wimax/i2400m/usb-notif.c2
4 files changed, 22 insertions, 11 deletions
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
index 5803a2bfd6af..f07d8527b03b 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -573,18 +573,28 @@ void i2400m_dev_stop(struct i2400m *i2400m)
573 * _stop()], don't do anything, let it fail and handle it. 573 * _stop()], don't do anything, let it fail and handle it.
574 * 574 *
575 * This function is ran always in a thread context 575 * This function is ran always in a thread context
576 *
577 * This function gets passed, as payload to i2400m_work() a 'const
578 * char *' ptr with a "reason" why the reset happened (for messages).
576 */ 579 */
577static 580static
578void __i2400m_dev_reset_handle(struct work_struct *ws) 581void __i2400m_dev_reset_handle(struct work_struct *ws)
579{ 582{
580 int result; 583 int result;
581 struct i2400m_work *iw = container_of(ws, struct i2400m_work, ws); 584 struct i2400m_work *iw = container_of(ws, struct i2400m_work, ws);
585 const char *reason;
582 struct i2400m *i2400m = iw->i2400m; 586 struct i2400m *i2400m = iw->i2400m;
583 struct device *dev = i2400m_dev(i2400m); 587 struct device *dev = i2400m_dev(i2400m);
584 enum wimax_st wimax_state; 588 enum wimax_st wimax_state;
585 struct i2400m_reset_ctx *ctx = i2400m->reset_ctx; 589 struct i2400m_reset_ctx *ctx = i2400m->reset_ctx;
586 590
587 d_fnstart(3, dev, "(ws %p i2400m %p)\n", ws, i2400m); 591 if (WARN_ON(iw->pl_size != sizeof(reason)))
592 reason = "SW BUG: reason n/a";
593 else
594 memcpy(&reason, iw->pl, sizeof(reason));
595
596 d_fnstart(3, dev, "(ws %p i2400m %p reason %s)\n", ws, i2400m, reason);
597
588 result = 0; 598 result = 0;
589 if (mutex_trylock(&i2400m->init_mutex) == 0) { 599 if (mutex_trylock(&i2400m->init_mutex) == 0) {
590 /* We are still in i2400m_dev_start() [let it fail] or 600 /* We are still in i2400m_dev_start() [let it fail] or
@@ -597,17 +607,17 @@ void __i2400m_dev_reset_handle(struct work_struct *ws)
597 } 607 }
598 wimax_state = wimax_state_get(&i2400m->wimax_dev); 608 wimax_state = wimax_state_get(&i2400m->wimax_dev);
599 if (wimax_state < WIMAX_ST_UNINITIALIZED) { 609 if (wimax_state < WIMAX_ST_UNINITIALIZED) {
600 dev_info(dev, "device rebooted: it is down, ignoring\n"); 610 dev_info(dev, "%s: it is down, ignoring\n", reason);
601 goto out_unlock; /* ifconfig up/down wasn't called */ 611 goto out_unlock; /* ifconfig up/down wasn't called */
602 } 612 }
603 dev_err(dev, "device rebooted: reinitializing driver\n"); 613 dev_err(dev, "%s: reinitializing driver\n", reason);
604 __i2400m_dev_stop(i2400m); 614 __i2400m_dev_stop(i2400m);
605 i2400m->updown = 0; 615 i2400m->updown = 0;
606 result = __i2400m_dev_start(i2400m, 616 result = __i2400m_dev_start(i2400m,
607 I2400M_BRI_SOFT | I2400M_BRI_MAC_REINIT); 617 I2400M_BRI_SOFT | I2400M_BRI_MAC_REINIT);
608 if (result < 0) { 618 if (result < 0) {
609 dev_err(dev, "device reboot: cannot start the device: %d\n", 619 dev_err(dev, "%s: cannot start the device: %d\n",
610 result); 620 reason, result);
611 result = i2400m->bus_reset(i2400m, I2400M_RT_BUS); 621 result = i2400m->bus_reset(i2400m, I2400M_RT_BUS);
612 if (result >= 0) 622 if (result >= 0)
613 result = -ENODEV; 623 result = -ENODEV;
@@ -622,7 +632,8 @@ out_unlock:
622out: 632out:
623 i2400m_put(i2400m); 633 i2400m_put(i2400m);
624 kfree(iw); 634 kfree(iw);
625 d_fnend(3, dev, "(ws %p i2400m %p) = void\n", ws, i2400m); 635 d_fnend(3, dev, "(ws %p i2400m %p reason %s) = void\n",
636 ws, i2400m, reason);
626 return; 637 return;
627} 638}
628 639
@@ -639,12 +650,12 @@ out:
639 * reinitializing the driver to handle the reset, calling into the 650 * reinitializing the driver to handle the reset, calling into the
640 * bus-specific functions ops as needed. 651 * bus-specific functions ops as needed.
641 */ 652 */
642int i2400m_dev_reset_handle(struct i2400m *i2400m) 653int i2400m_dev_reset_handle(struct i2400m *i2400m, const char *reason)
643{ 654{
644 i2400m->boot_mode = 1; 655 i2400m->boot_mode = 1;
645 wmb(); /* Make sure i2400m_msg_to_dev() sees boot_mode */ 656 wmb(); /* Make sure i2400m_msg_to_dev() sees boot_mode */
646 return i2400m_schedule_work(i2400m, __i2400m_dev_reset_handle, 657 return i2400m_schedule_work(i2400m, __i2400m_dev_reset_handle,
647 GFP_ATOMIC, NULL, 0); 658 GFP_ATOMIC, &reason, sizeof(reason));
648} 659}
649EXPORT_SYMBOL_GPL(i2400m_dev_reset_handle); 660EXPORT_SYMBOL_GPL(i2400m_dev_reset_handle);
650 661
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h
index 700f87be4acf..0c165de89b2d 100644
--- a/drivers/net/wimax/i2400m/i2400m.h
+++ b/drivers/net/wimax/i2400m/i2400m.h
@@ -739,7 +739,7 @@ void i2400m_put(struct i2400m *i2400m)
739 dev_put(i2400m->wimax_dev.net_dev); 739 dev_put(i2400m->wimax_dev.net_dev);
740} 740}
741 741
742extern int i2400m_dev_reset_handle(struct i2400m *); 742extern int i2400m_dev_reset_handle(struct i2400m *, const char *);
743extern int i2400m_bm_buf_alloc(struct i2400m *i2400m); 743extern int i2400m_bm_buf_alloc(struct i2400m *i2400m);
744extern void i2400m_bm_buf_free(struct i2400m *i2400m); 744extern void i2400m_bm_buf_free(struct i2400m *i2400m);
745 745
diff --git a/drivers/net/wimax/i2400m/sdio-rx.c b/drivers/net/wimax/i2400m/sdio-rx.c
index 87263be4eedb..98ee7fdfd621 100644
--- a/drivers/net/wimax/i2400m/sdio-rx.c
+++ b/drivers/net/wimax/i2400m/sdio-rx.c
@@ -179,7 +179,7 @@ void i2400ms_rx(struct i2400ms *i2400ms)
179 i2400m_rx(i2400m, skb); 179 i2400m_rx(i2400m, skb);
180 } else if (unlikely(i2400m_is_boot_barker(i2400m, 180 } else if (unlikely(i2400m_is_boot_barker(i2400m,
181 skb->data, rx_size))) { 181 skb->data, rx_size))) {
182 ret = i2400m_dev_reset_handle(i2400m); 182 ret = i2400m_dev_reset_handle(i2400m, "device rebooted");
183 dev_err(dev, "RX: SDIO reboot barker\n"); 183 dev_err(dev, "RX: SDIO reboot barker\n");
184 kfree_skb(skb); 184 kfree_skb(skb);
185 } else { 185 } else {
diff --git a/drivers/net/wimax/i2400m/usb-notif.c b/drivers/net/wimax/i2400m/usb-notif.c
index a0751a347cdc..f88d1c6e35cb 100644
--- a/drivers/net/wimax/i2400m/usb-notif.c
+++ b/drivers/net/wimax/i2400m/usb-notif.c
@@ -98,7 +98,7 @@ int i2400mu_notification_grok(struct i2400mu *i2400mu, const void *buf,
98 } 98 }
99 ret = i2400m_is_boot_barker(i2400m, buf, buf_len); 99 ret = i2400m_is_boot_barker(i2400m, buf, buf_len);
100 if (unlikely(ret >= 0)) 100 if (unlikely(ret >= 0))
101 ret = i2400m_dev_reset_handle(i2400m); 101 ret = i2400m_dev_reset_handle(i2400m, "device rebooted");
102 else /* Unknown or unexpected data in the notif message */ 102 else /* Unknown or unexpected data in the notif message */
103 i2400m_unknown_barker(i2400m, buf, buf_len); 103 i2400m_unknown_barker(i2400m, buf, buf_len);
104error_bad_size: 104error_bad_size: