From f79833a7ab44fd7ce4db47c65c929747463a452d Mon Sep 17 00:00:00 2001 From: Thomas Pugliese Date: Fri, 20 Dec 2013 11:54:07 -0600 Subject: uwb: add debug prints during channel change and beacon actions Add debug prints during channel change and beacon actions. Signed-off-by: Thomas Pugliese Signed-off-by: Greg Kroah-Hartman --- drivers/uwb/beacon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/uwb/beacon.c') diff --git a/drivers/uwb/beacon.c b/drivers/uwb/beacon.c index dcdd59bfcd0..7b763610ce7 100644 --- a/drivers/uwb/beacon.c +++ b/drivers/uwb/beacon.c @@ -117,6 +117,7 @@ int uwb_rc_beacon(struct uwb_rc *rc, int channel, unsigned bpst_offset) int result; struct device *dev = &rc->uwb_dev.dev; + dev_dbg(dev, "%s: channel = %d\n", __func__, channel); if (channel < 0) channel = -1; if (channel == -1) @@ -517,7 +518,7 @@ int uwbd_evt_handle_rc_bp_slot_change(struct uwb_event *evt) mutex_lock(&rc->uwb_dev.mutex); if (uwb_rc_evt_bp_slot_change_no_slot(bpsc)) { - dev_info(dev, "stopped beaconing: No free slots in BP\n"); + dev_err(dev, "stopped beaconing: No free slots in BP\n"); rc->beaconing = -1; } else rc->uwb_dev.beacon_slot = uwb_rc_evt_bp_slot_change_slot_num(bpsc); -- cgit v1.2.3-70-g09d2 From 67d0fb2592acdd7cc41129279de2e520d53d68f0 Mon Sep 17 00:00:00 2001 From: Thomas Pugliese Date: Fri, 20 Dec 2013 11:54:08 -0600 Subject: uwb: whitespace and comment cleanups various whitespace and comment cleanups Signed-off-by: Thomas Pugliese Signed-off-by: Greg Kroah-Hartman --- drivers/uwb/beacon.c | 2 +- drivers/uwb/radio.c | 2 +- drivers/uwb/rsv.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/uwb/beacon.c') diff --git a/drivers/uwb/beacon.c b/drivers/uwb/beacon.c index 7b763610ce7..4190f29fe31 100644 --- a/drivers/uwb/beacon.c +++ b/drivers/uwb/beacon.c @@ -185,7 +185,7 @@ out: /* Find a beacon by dev addr in the cache */ static -struct uwb_beca_e *__uwb_beca_find_bymac(struct uwb_rc *rc, +struct uwb_beca_e *__uwb_beca_find_bymac(struct uwb_rc *rc, const struct uwb_mac_addr *mac_addr) { struct uwb_beca_e *bce, *next; diff --git a/drivers/uwb/radio.c b/drivers/uwb/radio.c index 10adb980099..fd23d985ea7 100644 --- a/drivers/uwb/radio.c +++ b/drivers/uwb/radio.c @@ -93,7 +93,7 @@ static int uwb_radio_change_channel(struct uwb_rc *rc, int channel) * uwb_radio_start - request that the radio be started * @pal: the PAL making the request. * - * If the radio is not already active, aa suitable channel is selected + * If the radio is not already active, a suitable channel is selected * and beacons are started. */ int uwb_radio_start(struct uwb_pal *pal) diff --git a/drivers/uwb/rsv.c b/drivers/uwb/rsv.c index 738e8a8cb81..4e7e4bf7542 100644 --- a/drivers/uwb/rsv.c +++ b/drivers/uwb/rsv.c @@ -237,7 +237,7 @@ void uwb_rsv_backoff_win_increment(struct uwb_rc *rc) /* reset the timer associated variables */ timeout_us = bow->n * UWB_SUPERFRAME_LENGTH_US; bow->total_expired = 0; - mod_timer(&bow->timer, jiffies + usecs_to_jiffies(timeout_us)); + mod_timer(&bow->timer, jiffies + usecs_to_jiffies(timeout_us)); } static void uwb_rsv_stroke_timer(struct uwb_rsv *rsv) @@ -257,7 +257,7 @@ static void uwb_rsv_stroke_timer(struct uwb_rsv *rsv) sframes = 1; if (rsv->state == UWB_RSV_STATE_O_ESTABLISHED) sframes = 0; - + } if (sframes > 0) { @@ -611,7 +611,7 @@ int uwb_rsv_try_move(struct uwb_rsv *rsv, struct uwb_mas_bm *available) struct device *dev = &rc->uwb_dev.dev; struct uwb_rsv_move *mv; int ret = 0; - + if (bow->can_reserve_extra_mases == false) return -EBUSY; @@ -628,7 +628,7 @@ int uwb_rsv_try_move(struct uwb_rsv *rsv, struct uwb_mas_bm *available) } else { dev_dbg(dev, "new allocation not found\n"); } - + return ret; } @@ -640,7 +640,7 @@ void uwb_rsv_handle_drp_avail_change(struct uwb_rc *rc) struct uwb_drp_backoff_win *bow = &rc->bow; struct uwb_rsv *rsv; struct uwb_mas_bm mas; - + if (bow->can_reserve_extra_mases == false) return; @@ -652,7 +652,7 @@ void uwb_rsv_handle_drp_avail_change(struct uwb_rc *rc) uwb_rsv_try_move(rsv, &mas); } } - + } /** @@ -916,7 +916,7 @@ static void uwb_rsv_alien_bp_work(struct work_struct *work) struct uwb_rsv *rsv; mutex_lock(&rc->rsvs_mutex); - + list_for_each_entry(rsv, &rc->reservations, rc_node) { if (rsv->type != UWB_DRP_TYPE_ALIEN_BP) { rsv->callback(rsv); -- cgit v1.2.3-70-g09d2 From 1fc671b3be8f671482871d9a0b577b6d96914e8e Mon Sep 17 00:00:00 2001 From: Thomas Pugliese Date: Fri, 20 Dec 2013 13:01:03 -0600 Subject: uwb: move mutex_lock to error case in uwbd_evt_handle_rc_bp_slot_change Only acquire rc->uwb_dev.mutex in the error case in uwbd_evt_handle_rc_bp_slot_change. This fixes a bug where establishing a reservation on a new channel will fail if we were unable to establish a reservation on the previous channel due to DRP conflict. If rc->uwb_dev.mutex is acquired in the non-error case when the uwb system is attempting to start beaconing, it will block because the start beaconing code is holding this mutex. This prevents any other notifications from the URC from being processed. In particular, the DRP_AVAILABILITY notification will not be processed during the start beaconing process which can result in a failure to establish a reservation. It is safe to not hold the mutex in the non-error case since the only other place rc->uwb_dev.beacon_slot is accessed is in the same worker thread that uwbd_evt_handle_rc_bp_slot_change executes in. Signed-off-by: Thomas Pugliese Signed-off-by: Greg Kroah-Hartman --- drivers/uwb/beacon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/uwb/beacon.c') diff --git a/drivers/uwb/beacon.c b/drivers/uwb/beacon.c index 4190f29fe31..57b5ff61020 100644 --- a/drivers/uwb/beacon.c +++ b/drivers/uwb/beacon.c @@ -516,13 +516,13 @@ int uwbd_evt_handle_rc_bp_slot_change(struct uwb_event *evt) } bpsc = container_of(evt->notif.rceb, struct uwb_rc_evt_bp_slot_change, rceb); - mutex_lock(&rc->uwb_dev.mutex); if (uwb_rc_evt_bp_slot_change_no_slot(bpsc)) { dev_err(dev, "stopped beaconing: No free slots in BP\n"); + mutex_lock(&rc->uwb_dev.mutex); rc->beaconing = -1; + mutex_unlock(&rc->uwb_dev.mutex); } else rc->uwb_dev.beacon_slot = uwb_rc_evt_bp_slot_change_slot_num(bpsc); - mutex_unlock(&rc->uwb_dev.mutex); return 0; } -- cgit v1.2.3-70-g09d2