Commit 427a2eb1 authored by Samuel Ortiz's avatar Samuel Ortiz Committed by John W. Linville

NFC: LLCP code identation fixes

Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 40c75f81
...@@ -188,7 +188,8 @@ static struct sk_buff *llcp_add_header(struct sk_buff *pdu, ...@@ -188,7 +188,8 @@ static struct sk_buff *llcp_add_header(struct sk_buff *pdu,
return pdu; return pdu;
} }
static struct sk_buff *llcp_add_tlv(struct sk_buff *pdu, u8 *tlv, u8 tlv_length) static struct sk_buff *llcp_add_tlv(struct sk_buff *pdu, u8 *tlv,
u8 tlv_length)
{ {
/* XXX Add an skb length check */ /* XXX Add an skb length check */
...@@ -307,7 +308,8 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) ...@@ -307,7 +308,8 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
} }
miux = cpu_to_be16(LLCP_MAX_MIUX); miux = cpu_to_be16(LLCP_MAX_MIUX);
miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0, &miux_tlv_length); miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
&miux_tlv_length);
size += miux_tlv_length; size += miux_tlv_length;
rw = LLCP_MAX_RW; rw = LLCP_MAX_RW;
...@@ -360,7 +362,8 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock) ...@@ -360,7 +362,8 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
return -ENODEV; return -ENODEV;
miux = cpu_to_be16(LLCP_MAX_MIUX); miux = cpu_to_be16(LLCP_MAX_MIUX);
miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0, &miux_tlv_length); miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
&miux_tlv_length);
size += miux_tlv_length; size += miux_tlv_length;
rw = LLCP_MAX_RW; rw = LLCP_MAX_RW;
......
...@@ -37,7 +37,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local) ...@@ -37,7 +37,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local)
struct sock *sk, *parent_sk; struct sock *sk, *parent_sk;
int i; int i;
mutex_lock(&local->socket_lock); mutex_lock(&local->socket_lock);
for (i = 0; i < LLCP_MAX_SAP; i++) { for (i = 0; i < LLCP_MAX_SAP; i++) {
...@@ -164,7 +163,7 @@ static int nfc_llcp_wks_sap(char *service_name, size_t service_name_len) ...@@ -164,7 +163,7 @@ static int nfc_llcp_wks_sap(char *service_name, size_t service_name_len)
num_wks = ARRAY_SIZE(wks); num_wks = ARRAY_SIZE(wks);
for (sap = 0 ; sap < num_wks; sap++) { for (sap = 0; sap < num_wks; sap++) {
if (wks[sap] == NULL) if (wks[sap] == NULL)
continue; continue;
...@@ -367,8 +366,7 @@ int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len) ...@@ -367,8 +366,7 @@ int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len)
memcpy(local->remote_gb, gb, gb_len); memcpy(local->remote_gb, gb, gb_len);
local->remote_gb_len = gb_len; local->remote_gb_len = gb_len;
if (local->remote_gb == NULL || if (local->remote_gb == NULL || local->remote_gb_len == 0)
local->remote_gb_len == 0)
return -ENODEV; return -ENODEV;
if (memcmp(local->remote_gb, llcp_magic, 3)) { if (memcmp(local->remote_gb, llcp_magic, 3)) {
...@@ -377,7 +375,8 @@ int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len) ...@@ -377,7 +375,8 @@ int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len)
} }
return nfc_llcp_parse_tlv(local, return nfc_llcp_parse_tlv(local,
&local->remote_gb[3], local->remote_gb_len - 3); &local->remote_gb[3],
local->remote_gb_len - 3);
} }
static void nfc_llcp_tx_work(struct work_struct *work) static void nfc_llcp_tx_work(struct work_struct *work)
...@@ -588,8 +587,7 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local, ...@@ -588,8 +587,7 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local,
goto fail; goto fail;
} }
new_sk = nfc_llcp_sock_alloc(NULL, parent->sk_type, new_sk = nfc_llcp_sock_alloc(NULL, parent->sk_type, GFP_ATOMIC);
GFP_ATOMIC);
if (new_sk == NULL) { if (new_sk == NULL) {
reason = LLCP_DM_REJ; reason = LLCP_DM_REJ;
release_sock(&sock->sk); release_sock(&sock->sk);
...@@ -757,7 +755,6 @@ static void nfc_llcp_recv_disc(struct nfc_llcp_local *local, ...@@ -757,7 +755,6 @@ static void nfc_llcp_recv_disc(struct nfc_llcp_local *local,
nfc_llcp_sock_put(llcp_sock); nfc_llcp_sock_put(llcp_sock);
} }
if (sk->sk_state == LLCP_CONNECTED) { if (sk->sk_state == LLCP_CONNECTED) {
nfc_put_device(local->dev); nfc_put_device(local->dev);
sk->sk_state = LLCP_CLOSED; sk->sk_state = LLCP_CLOSED;
...@@ -770,13 +767,11 @@ static void nfc_llcp_recv_disc(struct nfc_llcp_local *local, ...@@ -770,13 +767,11 @@ static void nfc_llcp_recv_disc(struct nfc_llcp_local *local,
nfc_llcp_sock_put(llcp_sock); nfc_llcp_sock_put(llcp_sock);
} }
static void nfc_llcp_recv_cc(struct nfc_llcp_local *local, static void nfc_llcp_recv_cc(struct nfc_llcp_local *local, struct sk_buff *skb)
struct sk_buff *skb)
{ {
struct nfc_llcp_sock *llcp_sock; struct nfc_llcp_sock *llcp_sock;
u8 dsap, ssap; u8 dsap, ssap;
dsap = nfc_llcp_dsap(skb); dsap = nfc_llcp_dsap(skb);
ssap = nfc_llcp_ssap(skb); ssap = nfc_llcp_ssap(skb);
...@@ -861,7 +856,7 @@ void nfc_llcp_recv(void *data, struct sk_buff *skb, int err) ...@@ -861,7 +856,7 @@ void nfc_llcp_recv(void *data, struct sk_buff *skb, int err)
pr_debug("Received an LLCP PDU\n"); pr_debug("Received an LLCP PDU\n");
if (err < 0) { if (err < 0) {
pr_err("err %d", err); pr_err("err %d\n", err);
return; return;
} }
...@@ -933,8 +928,10 @@ int nfc_llcp_register_device(struct nfc_dev *ndev) ...@@ -933,8 +928,10 @@ int nfc_llcp_register_device(struct nfc_dev *ndev)
skb_queue_head_init(&local->tx_queue); skb_queue_head_init(&local->tx_queue);
INIT_WORK(&local->tx_work, nfc_llcp_tx_work); INIT_WORK(&local->tx_work, nfc_llcp_tx_work);
snprintf(name, sizeof(name), "%s_llcp_tx_wq", dev_name(dev)); snprintf(name, sizeof(name), "%s_llcp_tx_wq", dev_name(dev));
local->tx_wq = alloc_workqueue(name, local->tx_wq =
WQ_NON_REENTRANT | WQ_UNBOUND | WQ_MEM_RECLAIM, 1); alloc_workqueue(name,
WQ_NON_REENTRANT | WQ_UNBOUND | WQ_MEM_RECLAIM,
1);
if (local->tx_wq == NULL) { if (local->tx_wq == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto err_local; goto err_local;
...@@ -943,8 +940,10 @@ int nfc_llcp_register_device(struct nfc_dev *ndev) ...@@ -943,8 +940,10 @@ int nfc_llcp_register_device(struct nfc_dev *ndev)
local->rx_pending = NULL; local->rx_pending = NULL;
INIT_WORK(&local->rx_work, nfc_llcp_rx_work); INIT_WORK(&local->rx_work, nfc_llcp_rx_work);
snprintf(name, sizeof(name), "%s_llcp_rx_wq", dev_name(dev)); snprintf(name, sizeof(name), "%s_llcp_rx_wq", dev_name(dev));
local->rx_wq = alloc_workqueue(name, local->rx_wq =
WQ_NON_REENTRANT | WQ_UNBOUND | WQ_MEM_RECLAIM, 1); alloc_workqueue(name,
WQ_NON_REENTRANT | WQ_UNBOUND | WQ_MEM_RECLAIM,
1);
if (local->rx_wq == NULL) { if (local->rx_wq == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto err_tx_wq; goto err_tx_wq;
...@@ -952,8 +951,10 @@ int nfc_llcp_register_device(struct nfc_dev *ndev) ...@@ -952,8 +951,10 @@ int nfc_llcp_register_device(struct nfc_dev *ndev)
INIT_WORK(&local->timeout_work, nfc_llcp_timeout_work); INIT_WORK(&local->timeout_work, nfc_llcp_timeout_work);
snprintf(name, sizeof(name), "%s_llcp_timeout_wq", dev_name(dev)); snprintf(name, sizeof(name), "%s_llcp_timeout_wq", dev_name(dev));
local->timeout_wq = alloc_workqueue(name, local->timeout_wq =
WQ_NON_REENTRANT | WQ_UNBOUND | WQ_MEM_RECLAIM, 1); alloc_workqueue(name,
WQ_NON_REENTRANT | WQ_UNBOUND | WQ_MEM_RECLAIM,
1);
if (local->timeout_wq == NULL) { if (local->timeout_wq == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto err_rx_wq; goto err_rx_wq;
......
...@@ -78,9 +78,11 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) ...@@ -78,9 +78,11 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
llcp_sock->local = local; llcp_sock->local = local;
llcp_sock->nfc_protocol = llcp_addr.nfc_protocol; llcp_sock->nfc_protocol = llcp_addr.nfc_protocol;
llcp_sock->service_name_len = min_t(unsigned int, llcp_sock->service_name_len = min_t(unsigned int,
llcp_addr.service_name_len, NFC_LLCP_MAX_SERVICE_NAME); llcp_addr.service_name_len,
NFC_LLCP_MAX_SERVICE_NAME);
llcp_sock->service_name = kmemdup(llcp_addr.service_name, llcp_sock->service_name = kmemdup(llcp_addr.service_name,
llcp_sock->service_name_len, GFP_KERNEL); llcp_sock->service_name_len,
GFP_KERNEL);
llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock); llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock);
if (llcp_sock->ssap == LLCP_MAX_SAP) if (llcp_sock->ssap == LLCP_MAX_SAP)
...@@ -248,7 +250,7 @@ static int llcp_sock_accept(struct socket *sock, struct socket *newsock, ...@@ -248,7 +250,7 @@ static int llcp_sock_accept(struct socket *sock, struct socket *newsock,
static int llcp_sock_getname(struct socket *sock, struct sockaddr *addr, static int llcp_sock_getname(struct socket *sock, struct sockaddr *addr,
int *len, int peer) int *len, int peer)
{ {
struct sockaddr_nfc_llcp *llcp_addr = (struct sockaddr_nfc_llcp *) addr; struct sockaddr_nfc_llcp *llcp_addr = (struct sockaddr_nfc_llcp *)addr;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk); struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
...@@ -364,8 +366,7 @@ static int llcp_sock_release(struct socket *sock) ...@@ -364,8 +366,7 @@ static int llcp_sock_release(struct socket *sock)
/* Freeing the SAP */ /* Freeing the SAP */
if ((sk->sk_state == LLCP_CONNECTED if ((sk->sk_state == LLCP_CONNECTED
&& llcp_sock->ssap > LLCP_LOCAL_SAP_OFFSET) || && llcp_sock->ssap > LLCP_LOCAL_SAP_OFFSET) ||
sk->sk_state == LLCP_BOUND || sk->sk_state == LLCP_BOUND || sk->sk_state == LLCP_LISTEN)
sk->sk_state == LLCP_LISTEN)
nfc_llcp_put_ssap(llcp_sock->local, llcp_sock->ssap); nfc_llcp_put_ssap(llcp_sock->local, llcp_sock->ssap);
release_sock(sk); release_sock(sk);
...@@ -449,9 +450,11 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, ...@@ -449,9 +450,11 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
llcp_sock->dsap = LLCP_SAP_SDP; llcp_sock->dsap = LLCP_SAP_SDP;
llcp_sock->nfc_protocol = addr->nfc_protocol; llcp_sock->nfc_protocol = addr->nfc_protocol;
llcp_sock->service_name_len = min_t(unsigned int, llcp_sock->service_name_len = min_t(unsigned int,
addr->service_name_len, NFC_LLCP_MAX_SERVICE_NAME); addr->service_name_len,
NFC_LLCP_MAX_SERVICE_NAME);
llcp_sock->service_name = kmemdup(addr->service_name, llcp_sock->service_name = kmemdup(addr->service_name,
llcp_sock->service_name_len, GFP_KERNEL); llcp_sock->service_name_len,
GFP_KERNEL);
local->sockets[llcp_sock->ssap] = llcp_sock; local->sockets[llcp_sock->ssap] = llcp_sock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment