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: lock rc->rsvs_lock with spin_lock_bh() wusb: timeout when waiting for ASL/PZL updates in whci-hcd uwb: remove unused #include <version.h>'s wusb: return -ENOTCONN when resetting a port with no connected device uwb: safely remove all reservations
This commit is contained in:
commit
17294ab2ca
@ -170,12 +170,17 @@ void asl_stop(struct whc *whc)
|
||||
void asl_update(struct whc *whc, uint32_t wusbcmd)
|
||||
{
|
||||
struct wusbhc *wusbhc = &whc->wusbhc;
|
||||
long t;
|
||||
|
||||
mutex_lock(&wusbhc->mutex);
|
||||
if (wusbhc->active) {
|
||||
whc_write_wusbcmd(whc, wusbcmd, wusbcmd);
|
||||
wait_event(whc->async_list_wq,
|
||||
(le_readl(whc->base + WUSBCMD) & WUSBCMD_ASYNC_UPDATED) == 0);
|
||||
t = wait_event_timeout(
|
||||
whc->async_list_wq,
|
||||
(le_readl(whc->base + WUSBCMD) & WUSBCMD_ASYNC_UPDATED) == 0,
|
||||
msecs_to_jiffies(1000));
|
||||
if (t == 0)
|
||||
whc_hw_error(whc, "ASL update timeout");
|
||||
}
|
||||
mutex_unlock(&wusbhc->mutex);
|
||||
}
|
||||
|
@ -87,3 +87,18 @@ out:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* whc_hw_error - recover from a hardware error
|
||||
* @whc: the WHCI HC that broke.
|
||||
* @reason: a description of the failure.
|
||||
*
|
||||
* Recover from broken hardware with a full reset.
|
||||
*/
|
||||
void whc_hw_error(struct whc *whc, const char *reason)
|
||||
{
|
||||
struct wusbhc *wusbhc = &whc->wusbhc;
|
||||
|
||||
dev_err(&whc->umc->dev, "hardware error: %s\n", reason);
|
||||
wusbhc_reset_all(wusbhc);
|
||||
}
|
||||
|
@ -183,12 +183,17 @@ void pzl_stop(struct whc *whc)
|
||||
void pzl_update(struct whc *whc, uint32_t wusbcmd)
|
||||
{
|
||||
struct wusbhc *wusbhc = &whc->wusbhc;
|
||||
long t;
|
||||
|
||||
mutex_lock(&wusbhc->mutex);
|
||||
if (wusbhc->active) {
|
||||
whc_write_wusbcmd(whc, wusbcmd, wusbcmd);
|
||||
wait_event(whc->periodic_list_wq,
|
||||
(le_readl(whc->base + WUSBCMD) & WUSBCMD_PERIODIC_UPDATED) == 0);
|
||||
t = wait_event_timeout(
|
||||
whc->periodic_list_wq,
|
||||
(le_readl(whc->base + WUSBCMD) & WUSBCMD_PERIODIC_UPDATED) == 0,
|
||||
msecs_to_jiffies(1000));
|
||||
if (t == 0)
|
||||
whc_hw_error(whc, "PZL update timeout");
|
||||
}
|
||||
mutex_unlock(&wusbhc->mutex);
|
||||
}
|
||||
|
@ -137,6 +137,7 @@ void whc_clean_up(struct whc *whc);
|
||||
/* hw.c */
|
||||
void whc_write_wusbcmd(struct whc *whc, u32 mask, u32 val);
|
||||
int whc_do_gencmd(struct whc *whc, u32 cmd, u32 params, void *addr, size_t len);
|
||||
void whc_hw_error(struct whc *whc, const char *reason);
|
||||
|
||||
/* wusb.c */
|
||||
int whc_wusbhc_start(struct wusbhc *wusbhc);
|
||||
|
@ -386,6 +386,7 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
|
||||
| USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED);
|
||||
port->change |= USB_PORT_STAT_C_CONNECTION | USB_PORT_STAT_C_ENABLE;
|
||||
if (wusb_dev) {
|
||||
dev_dbg(wusbhc->dev, "disconnecting device from port %d\n", wusb_dev->port_idx);
|
||||
if (!list_empty(&wusb_dev->cack_node))
|
||||
list_del_init(&wusb_dev->cack_node);
|
||||
/* For the one in cack_add() */
|
||||
|
@ -100,6 +100,9 @@ static int wusbhc_rh_port_reset(struct wusbhc *wusbhc, u8 port_idx)
|
||||
struct wusb_port *port = wusb_port_by_idx(wusbhc, port_idx);
|
||||
struct wusb_dev *wusb_dev = port->wusb_dev;
|
||||
|
||||
if (wusb_dev == NULL)
|
||||
return -ENOTCONN;
|
||||
|
||||
port->status |= USB_PORT_STAT_RESET;
|
||||
port->change |= USB_PORT_STAT_C_RESET;
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <linux/version.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/uwb.h>
|
||||
|
||||
|
@ -66,14 +66,14 @@ static void uwb_rc_set_drp_cmd_done(struct uwb_rc *rc, void *arg,
|
||||
} else
|
||||
dev_err(&rc->uwb_dev.dev, "SET-DRP-IE: timeout\n");
|
||||
|
||||
spin_lock(&rc->rsvs_lock);
|
||||
spin_lock_bh(&rc->rsvs_lock);
|
||||
if (rc->set_drp_ie_pending > 1) {
|
||||
rc->set_drp_ie_pending = 0;
|
||||
uwb_rsv_queue_update(rc);
|
||||
} else {
|
||||
rc->set_drp_ie_pending = 0;
|
||||
}
|
||||
spin_unlock(&rc->rsvs_lock);
|
||||
spin_unlock_bh(&rc->rsvs_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,7 +114,8 @@ void uwb_rsv_dump(char *text, struct uwb_rsv *rsv)
|
||||
devaddr = rsv->target.devaddr;
|
||||
uwb_dev_addr_print(target, sizeof(target), &devaddr);
|
||||
|
||||
dev_dbg(dev, "rsv %s -> %s: %s\n", owner, target, uwb_rsv_state_str(rsv->state));
|
||||
dev_dbg(dev, "rsv %s %s -> %s: %s\n",
|
||||
text, owner, target, uwb_rsv_state_str(rsv->state));
|
||||
}
|
||||
|
||||
static void uwb_rsv_release(struct kref *kref)
|
||||
@ -511,8 +512,7 @@ void uwb_rsv_remove(struct uwb_rsv *rsv)
|
||||
|
||||
if (uwb_rsv_is_owner(rsv))
|
||||
uwb_rsv_put_stream(rsv);
|
||||
|
||||
del_timer_sync(&rsv->timer);
|
||||
|
||||
uwb_dev_put(rsv->owner);
|
||||
if (rsv->target.type == UWB_RSV_TARGET_DEV)
|
||||
uwb_dev_put(rsv->target.dev);
|
||||
@ -870,7 +870,7 @@ void uwb_rsv_queue_update(struct uwb_rc *rc)
|
||||
*/
|
||||
void uwb_rsv_sched_update(struct uwb_rc *rc)
|
||||
{
|
||||
spin_lock(&rc->rsvs_lock);
|
||||
spin_lock_bh(&rc->rsvs_lock);
|
||||
if (!delayed_work_pending(&rc->rsv_update_work)) {
|
||||
if (rc->set_drp_ie_pending > 0) {
|
||||
rc->set_drp_ie_pending++;
|
||||
@ -879,7 +879,7 @@ void uwb_rsv_sched_update(struct uwb_rc *rc)
|
||||
uwb_rsv_queue_update(rc);
|
||||
}
|
||||
unlock:
|
||||
spin_unlock(&rc->rsvs_lock);
|
||||
spin_unlock_bh(&rc->rsvs_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -943,13 +943,22 @@ void uwb_rsv_remove_all(struct uwb_rc *rc)
|
||||
|
||||
mutex_lock(&rc->rsvs_mutex);
|
||||
list_for_each_entry_safe(rsv, t, &rc->reservations, rc_node) {
|
||||
uwb_rsv_remove(rsv);
|
||||
if (rsv->state != UWB_RSV_STATE_NONE)
|
||||
uwb_rsv_set_state(rsv, UWB_RSV_STATE_NONE);
|
||||
del_timer_sync(&rsv->timer);
|
||||
}
|
||||
/* Cancel any postponed update. */
|
||||
rc->set_drp_ie_pending = 0;
|
||||
mutex_unlock(&rc->rsvs_mutex);
|
||||
|
||||
cancel_delayed_work_sync(&rc->rsv_update_work);
|
||||
flush_workqueue(rc->rsv_workq);
|
||||
|
||||
mutex_lock(&rc->rsvs_mutex);
|
||||
list_for_each_entry_safe(rsv, t, &rc->reservations, rc_node) {
|
||||
uwb_rsv_remove(rsv);
|
||||
}
|
||||
mutex_unlock(&rc->rsvs_mutex);
|
||||
}
|
||||
|
||||
void uwb_rsv_init(struct uwb_rc *rc)
|
||||
|
Loading…
Reference in New Issue
Block a user