Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171216
b: refs/heads/master
c: 3ef6129
h: refs/heads/master
v: v3
  • Loading branch information
Inaky Perez-Gonzalez committed Oct 19, 2009
1 parent 214d5b5 commit 5e0cdbf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b0fbcb2a0b54ee201fa8af61fdebe14c050f18fe
refs/heads/master: 3ef6129e57b04c116b1907b72c7a20720e6dde75
27 changes: 19 additions & 8 deletions trunk/drivers/net/wimax/i2400m/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,18 +573,28 @@ void i2400m_dev_stop(struct i2400m *i2400m)
* _stop()], don't do anything, let it fail and handle it.
*
* This function is ran always in a thread context
*
* This function gets passed, as payload to i2400m_work() a 'const
* char *' ptr with a "reason" why the reset happened (for messages).
*/
static
void __i2400m_dev_reset_handle(struct work_struct *ws)
{
int result;
struct i2400m_work *iw = container_of(ws, struct i2400m_work, ws);
const char *reason;
struct i2400m *i2400m = iw->i2400m;
struct device *dev = i2400m_dev(i2400m);
enum wimax_st wimax_state;
struct i2400m_reset_ctx *ctx = i2400m->reset_ctx;

d_fnstart(3, dev, "(ws %p i2400m %p)\n", ws, i2400m);
if (WARN_ON(iw->pl_size != sizeof(reason)))
reason = "SW BUG: reason n/a";
else
memcpy(&reason, iw->pl, sizeof(reason));

d_fnstart(3, dev, "(ws %p i2400m %p reason %s)\n", ws, i2400m, reason);

result = 0;
if (mutex_trylock(&i2400m->init_mutex) == 0) {
/* We are still in i2400m_dev_start() [let it fail] or
Expand All @@ -597,17 +607,17 @@ void __i2400m_dev_reset_handle(struct work_struct *ws)
}
wimax_state = wimax_state_get(&i2400m->wimax_dev);
if (wimax_state < WIMAX_ST_UNINITIALIZED) {
dev_info(dev, "device rebooted: it is down, ignoring\n");
dev_info(dev, "%s: it is down, ignoring\n", reason);
goto out_unlock; /* ifconfig up/down wasn't called */
}
dev_err(dev, "device rebooted: reinitializing driver\n");
dev_err(dev, "%s: reinitializing driver\n", reason);
__i2400m_dev_stop(i2400m);
i2400m->updown = 0;
result = __i2400m_dev_start(i2400m,
I2400M_BRI_SOFT | I2400M_BRI_MAC_REINIT);
if (result < 0) {
dev_err(dev, "device reboot: cannot start the device: %d\n",
result);
dev_err(dev, "%s: cannot start the device: %d\n",
reason, result);
result = i2400m->bus_reset(i2400m, I2400M_RT_BUS);
if (result >= 0)
result = -ENODEV;
Expand All @@ -622,7 +632,8 @@ void __i2400m_dev_reset_handle(struct work_struct *ws)
out:
i2400m_put(i2400m);
kfree(iw);
d_fnend(3, dev, "(ws %p i2400m %p) = void\n", ws, i2400m);
d_fnend(3, dev, "(ws %p i2400m %p reason %s) = void\n",
ws, i2400m, reason);
return;
}

Expand All @@ -639,12 +650,12 @@ void __i2400m_dev_reset_handle(struct work_struct *ws)
* reinitializing the driver to handle the reset, calling into the
* bus-specific functions ops as needed.
*/
int i2400m_dev_reset_handle(struct i2400m *i2400m)
int i2400m_dev_reset_handle(struct i2400m *i2400m, const char *reason)
{
i2400m->boot_mode = 1;
wmb(); /* Make sure i2400m_msg_to_dev() sees boot_mode */
return i2400m_schedule_work(i2400m, __i2400m_dev_reset_handle,
GFP_ATOMIC, NULL, 0);
GFP_ATOMIC, &reason, sizeof(reason));
}
EXPORT_SYMBOL_GPL(i2400m_dev_reset_handle);

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/wimax/i2400m/i2400m.h
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ void i2400m_put(struct i2400m *i2400m)
dev_put(i2400m->wimax_dev.net_dev);
}

extern int i2400m_dev_reset_handle(struct i2400m *);
extern int i2400m_dev_reset_handle(struct i2400m *, const char *);
extern int i2400m_bm_buf_alloc(struct i2400m *i2400m);
extern void i2400m_bm_buf_free(struct i2400m *i2400m);

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/wimax/i2400m/sdio-rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void i2400ms_rx(struct i2400ms *i2400ms)
i2400m_rx(i2400m, skb);
} else if (unlikely(i2400m_is_boot_barker(i2400m,
skb->data, rx_size))) {
ret = i2400m_dev_reset_handle(i2400m);
ret = i2400m_dev_reset_handle(i2400m, "device rebooted");
dev_err(dev, "RX: SDIO reboot barker\n");
kfree_skb(skb);
} else {
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/wimax/i2400m/usb-notif.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int i2400mu_notification_grok(struct i2400mu *i2400mu, const void *buf,
}
ret = i2400m_is_boot_barker(i2400m, buf, buf_len);
if (unlikely(ret >= 0))
ret = i2400m_dev_reset_handle(i2400m);
ret = i2400m_dev_reset_handle(i2400m, "device rebooted");
else /* Unknown or unexpected data in the notif message */
i2400m_unknown_barker(i2400m, buf, buf_len);
error_bad_size:
Expand Down

0 comments on commit 5e0cdbf

Please sign in to comment.