Commit d339a1f2 authored by Thomas Pugliese's avatar Thomas Pugliese Committed by Greg Kroah-Hartman

uwb: whitespace and line length cleanups

Fix whitespace and line length issues reported by checkpatch.
Signed-off-by: default avatarThomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a838ec7b
...@@ -115,7 +115,8 @@ int uwb_rc_send_all_drp_ie(struct uwb_rc *rc) ...@@ -115,7 +115,8 @@ int uwb_rc_send_all_drp_ie(struct uwb_rc *rc)
if (uwb_rsv_has_two_drp_ies(rsv) && if (uwb_rsv_has_two_drp_ies(rsv) &&
(rsv->mv.companion_drp_ie != NULL)) { (rsv->mv.companion_drp_ie != NULL)) {
mv = &rsv->mv; mv = &rsv->mv;
num_bytes += mv->companion_drp_ie->hdr.length + 2; num_bytes +=
mv->companion_drp_ie->hdr.length + 2;
} }
} }
} }
...@@ -145,12 +146,14 @@ int uwb_rc_send_all_drp_ie(struct uwb_rc *rc) ...@@ -145,12 +146,14 @@ int uwb_rc_send_all_drp_ie(struct uwb_rc *rc)
mv = &rsv->mv; mv = &rsv->mv;
memcpy(IEDataptr, mv->companion_drp_ie, memcpy(IEDataptr, mv->companion_drp_ie,
mv->companion_drp_ie->hdr.length + 2); mv->companion_drp_ie->hdr.length + 2);
IEDataptr += mv->companion_drp_ie->hdr.length + 2; IEDataptr +=
mv->companion_drp_ie->hdr.length + 2;
} }
} }
} }
result = uwb_rc_cmd_async(rc, "SET-DRP-IE", &cmd->rccb, sizeof(*cmd) + num_bytes, result = uwb_rc_cmd_async(rc, "SET-DRP-IE",
&cmd->rccb, sizeof(*cmd) + num_bytes,
UWB_RC_CET_GENERAL, UWB_RC_CMD_SET_DRP_IE, UWB_RC_CET_GENERAL, UWB_RC_CMD_SET_DRP_IE,
uwb_rc_set_drp_cmd_done, NULL); uwb_rc_set_drp_cmd_done, NULL);
...@@ -303,17 +306,20 @@ static void handle_conflict_expanding(struct uwb_ie_drp *drp_ie, int ext_beacon_ ...@@ -303,17 +306,20 @@ static void handle_conflict_expanding(struct uwb_ie_drp *drp_ie, int ext_beacon_
switch(action) { switch(action) {
case UWB_DRP_CONFLICT_ACT2: case UWB_DRP_CONFLICT_ACT2:
case UWB_DRP_CONFLICT_ACT3: case UWB_DRP_CONFLICT_ACT3:
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_ESTABLISHED); uwb_rsv_set_state(rsv,
UWB_RSV_STATE_O_ESTABLISHED);
rsv->needs_release_companion_mas = false; rsv->needs_release_companion_mas = false;
if (bow->can_reserve_extra_mases == false) if (bow->can_reserve_extra_mases == false)
uwb_rsv_backoff_win_increment(rc); uwb_rsv_backoff_win_increment(rc);
uwb_drp_avail_release(rsv->rc, &rsv->mv.companion_mas); uwb_drp_avail_release(rsv->rc,
&rsv->mv.companion_mas);
} }
} else { /* rsv is target */ } else { /* rsv is target */
switch(action) { switch(action) {
case UWB_DRP_CONFLICT_ACT2: case UWB_DRP_CONFLICT_ACT2:
case UWB_DRP_CONFLICT_ACT3: case UWB_DRP_CONFLICT_ACT3:
uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_EXPANDING_CONFLICT); uwb_rsv_set_state(rsv,
UWB_RSV_STATE_T_EXPANDING_CONFLICT);
/* send_drp_avail_ie = true; */ /* send_drp_avail_ie = true; */
} }
} }
...@@ -326,7 +332,8 @@ static void handle_conflict_expanding(struct uwb_ie_drp *drp_ie, int ext_beacon_ ...@@ -326,7 +332,8 @@ static void handle_conflict_expanding(struct uwb_ie_drp *drp_ie, int ext_beacon_
/* drop some mases with reason modified */ /* drop some mases with reason modified */
/* put in the companion the mases to be dropped */ /* put in the companion the mases to be dropped */
bitmap_andnot(mv->companion_mas.bm, rsv->mas.bm, conflicting_mas->bm, UWB_NUM_MAS); bitmap_andnot(mv->companion_mas.bm, rsv->mas.bm,
conflicting_mas->bm, UWB_NUM_MAS);
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MODIFIED); uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MODIFIED);
} else { /* it is a target rsv */ } else { /* it is a target rsv */
uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_CONFLICT); uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_CONFLICT);
...@@ -345,17 +352,23 @@ static void uwb_drp_handle_conflict_rsv(struct uwb_rc *rc, struct uwb_rsv *rsv, ...@@ -345,17 +352,23 @@ static void uwb_drp_handle_conflict_rsv(struct uwb_rc *rc, struct uwb_rsv *rsv,
/* check if the conflicting reservation has two drp_ies */ /* check if the conflicting reservation has two drp_ies */
if (uwb_rsv_has_two_drp_ies(rsv)) { if (uwb_rsv_has_two_drp_ies(rsv)) {
mv = &rsv->mv; mv = &rsv->mv;
if (bitmap_intersects(rsv->mas.bm, conflicting_mas->bm, UWB_NUM_MAS)) { if (bitmap_intersects(rsv->mas.bm, conflicting_mas->bm,
handle_conflict_expanding(drp_ie, drp_evt->beacon_slot_number, UWB_NUM_MAS)) {
handle_conflict_expanding(drp_ie,
drp_evt->beacon_slot_number,
rsv, false, conflicting_mas); rsv, false, conflicting_mas);
} else { } else {
if (bitmap_intersects(mv->companion_mas.bm, conflicting_mas->bm, UWB_NUM_MAS)) { if (bitmap_intersects(mv->companion_mas.bm,
handle_conflict_expanding(drp_ie, drp_evt->beacon_slot_number, conflicting_mas->bm, UWB_NUM_MAS)) {
handle_conflict_expanding(
drp_ie, drp_evt->beacon_slot_number,
rsv, true, conflicting_mas); rsv, true, conflicting_mas);
} }
} }
} else if (bitmap_intersects(rsv->mas.bm, conflicting_mas->bm, UWB_NUM_MAS)) { } else if (bitmap_intersects(rsv->mas.bm, conflicting_mas->bm,
handle_conflict_normal(drp_ie, drp_evt->beacon_slot_number, rsv, conflicting_mas); UWB_NUM_MAS)) {
handle_conflict_normal(drp_ie, drp_evt->beacon_slot_number,
rsv, conflicting_mas);
} }
} }
...@@ -367,61 +380,79 @@ static void uwb_drp_handle_all_conflict_rsv(struct uwb_rc *rc, ...@@ -367,61 +380,79 @@ static void uwb_drp_handle_all_conflict_rsv(struct uwb_rc *rc,
struct uwb_rsv *rsv; struct uwb_rsv *rsv;
list_for_each_entry(rsv, &rc->reservations, rc_node) { list_for_each_entry(rsv, &rc->reservations, rc_node) {
uwb_drp_handle_conflict_rsv(rc, rsv, drp_evt, drp_ie, conflicting_mas); uwb_drp_handle_conflict_rsv(rc, rsv, drp_evt, drp_ie,
conflicting_mas);
} }
} }
/* static void uwb_drp_process_target_accepted(struct uwb_rc *rc,
* Based on the DRP IE, transition a target reservation to a new struct uwb_rsv *rsv, struct uwb_rc_evt_drp *drp_evt,
* state. struct uwb_ie_drp *drp_ie, struct uwb_mas_bm *mas)
*/
static void uwb_drp_process_target(struct uwb_rc *rc, struct uwb_rsv *rsv,
struct uwb_ie_drp *drp_ie, struct uwb_rc_evt_drp *drp_evt)
{ {
struct device *dev = &rc->uwb_dev.dev;
struct uwb_rsv_move *mv = &rsv->mv; struct uwb_rsv_move *mv = &rsv->mv;
int status; int status;
enum uwb_drp_reason reason_code;
struct uwb_mas_bm mas;
status = uwb_ie_drp_status(drp_ie); status = uwb_ie_drp_status(drp_ie);
reason_code = uwb_ie_drp_reason_code(drp_ie);
uwb_drp_ie_to_bm(&mas, drp_ie);
switch (reason_code) {
case UWB_DRP_REASON_ACCEPTED:
if (rsv->state == UWB_RSV_STATE_T_CONFLICT) { if (rsv->state == UWB_RSV_STATE_T_CONFLICT) {
uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_CONFLICT); uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_CONFLICT);
break; return;
} }
if (rsv->state == UWB_RSV_STATE_T_EXPANDING_ACCEPTED) { if (rsv->state == UWB_RSV_STATE_T_EXPANDING_ACCEPTED) {
/* drp_ie is companion */ /* drp_ie is companion */
if (!bitmap_equal(rsv->mas.bm, mas.bm, UWB_NUM_MAS)) if (!bitmap_equal(rsv->mas.bm, mas->bm, UWB_NUM_MAS)) {
/* stroke companion */ /* stroke companion */
uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_EXPANDING_ACCEPTED); uwb_rsv_set_state(rsv,
UWB_RSV_STATE_T_EXPANDING_ACCEPTED);
}
} else { } else {
if (!bitmap_equal(rsv->mas.bm, mas.bm, UWB_NUM_MAS)) { if (!bitmap_equal(rsv->mas.bm, mas->bm, UWB_NUM_MAS)) {
if (uwb_drp_avail_reserve_pending(rc, &mas) == -EBUSY) { if (uwb_drp_avail_reserve_pending(rc, mas) == -EBUSY) {
/* FIXME: there is a conflict, find /* FIXME: there is a conflict, find
* the conflicting reservations and * the conflicting reservations and
* take a sensible action. Consider * take a sensible action. Consider
* that in drp_ie there is the * that in drp_ie there is the
* "neighbour" */ * "neighbour" */
uwb_drp_handle_all_conflict_rsv(rc, drp_evt, drp_ie, &mas); uwb_drp_handle_all_conflict_rsv(rc, drp_evt,
drp_ie, mas);
} else { } else {
/* accept the extra reservation */ /* accept the extra reservation */
bitmap_copy(mv->companion_mas.bm, mas.bm, UWB_NUM_MAS); bitmap_copy(mv->companion_mas.bm, mas->bm,
uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_EXPANDING_ACCEPTED); UWB_NUM_MAS);
uwb_rsv_set_state(rsv,
UWB_RSV_STATE_T_EXPANDING_ACCEPTED);
} }
} else { } else {
if (status) { if (status) {
uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_ACCEPTED); uwb_rsv_set_state(rsv,
UWB_RSV_STATE_T_ACCEPTED);
} }
} }
} }
}
/*
* Based on the DRP IE, transition a target reservation to a new
* state.
*/
static void uwb_drp_process_target(struct uwb_rc *rc, struct uwb_rsv *rsv,
struct uwb_ie_drp *drp_ie, struct uwb_rc_evt_drp *drp_evt)
{
struct device *dev = &rc->uwb_dev.dev;
struct uwb_rsv_move *mv = &rsv->mv;
int status;
enum uwb_drp_reason reason_code;
struct uwb_mas_bm mas;
status = uwb_ie_drp_status(drp_ie);
reason_code = uwb_ie_drp_reason_code(drp_ie);
uwb_drp_ie_to_bm(&mas, drp_ie);
switch (reason_code) {
case UWB_DRP_REASON_ACCEPTED:
uwb_drp_process_target_accepted(rc, rsv, drp_evt, drp_ie, &mas);
break; break;
case UWB_DRP_REASON_MODIFIED: case UWB_DRP_REASON_MODIFIED:
...@@ -434,7 +465,8 @@ static void uwb_drp_process_target(struct uwb_rc *rc, struct uwb_rsv *rsv, ...@@ -434,7 +465,8 @@ static void uwb_drp_process_target(struct uwb_rc *rc, struct uwb_rsv *rsv,
/* find if the owner wants to expand or reduce */ /* find if the owner wants to expand or reduce */
if (bitmap_subset(mas.bm, rsv->mas.bm, UWB_NUM_MAS)) { if (bitmap_subset(mas.bm, rsv->mas.bm, UWB_NUM_MAS)) {
/* owner is reducing */ /* owner is reducing */
bitmap_andnot(mv->companion_mas.bm, rsv->mas.bm, mas.bm, UWB_NUM_MAS); bitmap_andnot(mv->companion_mas.bm, rsv->mas.bm, mas.bm,
UWB_NUM_MAS);
uwb_drp_avail_release(rsv->rc, &mv->companion_mas); uwb_drp_avail_release(rsv->rc, &mv->companion_mas);
} }
...@@ -447,27 +479,11 @@ static void uwb_drp_process_target(struct uwb_rc *rc, struct uwb_rsv *rsv, ...@@ -447,27 +479,11 @@ static void uwb_drp_process_target(struct uwb_rc *rc, struct uwb_rsv *rsv,
} }
} }
/* static void uwb_drp_process_owner_accepted(struct uwb_rsv *rsv,
* Based on the DRP IE, transition an owner reservation to a new struct uwb_mas_bm *mas)
* state.
*/
static void uwb_drp_process_owner(struct uwb_rc *rc, struct uwb_rsv *rsv,
struct uwb_dev *src, struct uwb_ie_drp *drp_ie,
struct uwb_rc_evt_drp *drp_evt)
{ {
struct device *dev = &rc->uwb_dev.dev;
struct uwb_rsv_move *mv = &rsv->mv; struct uwb_rsv_move *mv = &rsv->mv;
int status;
enum uwb_drp_reason reason_code;
struct uwb_mas_bm mas;
status = uwb_ie_drp_status(drp_ie);
reason_code = uwb_ie_drp_reason_code(drp_ie);
uwb_drp_ie_to_bm(&mas, drp_ie);
if (status) {
switch (reason_code) {
case UWB_DRP_REASON_ACCEPTED:
switch (rsv->state) { switch (rsv->state) {
case UWB_RSV_STATE_O_PENDING: case UWB_RSV_STATE_O_PENDING:
case UWB_RSV_STATE_O_INITIATED: case UWB_RSV_STATE_O_INITIATED:
...@@ -475,22 +491,20 @@ static void uwb_drp_process_owner(struct uwb_rc *rc, struct uwb_rsv *rsv, ...@@ -475,22 +491,20 @@ static void uwb_drp_process_owner(struct uwb_rc *rc, struct uwb_rsv *rsv,
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_ESTABLISHED); uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_ESTABLISHED);
break; break;
case UWB_RSV_STATE_O_MODIFIED: case UWB_RSV_STATE_O_MODIFIED:
if (bitmap_equal(mas.bm, rsv->mas.bm, UWB_NUM_MAS)) { if (bitmap_equal(mas->bm, rsv->mas.bm, UWB_NUM_MAS))
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_ESTABLISHED); uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_ESTABLISHED);
} else { else
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MODIFIED); uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MODIFIED);
}
break; break;
case UWB_RSV_STATE_O_MOVE_REDUCING: /* shouldn' t be a problem */ case UWB_RSV_STATE_O_MOVE_REDUCING: /* shouldn' t be a problem */
if (bitmap_equal(mas.bm, rsv->mas.bm, UWB_NUM_MAS)) { if (bitmap_equal(mas->bm, rsv->mas.bm, UWB_NUM_MAS))
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_ESTABLISHED); uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_ESTABLISHED);
} else { else
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_REDUCING); uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_REDUCING);
}
break; break;
case UWB_RSV_STATE_O_MOVE_EXPANDING: case UWB_RSV_STATE_O_MOVE_EXPANDING:
if (bitmap_equal(mas.bm, mv->companion_mas.bm, UWB_NUM_MAS)) { if (bitmap_equal(mas->bm, mv->companion_mas.bm, UWB_NUM_MAS)) {
/* Companion reservation accepted */ /* Companion reservation accepted */
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_COMBINING); uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_COMBINING);
} else { } else {
...@@ -498,7 +512,7 @@ static void uwb_drp_process_owner(struct uwb_rc *rc, struct uwb_rsv *rsv, ...@@ -498,7 +512,7 @@ static void uwb_drp_process_owner(struct uwb_rc *rc, struct uwb_rsv *rsv,
} }
break; break;
case UWB_RSV_STATE_O_MOVE_COMBINING: case UWB_RSV_STATE_O_MOVE_COMBINING:
if (bitmap_equal(mas.bm, rsv->mas.bm, UWB_NUM_MAS)) if (bitmap_equal(mas->bm, rsv->mas.bm, UWB_NUM_MAS))
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_REDUCING); uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_REDUCING);
else else
uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_COMBINING); uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_COMBINING);
...@@ -506,6 +520,28 @@ static void uwb_drp_process_owner(struct uwb_rc *rc, struct uwb_rsv *rsv, ...@@ -506,6 +520,28 @@ static void uwb_drp_process_owner(struct uwb_rc *rc, struct uwb_rsv *rsv,
default: default:
break; break;
} }
}
/*
* Based on the DRP IE, transition an owner reservation to a new
* state.
*/
static void uwb_drp_process_owner(struct uwb_rc *rc, struct uwb_rsv *rsv,
struct uwb_dev *src, struct uwb_ie_drp *drp_ie,
struct uwb_rc_evt_drp *drp_evt)
{
struct device *dev = &rc->uwb_dev.dev;
int status;
enum uwb_drp_reason reason_code;
struct uwb_mas_bm mas;
status = uwb_ie_drp_status(drp_ie);
reason_code = uwb_ie_drp_reason_code(drp_ie);
uwb_drp_ie_to_bm(&mas, drp_ie);
if (status) {
switch (reason_code) {
case UWB_DRP_REASON_ACCEPTED:
uwb_drp_process_owner_accepted(rsv, &mas);
break; break;
default: default:
dev_warn(dev, "ignoring invalid DRP IE state (%d/%d)\n", dev_warn(dev, "ignoring invalid DRP IE state (%d/%d)\n",
...@@ -556,10 +592,12 @@ static void uwb_cnflt_update_work(struct work_struct *work) ...@@ -556,10 +592,12 @@ static void uwb_cnflt_update_work(struct work_struct *work)
bitmap_zero(rc->cnflt_alien_bitmap.bm, UWB_NUM_MAS); bitmap_zero(rc->cnflt_alien_bitmap.bm, UWB_NUM_MAS);
list_for_each_entry(c, &rc->cnflt_alien_list, rc_node) { list_for_each_entry(c, &rc->cnflt_alien_list, rc_node) {
bitmap_or(rc->cnflt_alien_bitmap.bm, rc->cnflt_alien_bitmap.bm, c->mas.bm, UWB_NUM_MAS); bitmap_or(rc->cnflt_alien_bitmap.bm, rc->cnflt_alien_bitmap.bm,
c->mas.bm, UWB_NUM_MAS);
} }
queue_delayed_work(rc->rsv_workq, &rc->rsv_alien_bp_work, usecs_to_jiffies(delay_us)); queue_delayed_work(rc->rsv_workq, &rc->rsv_alien_bp_work,
usecs_to_jiffies(delay_us));
kfree(cnflt); kfree(cnflt);
mutex_unlock(&rc->rsvs_mutex); mutex_unlock(&rc->rsvs_mutex);
......
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