diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-06-21 20:04:53 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-07-09 16:42:16 -0400 |
commit | b8e7a06d9cd4c0e778b1d12cef1ef414e0fb6d7e (patch) | |
tree | 556ed1c0cbdc5946893b6ad88bb6896d5e07044a /net/nfc/llcp | |
parent | 12e5bdfefa45ecacd22c519875d06113f95a26af (diff) |
NFC: Build LLCP general bytes upon request
Drivers will need them before starting a poll or when being activated
as targets. Mostly WKS can have changed between device registration and
then so we need to re-build the whole array.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp')
-rw-r--r-- | net/nfc/llcp/llcp.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c index eee4b9286f8d..6812b1e4f025 100644 --- a/net/nfc/llcp/llcp.c +++ b/net/nfc/llcp/llcp.c | |||
@@ -310,21 +310,6 @@ void nfc_llcp_put_ssap(struct nfc_llcp_local *local, u8 ssap) | |||
310 | mutex_unlock(&local->sdp_lock); | 310 | mutex_unlock(&local->sdp_lock); |
311 | } | 311 | } |
312 | 312 | ||
313 | u8 *nfc_llcp_general_bytes(struct nfc_dev *dev, size_t *general_bytes_len) | ||
314 | { | ||
315 | struct nfc_llcp_local *local; | ||
316 | |||
317 | local = nfc_llcp_find_local(dev); | ||
318 | if (local == NULL) { | ||
319 | *general_bytes_len = 0; | ||
320 | return NULL; | ||
321 | } | ||
322 | |||
323 | *general_bytes_len = local->gb_len; | ||
324 | |||
325 | return local->gb; | ||
326 | } | ||
327 | |||
328 | static int nfc_llcp_build_gb(struct nfc_llcp_local *local) | 313 | static int nfc_llcp_build_gb(struct nfc_llcp_local *local) |
329 | { | 314 | { |
330 | u8 *gb_cur, *version_tlv, version, version_length; | 315 | u8 *gb_cur, *version_tlv, version, version_length; |
@@ -386,6 +371,23 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local) | |||
386 | return 0; | 371 | return 0; |
387 | } | 372 | } |
388 | 373 | ||
374 | u8 *nfc_llcp_general_bytes(struct nfc_dev *dev, size_t *general_bytes_len) | ||
375 | { | ||
376 | struct nfc_llcp_local *local; | ||
377 | |||
378 | local = nfc_llcp_find_local(dev); | ||
379 | if (local == NULL) { | ||
380 | *general_bytes_len = 0; | ||
381 | return NULL; | ||
382 | } | ||
383 | |||
384 | nfc_llcp_build_gb(local); | ||
385 | |||
386 | *general_bytes_len = local->gb_len; | ||
387 | |||
388 | return local->gb; | ||
389 | } | ||
390 | |||
389 | int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len) | 391 | int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len) |
390 | { | 392 | { |
391 | struct nfc_llcp_local *local = nfc_llcp_find_local(dev); | 393 | struct nfc_llcp_local *local = nfc_llcp_find_local(dev); |