summaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp/llcp.h
diff options
context:
space:
mode:
authorSamuel Ortiz2012-05-04 17:04:19 +0200
committerSamuel Ortiz2012-06-04 21:34:28 +0200
commita69f32af86e389dd232b1bb2269e202c1bfcc60f (patch)
tree8639421ba70c67ac09f72323a4e5dca2b71e37e7 /net/nfc/llcp/llcp.h
parentNFC: Take a reference on the LLCP local pointer when creating a socket (diff)
downloadkernel-qcow2-linux-a69f32af86e389dd232b1bb2269e202c1bfcc60f.tar.gz
kernel-qcow2-linux-a69f32af86e389dd232b1bb2269e202c1bfcc60f.tar.xz
kernel-qcow2-linux-a69f32af86e389dd232b1bb2269e202c1bfcc60f.zip
NFC: Socket linked list
Simplify the LLCP sockets structure by putting all the connected ones into a single linked list. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp/llcp.h')
-rw-r--r--net/nfc/llcp/llcp.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/nfc/llcp/llcp.h b/net/nfc/llcp/llcp.h
index bc619553821b..705330470062 100644
--- a/net/nfc/llcp/llcp.h
+++ b/net/nfc/llcp/llcp.h
@@ -40,6 +40,11 @@ enum llcp_state {
struct nfc_llcp_sock;
+struct llcp_sock_list {
+ struct hlist_head head;
+ rwlock_t lock;
+};
+
struct nfc_llcp_local {
struct list_head list;
struct nfc_dev *dev;
@@ -47,7 +52,6 @@ struct nfc_llcp_local {
struct kref ref;
struct mutex sdp_lock;
- struct mutex socket_lock;
struct timer_list link_timer;
struct sk_buff_head tx_queue;
@@ -82,12 +86,12 @@ struct nfc_llcp_local {
u8 remote_rw;
/* sockets array */
- struct nfc_llcp_sock *sockets[LLCP_MAX_SAP];
+ struct llcp_sock_list sockets;
+ struct llcp_sock_list connecting_sockets;
};
struct nfc_llcp_sock {
struct sock sk;
- struct list_head list;
struct nfc_dev *dev;
struct nfc_llcp_local *local;
u32 target_idx;
@@ -166,6 +170,8 @@ struct nfc_llcp_sock {
#define LLCP_DM_REJ 0x03
+void nfc_llcp_sock_link(struct llcp_sock_list *l, struct sock *s);
+void nfc_llcp_sock_unlink(struct llcp_sock_list *l, struct sock *s);
struct nfc_llcp_local *nfc_llcp_find_local(struct nfc_dev *dev);
struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local);
int nfc_llcp_local_put(struct nfc_llcp_local *local);