Skip to content

Commit

Permalink
Bluetooth: Uses test_and_clear_bit() when possible
Browse files Browse the repository at this point in the history
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Gustavo F. Padovan committed Oct 7, 2011
1 parent 192893c commit ab88f71
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,9 @@ static void hidp_process_handshake(struct hidp_session *session,
case HIDP_HSHK_ERR_INVALID_REPORT_ID:
case HIDP_HSHK_ERR_UNSUPPORTED_REQUEST:
case HIDP_HSHK_ERR_INVALID_PARAMETER:
if (test_bit(HIDP_WAITING_FOR_RETURN, &session->flags)) {
clear_bit(HIDP_WAITING_FOR_RETURN, &session->flags);
if (test_and_clear_bit(HIDP_WAITING_FOR_RETURN, &session->flags))
wake_up_interruptible(&session->report_queue);
}

/* FIXME: Call into SET_ GET_ handlers here */
break;

Expand All @@ -520,10 +519,8 @@ static void hidp_process_handshake(struct hidp_session *session,
}

/* Wake up the waiting thread. */
if (test_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags)) {
clear_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags);
if (test_and_clear_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags))
wake_up_interruptible(&session->report_queue);
}
}

static void hidp_process_hid_control(struct hidp_session *session,
Expand Down

0 comments on commit ab88f71

Please sign in to comment.