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
......@@ -118,7 +118,7 @@ u8 *nfc_llcp_build_tlv(u8 type, u8 *value, u8 value_length, u8 *tlv_length)
}
int nfc_llcp_parse_tlv(struct nfc_llcp_local *local,
u8 *tlv_array, u16 tlv_array_len)
u8 *tlv_array, u16 tlv_array_len)
{
u8 *tlv = tlv_array, type, length, offset = 0;
......@@ -164,15 +164,15 @@ int nfc_llcp_parse_tlv(struct nfc_llcp_local *local,
}
pr_debug("version 0x%x miu %d lto %d opt 0x%x wks 0x%x rw %d\n",
local->remote_version, local->remote_miu,
local->remote_lto, local->remote_opt,
local->remote_wks, local->remote_rw);
local->remote_version, local->remote_miu,
local->remote_lto, local->remote_opt,
local->remote_wks, local->remote_rw);
return 0;
}
static struct sk_buff *llcp_add_header(struct sk_buff *pdu,
u8 dsap, u8 ssap, u8 ptype)
u8 dsap, u8 ssap, u8 ptype)
{
u8 header[2];
......@@ -188,7 +188,8 @@ static struct sk_buff *llcp_add_header(struct sk_buff *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 */
......@@ -201,7 +202,7 @@ static struct sk_buff *llcp_add_tlv(struct sk_buff *pdu, u8 *tlv, u8 tlv_length)
}
static struct sk_buff *llcp_allocate_pdu(struct nfc_llcp_sock *sock,
u8 cmd, u16 size)
u8 cmd, u16 size)
{
struct sk_buff *skb;
int err;
......@@ -210,7 +211,7 @@ static struct sk_buff *llcp_allocate_pdu(struct nfc_llcp_sock *sock,
return NULL;
skb = nfc_alloc_send_skb(sock->dev, &sock->sk, MSG_DONTWAIT,
size + LLCP_HEADER_SIZE, &err);
size + LLCP_HEADER_SIZE, &err);
if (skb == NULL) {
pr_err("Could not allocate PDU\n");
return NULL;
......@@ -278,7 +279,7 @@ int nfc_llcp_send_symm(struct nfc_dev *dev)
skb = llcp_add_header(skb, 0, 0, LLCP_PDU_SYMM);
return nfc_data_exchange(dev, local->target_idx, skb,
nfc_llcp_recv, local);
nfc_llcp_recv, local);
}
int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
......@@ -300,14 +301,15 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
if (sock->service_name != NULL) {
service_name_tlv = nfc_llcp_build_tlv(LLCP_TLV_SN,
sock->service_name,
sock->service_name_len,
&service_name_tlv_length);
sock->service_name,
sock->service_name_len,
&service_name_tlv_length);
size += service_name_tlv_length;
}
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;
rw = LLCP_MAX_RW;
......@@ -324,7 +326,7 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
if (service_name_tlv != NULL)
skb = llcp_add_tlv(skb, service_name_tlv,
service_name_tlv_length);
service_name_tlv_length);
skb = llcp_add_tlv(skb, miux_tlv, miux_tlv_length);
skb = llcp_add_tlv(skb, rw_tlv, rw_tlv_length);
......@@ -360,7 +362,8 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
return -ENODEV;
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;
rw = LLCP_MAX_RW;
......@@ -443,7 +446,7 @@ int nfc_llcp_send_disconnect(struct nfc_llcp_sock *sock)
}
int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
struct msghdr *msg, size_t len)
struct msghdr *msg, size_t len)
{
struct sk_buff *pdu;
struct sock *sk = &sock->sk;
......@@ -462,8 +465,8 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
return -ENOMEM;
if (memcpy_fromiovec(msg_data, msg->msg_iov, len)) {
kfree(msg_data);
return -EFAULT;
kfree(msg_data);
return -EFAULT;
}
remaining_len = len;
......
This diff is collapsed.
......@@ -166,7 +166,7 @@ struct nfc_llcp_sock {
struct nfc_llcp_local *nfc_llcp_find_local(struct nfc_dev *dev);
u8 nfc_llcp_get_sdp_ssap(struct nfc_llcp_local *local,
struct nfc_llcp_sock *sock);
struct nfc_llcp_sock *sock);
u8 nfc_llcp_get_local_ssap(struct nfc_llcp_local *local);
void nfc_llcp_put_ssap(struct nfc_llcp_local *local, u8 ssap);
int nfc_llcp_queue_i_frames(struct nfc_llcp_sock *sock);
......@@ -180,7 +180,7 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *sk, struct socket *newsock);
/* TLV API */
int nfc_llcp_parse_tlv(struct nfc_llcp_local *local,
u8 *tlv_array, u16 tlv_array_len);
u8 *tlv_array, u16 tlv_array_len);
/* Commands API */
void nfc_llcp_recv(void *data, struct sk_buff *skb, int err);
......@@ -193,7 +193,7 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock);
int nfc_llcp_send_dm(struct nfc_llcp_local *local, u8 ssap, u8 dsap, u8 reason);
int nfc_llcp_send_disconnect(struct nfc_llcp_sock *sock);
int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
struct msghdr *msg, size_t len);
struct msghdr *msg, size_t len);
int nfc_llcp_send_rr(struct nfc_llcp_sock *sock);
/* Socket API */
......
......@@ -78,9 +78,11 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
llcp_sock->local = local;
llcp_sock->nfc_protocol = llcp_addr.nfc_protocol;
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_len, GFP_KERNEL);
llcp_sock->service_name_len,
GFP_KERNEL);
llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock);
if (llcp_sock->ssap == LLCP_MAX_SAP)
......@@ -110,7 +112,7 @@ static int llcp_sock_listen(struct socket *sock, int backlog)
lock_sock(sk);
if ((sock->type != SOCK_SEQPACKET && sock->type != SOCK_STREAM)
|| sk->sk_state != LLCP_BOUND) {
|| sk->sk_state != LLCP_BOUND) {
ret = -EBADFD;
goto error;
}
......@@ -149,13 +151,13 @@ void nfc_llcp_accept_enqueue(struct sock *parent, struct sock *sk)
sock_hold(sk);
list_add_tail(&llcp_sock->accept_queue,
&llcp_sock_parent->accept_queue);
&llcp_sock_parent->accept_queue);
llcp_sock->parent = parent;
sk_acceptq_added(parent);
}
struct sock *nfc_llcp_accept_dequeue(struct sock *parent,
struct socket *newsock)
struct socket *newsock)
{
struct nfc_llcp_sock *lsk, *n, *llcp_parent;
struct sock *sk;
......@@ -163,7 +165,7 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *parent,
llcp_parent = nfc_llcp_sock(parent);
list_for_each_entry_safe(lsk, n, &llcp_parent->accept_queue,
accept_queue) {
accept_queue) {
sk = &lsk->sk;
lock_sock(sk);
......@@ -192,7 +194,7 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *parent,
}
static int llcp_sock_accept(struct socket *sock, struct socket *newsock,
int flags)
int flags)
{
DECLARE_WAITQUEUE(wait, current);
struct sock *sk = sock->sk, *new_sk;
......@@ -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,
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 nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
......@@ -262,7 +264,7 @@ static int llcp_sock_getname(struct socket *sock, struct sockaddr *addr,
llcp_addr->ssap = llcp_sock->ssap;
llcp_addr->service_name_len = llcp_sock->service_name_len;
memcpy(llcp_addr->service_name, llcp_sock->service_name,
llcp_addr->service_name_len);
llcp_addr->service_name_len);
return 0;
}
......@@ -275,7 +277,7 @@ static inline unsigned int llcp_accept_poll(struct sock *parent)
parent_sock = nfc_llcp_sock(parent);
list_for_each_entry_safe(llcp_sock, n, &parent_sock->accept_queue,
accept_queue) {
accept_queue) {
sk = &llcp_sock->sk;
if (sk->sk_state == LLCP_CONNECTED)
......@@ -286,7 +288,7 @@ static inline unsigned int llcp_accept_poll(struct sock *parent)
}
static unsigned int llcp_sock_poll(struct file *file, struct socket *sock,
poll_table *wait)
poll_table *wait)
{
struct sock *sk = sock->sk;
unsigned int mask = 0;
......@@ -348,7 +350,7 @@ static int llcp_sock_release(struct socket *sock)
struct sock *accept_sk;
list_for_each_entry_safe(lsk, n, &llcp_sock->accept_queue,
accept_queue) {
accept_queue) {
accept_sk = &lsk->sk;
lock_sock(accept_sk);
......@@ -363,9 +365,8 @@ static int llcp_sock_release(struct socket *sock)
/* Freeing the SAP */
if ((sk->sk_state == LLCP_CONNECTED
&& llcp_sock->ssap > LLCP_LOCAL_SAP_OFFSET) ||
sk->sk_state == LLCP_BOUND ||
sk->sk_state == LLCP_LISTEN)
&& llcp_sock->ssap > LLCP_LOCAL_SAP_OFFSET) ||
sk->sk_state == LLCP_BOUND || sk->sk_state == LLCP_LISTEN)
nfc_llcp_put_ssap(llcp_sock->local, llcp_sock->ssap);
release_sock(sk);
......@@ -378,7 +379,7 @@ static int llcp_sock_release(struct socket *sock)
}
static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
int len, int flags)
int len, int flags)
{
struct sock *sk = sock->sk;
struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
......@@ -390,7 +391,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
pr_debug("sock %p sk %p flags 0x%x\n", sock, sk, flags);
if (!addr || len < sizeof(struct sockaddr_nfc) ||
addr->sa_family != AF_NFC) {
addr->sa_family != AF_NFC) {
pr_err("Invalid socket\n");
return -EINVAL;
}
......@@ -401,7 +402,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
}
pr_debug("addr dev_idx=%u target_idx=%u protocol=%u\n", addr->dev_idx,
addr->target_idx, addr->nfc_protocol);
addr->target_idx, addr->nfc_protocol);
lock_sock(sk);
......@@ -431,7 +432,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
device_unlock(&dev->dev);
if (local->rf_mode == NFC_RF_INITIATOR &&
addr->target_idx != local->target_idx) {
addr->target_idx != local->target_idx) {
ret = -ENOLINK;
goto put_dev;
}
......@@ -449,9 +450,11 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
llcp_sock->dsap = LLCP_SAP_SDP;
llcp_sock->nfc_protocol = addr->nfc_protocol;
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_len, GFP_KERNEL);
llcp_sock->service_name_len,
GFP_KERNEL);
local->sockets[llcp_sock->ssap] = llcp_sock;
......@@ -473,7 +476,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
}
static int llcp_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len)
struct msghdr *msg, size_t len)
{
struct sock *sk = sock->sk;
struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
......@@ -514,7 +517,7 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
lock_sock(sk);
if (sk->sk_state == LLCP_CLOSED &&
skb_queue_empty(&sk->sk_receive_queue)) {
skb_queue_empty(&sk->sk_receive_queue)) {
release_sock(sk);
return 0;
}
......@@ -527,7 +530,7 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
skb = skb_recv_datagram(sk, flags, noblock, &err);
if (!skb) {
pr_err("Recv datagram failed state %d %d %d",
sk->sk_state, err, sock_error(sk));
sk->sk_state, err, sock_error(sk));
if (sk->sk_shutdown & RCV_SHUTDOWN)
return 0;
......@@ -535,7 +538,7 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
return err;
}
rlen = skb->len; /* real length of skb */
rlen = skb->len; /* real length of skb */
copied = min_t(unsigned int, rlen, len);
cskb = skb;
......@@ -664,7 +667,7 @@ void nfc_llcp_sock_free(struct nfc_llcp_sock *sock)
}
static int llcp_sock_create(struct net *net, struct socket *sock,
const struct nfc_protocol *nfc_proto)
const struct nfc_protocol *nfc_proto)
{
struct sock *sk;
......
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