thermal: rockchip: optimize sensor auto accessing period
[firefly-linux-kernel-4.4.55.git] / net / atm / common.c
index 737bef59ce899adc0a3e0ba67ea3d56536e5b7e5..49a872db7e42581853cc2e8c1a6585285a3172d4 100644 (file)
@@ -141,7 +141,7 @@ static struct proto vcc_proto = {
        .release_cb = vcc_release_cb,
 };
 
-int vcc_create(struct net *net, struct socket *sock, int protocol, int family)
+int vcc_create(struct net *net, struct socket *sock, int protocol, int family, int kern)
 {
        struct sock *sk;
        struct atm_vcc *vcc;
@@ -149,7 +149,7 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family)
        sock->sk = NULL;
        if (sock->type == SOCK_STREAM)
                return -EINVAL;
-       sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto);
+       sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto, kern);
        if (!sk)
                return -ENOMEM;
        sock_init_data(sock, sk);
@@ -300,7 +300,7 @@ static int adjust_tp(struct atm_trafprm *tp, unsigned char aal)
                max_sdu = ATM_MAX_AAL34_PDU;
                break;
        default:
-               pr_warning("AAL problems ... (%d)\n", aal);
+               pr_warn("AAL problems ... (%d)\n", aal);
                /* fall through */
        case ATM_AAL5:
                max_sdu = ATM_MAX_AAL5_PDU;
@@ -523,16 +523,14 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci)
        return 0;
 }
 
-int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
-               size_t size, int flags)
+int vcc_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
+               int flags)
 {
        struct sock *sk = sock->sk;
        struct atm_vcc *vcc;
        struct sk_buff *skb;
        int copied, error = -EINVAL;
 
-       msg->msg_namelen = 0;
-
        if (sock->state != SS_CONNECTED)
                return -ENOTCONN;
 
@@ -556,7 +554,7 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
                msg->msg_flags |= MSG_TRUNC;
        }
 
-       error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
+       error = skb_copy_datagram_msg(skb, 0, msg, copied);
        if (error)
                return error;
        sock_recv_ts_and_drops(msg, sk, skb);
@@ -571,16 +569,13 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
        return copied;
 }
 
-int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
-               size_t total_len)
+int vcc_sendmsg(struct socket *sock, struct msghdr *m, size_t size)
 {
        struct sock *sk = sock->sk;
        DEFINE_WAIT(wait);
        struct atm_vcc *vcc;
        struct sk_buff *skb;
        int eff, error;
-       const void __user *buff;
-       int size;
 
        lock_sock(sk);
        if (sock->state != SS_CONNECTED) {
@@ -591,12 +586,6 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
                error = -EISCONN;
                goto out;
        }
-       if (m->msg_iovlen != 1) {
-               error = -ENOSYS; /* fix this later @@@ */
-               goto out;
-       }
-       buff = m->msg_iov->iov_base;
-       size = m->msg_iov->iov_len;
        vcc = ATM_SD(sock);
        if (test_bit(ATM_VF_RELEASED, &vcc->flags) ||
            test_bit(ATM_VF_CLOSE, &vcc->flags) ||
@@ -609,7 +598,7 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
                error = 0;
                goto out;
        }
-       if (size < 0 || size > vcc->qos.txtp.max_sdu) {
+       if (size > vcc->qos.txtp.max_sdu) {
                error = -EMSGSIZE;
                goto out;
        }
@@ -641,7 +630,7 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
                goto out;
        skb->dev = NULL; /* for paths shared with net_device interfaces */
        ATM_SKB(skb)->atm_options = vcc->atm_options;
-       if (copy_from_user(skb_put(skb, size), buff, size)) {
+       if (copy_from_iter(skb_put(skb, size), size, &m->msg_iter) != size) {
                kfree_skb(skb);
                error = -EFAULT;
                goto out;