Commit 3aee0605 authored by Linus Torvalds's avatar Linus Torvalds

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
parents f4c3f038 0396c215
...@@ -887,8 +887,7 @@ static int hwarc_post_reset(struct usb_interface *iface) ...@@ -887,8 +887,7 @@ static int hwarc_post_reset(struct usb_interface *iface)
struct hwarc *hwarc = usb_get_intfdata(iface); struct hwarc *hwarc = usb_get_intfdata(iface);
struct uwb_rc *uwb_rc = hwarc->uwb_rc; struct uwb_rc *uwb_rc = hwarc->uwb_rc;
uwb_rc_post_reset(uwb_rc); return uwb_rc_post_reset(uwb_rc);
return 0;
} }
/** USB device ID's that we handle */ /** USB device ID's that we handle */
......
...@@ -288,8 +288,8 @@ int uwb_rc_add(struct uwb_rc *rc, struct device *parent_dev, void *priv) ...@@ -288,8 +288,8 @@ int uwb_rc_add(struct uwb_rc *rc, struct device *parent_dev, void *priv)
error_dev_add: error_dev_add:
error_rc_setup: error_rc_setup:
rc->stop(rc); rc->stop(rc);
uwbd_stop(rc);
error_rc_start: error_rc_start:
uwbd_stop(rc);
return result; return result;
} }
EXPORT_SYMBOL_GPL(uwb_rc_add); EXPORT_SYMBOL_GPL(uwb_rc_add);
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/delay.h>
#include "uwb-internal.h" #include "uwb-internal.h"
...@@ -323,13 +324,15 @@ int uwbd_msg_handle_reset(struct uwb_event *evt) ...@@ -323,13 +324,15 @@ int uwbd_msg_handle_reset(struct uwb_event *evt)
dev_info(&rc->uwb_dev.dev, "resetting radio controller\n"); dev_info(&rc->uwb_dev.dev, "resetting radio controller\n");
ret = rc->reset(rc); ret = rc->reset(rc);
if (ret) { if (ret < 0) {
dev_err(&rc->uwb_dev.dev, "failed to reset hardware: %d\n", ret); dev_err(&rc->uwb_dev.dev, "failed to reset hardware: %d\n", ret);
goto error; goto error;
} }
return 0; return 0;
error: 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); uwb_rc_reset_all(rc);
return ret; return ret;
} }
...@@ -368,22 +371,20 @@ void uwb_rc_pre_reset(struct uwb_rc *rc) ...@@ -368,22 +371,20 @@ void uwb_rc_pre_reset(struct uwb_rc *rc)
} }
EXPORT_SYMBOL_GPL(uwb_rc_pre_reset); 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; int ret;
ret = rc->start(rc); ret = rc->start(rc);
if (ret) if (ret)
goto error; goto out;
ret = uwb_rc_mac_addr_set(rc, &rc->uwb_dev.mac_addr); ret = uwb_rc_mac_addr_set(rc, &rc->uwb_dev.mac_addr);
if (ret) if (ret)
goto error; goto out;
ret = uwb_rc_dev_addr_set(rc, &rc->uwb_dev.dev_addr); ret = uwb_rc_dev_addr_set(rc, &rc->uwb_dev.dev_addr);
if (ret) if (ret)
goto error; goto out;
return; out:
error: return ret;
/* Nothing can be done except try the reset again. */
uwb_rc_reset_all(rc);
} }
EXPORT_SYMBOL_GPL(uwb_rc_post_reset); EXPORT_SYMBOL_GPL(uwb_rc_post_reset);
...@@ -66,7 +66,7 @@ int umc_controller_reset(struct umc_dev *umc) ...@@ -66,7 +66,7 @@ int umc_controller_reset(struct umc_dev *umc)
return -EAGAIN; return -EAGAIN;
ret = device_for_each_child(parent, parent, umc_bus_pre_reset_helper); ret = device_for_each_child(parent, parent, umc_bus_pre_reset_helper);
if (ret >= 0) if (ret >= 0)
device_for_each_child(parent, parent, umc_bus_post_reset_helper); ret = device_for_each_child(parent, parent, umc_bus_post_reset_helper);
up(&parent->sem); up(&parent->sem);
return ret; return ret;
......
...@@ -187,12 +187,12 @@ int uwbd_event_handle_urc(struct uwb_event *evt) ...@@ -187,12 +187,12 @@ int uwbd_event_handle_urc(struct uwb_event *evt)
event = le16_to_cpu(evt->notif.rceb->wEvent); event = le16_to_cpu(evt->notif.rceb->wEvent);
context = evt->notif.rceb->bEventContext; context = evt->notif.rceb->bEventContext;
if (type > ARRAY_SIZE(uwbd_urc_evt_type_handlers)) if (type >= ARRAY_SIZE(uwbd_urc_evt_type_handlers))
goto out; goto out;
type_table = &uwbd_urc_evt_type_handlers[type]; type_table = &uwbd_urc_evt_type_handlers[type];
if (type_table->uwbd_events == NULL) if (type_table->uwbd_events == NULL)
goto out; goto out;
if (event > type_table->size) if (event >= type_table->size)
goto out; goto out;
handler = type_table->uwbd_events[event].handler; handler = type_table->uwbd_events[event].handler;
if (handler == NULL) if (handler == NULL)
......
...@@ -443,8 +443,7 @@ static int whcrc_post_reset(struct umc_dev *umc) ...@@ -443,8 +443,7 @@ static int whcrc_post_reset(struct umc_dev *umc)
struct whcrc *whcrc = umc_get_drvdata(umc); struct whcrc *whcrc = umc_get_drvdata(umc);
struct uwb_rc *uwb_rc = whcrc->uwb_rc; struct uwb_rc *uwb_rc = whcrc->uwb_rc;
uwb_rc_post_reset(uwb_rc); return uwb_rc_post_reset(uwb_rc);
return 0;
} }
/* PCI device ID's that we handle [so it gets loaded] */ /* PCI device ID's that we handle [so it gets loaded] */
......
...@@ -597,7 +597,7 @@ void uwb_rc_neh_grok(struct uwb_rc *, void *, size_t); ...@@ -597,7 +597,7 @@ void uwb_rc_neh_grok(struct uwb_rc *, void *, size_t);
void uwb_rc_neh_error(struct uwb_rc *, int); void uwb_rc_neh_error(struct uwb_rc *, int);
void uwb_rc_reset_all(struct uwb_rc *rc); void uwb_rc_reset_all(struct uwb_rc *rc);
void uwb_rc_pre_reset(struct uwb_rc *rc); void uwb_rc_pre_reset(struct uwb_rc *rc);
void uwb_rc_post_reset(struct uwb_rc *rc); int uwb_rc_post_reset(struct uwb_rc *rc);
/** /**
* uwb_rsv_is_owner - is the owner of this reservation the RC? * uwb_rsv_is_owner - is the owner of this reservation the RC?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment