Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90ec00d5 authored by Thomas Pugliese's avatar Thomas Pugliese Committed by Greg Kroah-Hartman
Browse files

uwb: fix channel change failure



Make the transition to the UWB_RSV_STATE_NONE state synchronous so that
there is not a race between uwb_rsv_terminate and uwb_rsv_establish.
uwb_rsv_terminate would set the rsv->state to UWB_RSV_STATE_NONE but did
not release the stream resource until a 320ms timeout had expired.  If a
user called uwb_rsv_establish during that time, it could fail to
establish the reservation because no stream resources were available.
This patch removes the timer from the uwb_rsv_terminate process since it
is not needed when transitioning to UWB_RSV_STATE_NONE.

Signed-off-by: default avatarThomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bae00c1a
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -249,7 +249,9 @@ static void uwb_rsv_stroke_timer(struct uwb_rsv *rsv)
	 * super frame and should not be terminated if no response is
	 * super frame and should not be terminated if no response is
	 * received.
	 * received.
	 */
	 */
	if (rsv->is_multicast) {
	if (rsv->state == UWB_RSV_STATE_NONE) {
		sframes = 0;
	} else if (rsv->is_multicast) {
		if (rsv->state == UWB_RSV_STATE_O_INITIATED
		if (rsv->state == UWB_RSV_STATE_O_INITIATED
		    || rsv->state == UWB_RSV_STATE_O_MOVE_EXPANDING
		    || rsv->state == UWB_RSV_STATE_O_MOVE_EXPANDING
		    || rsv->state == UWB_RSV_STATE_O_MOVE_COMBINING
		    || rsv->state == UWB_RSV_STATE_O_MOVE_COMBINING
@@ -322,6 +324,7 @@ void uwb_rsv_set_state(struct uwb_rsv *rsv, enum uwb_rsv_state new_state)
	switch (new_state) {
	switch (new_state) {
	case UWB_RSV_STATE_NONE:
	case UWB_RSV_STATE_NONE:
		uwb_rsv_state_update(rsv, UWB_RSV_STATE_NONE);
		uwb_rsv_state_update(rsv, UWB_RSV_STATE_NONE);
		uwb_rsv_remove(rsv);
		uwb_rsv_callback(rsv);
		uwb_rsv_callback(rsv);
		break;
		break;
	case UWB_RSV_STATE_O_INITIATED:
	case UWB_RSV_STATE_O_INITIATED:
@@ -442,6 +445,8 @@ static void uwb_rsv_handle_timeout_work(struct work_struct *work)
		uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_ACCEPTED);
		uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_ACCEPTED);
		uwb_drp_avail_release(rsv->rc, &rsv->mv.companion_mas);
		uwb_drp_avail_release(rsv->rc, &rsv->mv.companion_mas);
		goto unlock;
		goto unlock;
	case UWB_RSV_STATE_NONE:
		goto unlock;
	default:
	default:
		break;
		break;
	}
	}