aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-03-04 19:03:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-06 15:16:20 -0500
commit1762c17c9c38ed21090bee8cd02e2b470c5c2308 (patch)
treeefb6c38eefb8e6ab9646e98dab97623d503de6c8 /net/nfc
parent53a0ac2ee810cf82ec374b686a1dc3c32399265a (diff)
NFC: Fix bitops usage in LLCP
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/llcp/llcp.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index bbfaa2750ea8..443407e964ca 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -176,7 +176,7 @@ u8 nfc_llcp_get_sdp_ssap(struct nfc_llcp_local *local,
176 return LLCP_SAP_MAX; 176 return LLCP_SAP_MAX;
177 } 177 }
178 178
179 set_bit(BIT(ssap), &local->local_wks); 179 set_bit(ssap, &local->local_wks);
180 mutex_unlock(&local->sdp_lock); 180 mutex_unlock(&local->sdp_lock);
181 181
182 return ssap; 182 return ssap;
@@ -195,25 +195,25 @@ u8 nfc_llcp_get_sdp_ssap(struct nfc_llcp_local *local,
195 195
196 pr_debug("SDP ssap %d\n", LLCP_WKS_NUM_SAP + ssap); 196 pr_debug("SDP ssap %d\n", LLCP_WKS_NUM_SAP + ssap);
197 197
198 set_bit(BIT(ssap), &local->local_sdp); 198 set_bit(ssap, &local->local_sdp);
199 mutex_unlock(&local->sdp_lock); 199 mutex_unlock(&local->sdp_lock);
200 200
201 return LLCP_WKS_NUM_SAP + ssap; 201 return LLCP_WKS_NUM_SAP + ssap;
202 202
203 } else if (sock->ssap != 0) { 203 } else if (sock->ssap != 0) {
204 if (sock->ssap < LLCP_WKS_NUM_SAP) { 204 if (sock->ssap < LLCP_WKS_NUM_SAP) {
205 if (!(local->local_wks & BIT(sock->ssap))) { 205 if (!test_bit(sock->ssap, &local->local_wks)) {
206 set_bit(BIT(sock->ssap), &local->local_wks); 206 set_bit(sock->ssap, &local->local_wks);
207 mutex_unlock(&local->sdp_lock); 207 mutex_unlock(&local->sdp_lock);
208 208
209 return sock->ssap; 209 return sock->ssap;
210 } 210 }
211 211
212 } else if (sock->ssap < LLCP_SDP_NUM_SAP) { 212 } else if (sock->ssap < LLCP_SDP_NUM_SAP) {
213 if (!(local->local_sdp & 213 if (!test_bit(sock->ssap - LLCP_WKS_NUM_SAP,
214 BIT(sock->ssap - LLCP_WKS_NUM_SAP))) { 214 &local->local_sdp)) {
215 set_bit(BIT(sock->ssap - LLCP_WKS_NUM_SAP), 215 set_bit(sock->ssap - LLCP_WKS_NUM_SAP,
216 &local->local_sdp); 216 &local->local_sdp);
217 mutex_unlock(&local->sdp_lock); 217 mutex_unlock(&local->sdp_lock);
218 218
219 return sock->ssap; 219 return sock->ssap;
@@ -238,7 +238,7 @@ u8 nfc_llcp_get_local_ssap(struct nfc_llcp_local *local)
238 return LLCP_SAP_MAX; 238 return LLCP_SAP_MAX;
239 } 239 }
240 240
241 set_bit(BIT(local_ssap), &local->local_sap); 241 set_bit(local_ssap, &local->local_sap);
242 242
243 mutex_unlock(&local->sdp_lock); 243 mutex_unlock(&local->sdp_lock);
244 244
@@ -265,7 +265,7 @@ void nfc_llcp_put_ssap(struct nfc_llcp_local *local, u8 ssap)
265 265
266 mutex_lock(&local->sdp_lock); 266 mutex_lock(&local->sdp_lock);
267 267
268 clear_bit(1 << local_ssap, sdp); 268 clear_bit(local_ssap, sdp);
269 269
270 mutex_unlock(&local->sdp_lock); 270 mutex_unlock(&local->sdp_lock);
271} 271}