diff options
author | Thierry Escande <thierry.escande@linux.intel.com> | 2013-04-02 04:25:16 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-04-11 10:28:59 -0400 |
commit | 064f370c5fd982e1264c03f5b704e00f5e41eb36 (patch) | |
tree | 636fc8d9c23ef114e7bf702f0d49ac53786c7b2e /net/nfc/llcp/sock.c | |
parent | abd18d43302ae0e214d020c842b34e706cc3778e (diff) |
NFC: llcp: Add support in getsockopt for RW, LTO, and MIU remote parameters
Useful for LLCP validation tests.
Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp/sock.c')
-rw-r--r-- | net/nfc/llcp/sock.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index 641c535be3d4..fd01ac6e0bf4 100644 --- a/net/nfc/llcp/sock.c +++ b/net/nfc/llcp/sock.c | |||
@@ -303,7 +303,7 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname, | |||
303 | struct sock *sk = sock->sk; | 303 | struct sock *sk = sock->sk; |
304 | struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk); | 304 | struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk); |
305 | int len, err = 0; | 305 | int len, err = 0; |
306 | u16 miux; | 306 | u16 miux, remote_miu; |
307 | u8 rw; | 307 | u8 rw; |
308 | 308 | ||
309 | pr_debug("%p optname %d\n", sk, optname); | 309 | pr_debug("%p optname %d\n", sk, optname); |
@@ -339,6 +339,27 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname, | |||
339 | 339 | ||
340 | break; | 340 | break; |
341 | 341 | ||
342 | case NFC_LLCP_REMOTE_MIU: | ||
343 | remote_miu = llcp_sock->remote_miu > LLCP_MAX_MIU ? | ||
344 | local->remote_miu : llcp_sock->remote_miu; | ||
345 | |||
346 | if (put_user(remote_miu, (u32 __user *) optval)) | ||
347 | err = -EFAULT; | ||
348 | |||
349 | break; | ||
350 | |||
351 | case NFC_LLCP_REMOTE_LTO: | ||
352 | if (put_user(local->remote_lto / 10, (u32 __user *) optval)) | ||
353 | err = -EFAULT; | ||
354 | |||
355 | break; | ||
356 | |||
357 | case NFC_LLCP_REMOTE_RW: | ||
358 | if (put_user(llcp_sock->remote_rw, (u32 __user *) optval)) | ||
359 | err = -EFAULT; | ||
360 | |||
361 | break; | ||
362 | |||
342 | default: | 363 | default: |
343 | err = -ENOPROTOOPT; | 364 | err = -ENOPROTOOPT; |
344 | break; | 365 | break; |