summaryrefslogtreecommitdiffstats
path: root/drivers/uwb/reset.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-17 09:44:09 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-17 09:44:09 -0700
commit3aee0605a41399063c0ad396f1f4267108f210d3 (patch)
treec9e3ce738c3d093dbd861c5a53b63157edd893c2 /drivers/uwb/reset.c
parentf4c3f03838ae47a92f2d15d48ddf68deae5d7ebb (diff)
parent0396c215f301e92677d1e9a064b405e31501dc1d (diff)
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb
* 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb: uwb: avoid radio controller reset loops uwb: stop uwbd thread if rc->start() fails uwb: handle radio controller events with out-of-range IDs correctly
Diffstat (limited to 'drivers/uwb/reset.c')
-rw-r--r--drivers/uwb/reset.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/uwb/reset.c b/drivers/uwb/reset.c
index 70f8050221f..7f0512e43d9 100644
--- a/drivers/uwb/reset.c
+++ b/drivers/uwb/reset.c
@@ -30,6 +30,7 @@
*/
#include <linux/kernel.h>
#include <linux/err.h>
+#include <linux/delay.h>
#include "uwb-internal.h"
@@ -323,13 +324,15 @@ int uwbd_msg_handle_reset(struct uwb_event *evt)
dev_info(&rc->uwb_dev.dev, "resetting radio controller\n");
ret = rc->reset(rc);
- if (ret) {
+ if (ret < 0) {
dev_err(&rc->uwb_dev.dev, "failed to reset hardware: %d\n", ret);
goto error;
}
return 0;
error:
- /* Nothing can be done except try the reset again. */
+ /* Nothing can be done except try the reset again. Wait a bit
+ to avoid reset loops during probe() or remove(). */
+ msleep(1000);
uwb_rc_reset_all(rc);
return ret;
}
@@ -368,22 +371,20 @@ void uwb_rc_pre_reset(struct uwb_rc *rc)
}
EXPORT_SYMBOL_GPL(uwb_rc_pre_reset);
-void uwb_rc_post_reset(struct uwb_rc *rc)
+int uwb_rc_post_reset(struct uwb_rc *rc)
{
int ret;
ret = rc->start(rc);
if (ret)
- goto error;
+ goto out;
ret = uwb_rc_mac_addr_set(rc, &rc->uwb_dev.mac_addr);
if (ret)
- goto error;
+ goto out;
ret = uwb_rc_dev_addr_set(rc, &rc->uwb_dev.dev_addr);
if (ret)
- goto error;
- return;
-error:
- /* Nothing can be done except try the reset again. */
- uwb_rc_reset_all(rc);
+ goto out;
+out:
+ return ret;
}
EXPORT_SYMBOL_GPL(uwb_rc_post_reset);