include/net net/ - csum_partial - remove unnecessary casts
authorJoe Perches <joe@perches.com>
Wed, 19 Nov 2008 23:44:53 +0000 (15:44 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Nov 2008 23:44:53 +0000 (15:44 -0800)
The first argument to csum_partial is const void *
casts to char/u8 * are not necessary

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/checksum.h
include/net/ip_vs.h
net/core/netpoll.c
net/ipv4/inet_lro.c
net/ipv4/tcp_ipv4.c
net/ipv6/icmp.c
net/ipv6/mcast.c
net/ipv6/ndisc.c
net/ipv6/tcp_ipv6.c
net/unix/af_unix.c

index 07602b7fa2185970d14f7af67f6a5f996c92bfe3..ba55d8b8c87cb5438f87fad5ae01d2aee77d59ab 100644 (file)
@@ -98,7 +98,7 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
 {
        __be32 diff[] = { ~from, to };
 
-       *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
+       *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum)));
 }
 
 static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to)
index 8f6abf4883e3008a77b92fbf0c778582bd242b02..ab9b003ab671b0755cb5467804adc16a89058a9c 100644 (file)
@@ -913,7 +913,7 @@ static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
 {
        __be32 diff[2] = { ~old, new };
 
-       return csum_partial((char *) diff, sizeof(diff), oldsum);
+       return csum_partial(diff, sizeof(diff), oldsum);
 }
 
 #ifdef CONFIG_IP_VS_IPV6
@@ -923,7 +923,7 @@ static inline __wsum ip_vs_check_diff16(const __be32 *old, const __be32 *new,
        __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0],
                            new[3],  new[2],  new[1],  new[0] };
 
-       return csum_partial((char *) diff, sizeof(diff), oldsum);
+       return csum_partial(diff, sizeof(diff), oldsum);
 }
 #endif
 
@@ -931,7 +931,7 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
 {
        __be16 diff[2] = { ~old, new };
 
-       return csum_partial((char *) diff, sizeof(diff), oldsum);
+       return csum_partial(diff, sizeof(diff), oldsum);
 }
 
 #endif /* __KERNEL__ */
index 34f5d072f1688040d62ddcce0fff6ce02645311e..fc4e28e23b8953e57e39a853acfce82a455321ed 100644 (file)
@@ -343,7 +343,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
        udph->check = csum_tcpudp_magic(htonl(np->local_ip),
                                        htonl(np->remote_ip),
                                        udp_len, IPPROTO_UDP,
-                                       csum_partial((unsigned char *)udph, udp_len, 0));
+                                       csum_partial(udph, udp_len, 0));
        if (udph->check == 0)
                udph->check = CSUM_MANGLED_0;
 
index cfd034a2b96ed7926f5139aeb161a58ba1820b2f..6a667dae315ec577661f944bb3cd56dfb905c103 100644 (file)
@@ -120,7 +120,7 @@ static void lro_update_tcp_ip_header(struct net_lro_desc *lro_desc)
        iph->check = ip_fast_csum((u8 *)lro_desc->iph, iph->ihl);
 
        tcph->check = 0;
-       tcp_hdr_csum = csum_partial((u8 *)tcph, TCP_HDR_LEN(tcph), 0);
+       tcp_hdr_csum = csum_partial(tcph, TCP_HDR_LEN(tcph), 0);
        lro_desc->data_csum = csum_add(lro_desc->data_csum, tcp_hdr_csum);
        tcph->check = csum_tcpudp_magic(iph->saddr, iph->daddr,
                                        lro_desc->ip_tot_len -
@@ -135,7 +135,7 @@ static __wsum lro_tcp_data_csum(struct iphdr *iph, struct tcphdr *tcph, int len)
        __wsum tcp_ps_hdr_csum;
 
        tcp_csum = ~csum_unfold(tcph->check);
-       tcp_hdr_csum = csum_partial((u8 *)tcph, TCP_HDR_LEN(tcph), tcp_csum);
+       tcp_hdr_csum = csum_partial(tcph, TCP_HDR_LEN(tcph), tcp_csum);
 
        tcp_ps_hdr_csum = csum_tcpudp_nofold(iph->saddr, iph->daddr,
                                             len + TCP_HDR_LEN(tcph),
index b2e3ab2287baa57ef883ba572cc76e29bb18f247..5559fea61e877593b5b19a05202ff94e19fe8b50 100644 (file)
@@ -492,7 +492,7 @@ void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb)
                skb->csum_offset = offsetof(struct tcphdr, check);
        } else {
                th->check = tcp_v4_check(len, inet->saddr, inet->daddr,
-                                        csum_partial((char *)th,
+                                        csum_partial(th,
                                                      th->doff << 2,
                                                      skb->csum));
        }
@@ -726,7 +726,7 @@ static int __tcp_v4_send_synack(struct sock *sk, struct request_sock *req,
                th->check = tcp_v4_check(skb->len,
                                         ireq->loc_addr,
                                         ireq->rmt_addr,
-                                        csum_partial((char *)th, skb->len,
+                                        csum_partial(th, skb->len,
                                                      skb->csum));
 
                err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr,
index be351009fd03830042ad6eba11bb1767bfdbcc40..a77b8d10380405f9bc4d7cfd01f2b8a35310bd76 100644 (file)
@@ -233,7 +233,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
        icmp6h->icmp6_cksum = 0;
 
        if (skb_queue_len(&sk->sk_write_queue) == 1) {
-               skb->csum = csum_partial((char *)icmp6h,
+               skb->csum = csum_partial(icmp6h,
                                        sizeof(struct icmp6hdr), skb->csum);
                icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src,
                                                      &fl->fl6_dst,
@@ -246,7 +246,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
                        tmp_csum = csum_add(tmp_csum, skb->csum);
                }
 
-               tmp_csum = csum_partial((char *)icmp6h,
+               tmp_csum = csum_partial(icmp6h,
                                        sizeof(struct icmp6hdr), tmp_csum);
                icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src,
                                                      &fl->fl6_dst,
index a76199ecad23fae2688fca8223eb98633dab6e22..870a1d64605a559346feaaf3576d570b454544cb 100644 (file)
@@ -1817,7 +1817,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
 
        hdr->icmp6_cksum = csum_ipv6_magic(saddr, snd_addr, len,
                                           IPPROTO_ICMPV6,
-                                          csum_partial((__u8 *) hdr, len, 0));
+                                          csum_partial(hdr, len, 0));
 
        idev = in6_dev_get(skb->dev);
 
index fbf451c0d77ae469bc7ea0bd54a11728d826a468..af6705f03b5cdb6e4e41cf0e1abc950f27584b8b 100644 (file)
@@ -491,7 +491,7 @@ struct sk_buff *ndisc_build_skb(struct net_device *dev,
 
        hdr->icmp6_cksum = csum_ipv6_magic(saddr, daddr, len,
                                           IPPROTO_ICMPV6,
-                                          csum_partial((__u8 *) hdr,
+                                          csum_partial(hdr,
                                                        len, 0));
 
        return skb;
@@ -1612,7 +1612,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
 
        icmph->icmp6_cksum = csum_ipv6_magic(&saddr_buf, &ipv6_hdr(skb)->saddr,
                                             len, IPPROTO_ICMPV6,
-                                            csum_partial((u8 *) icmph, len, 0));
+                                            csum_partial(icmph, len, 0));
 
        buff->dst = dst;
        idev = in6_dev_get(dst->dev);
index b35787056313ffeb970efc1c1483ac0020b77ffb..a5d750acd793be5743ae7c3db9896f25309919a0 100644 (file)
@@ -501,7 +501,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req)
 
                th->check = tcp_v6_check(th, skb->len,
                                         &treq->loc_addr, &treq->rmt_addr,
-                                        csum_partial((char *)th, skb->len, skb->csum));
+                                        csum_partial(th, skb->len, skb->csum));
 
                ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr);
                err = ip6_xmit(sk, skb, &fl, opt, 0);
@@ -915,7 +915,7 @@ static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb)
                skb->csum_offset = offsetof(struct tcphdr, check);
        } else {
                th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP,
-                                           csum_partial((char *)th, th->doff<<2,
+                                           csum_partial(th, th->doff<<2,
                                                         skb->csum));
        }
 }
@@ -997,7 +997,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
        }
 #endif
 
-       buff->csum = csum_partial((char *)t1, tot_len, 0);
+       buff->csum = csum_partial(t1, tot_len, 0);
 
        memset(&fl, 0, sizeof(fl));
        ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
index f2cf3f583f626df8bba6cb2bf5df417530eb9ca3..ebc4a9a4b1f75ad166bcbe98130e2fe4763eb076 100644 (file)
@@ -216,7 +216,7 @@ static int unix_mkname(struct sockaddr_un *sunaddr, int len, unsigned *hashp)
                return len;
        }
 
-       *hashp = unix_hash_fold(csum_partial((char *)sunaddr, len, 0));
+       *hashp = unix_hash_fold(csum_partial(sunaddr, len, 0));
        return len;
 }
 
@@ -686,7 +686,7 @@ static int unix_autobind(struct socket *sock)
 
 retry:
        addr->len = sprintf(addr->name->sun_path+1, "%05x", ordernum) + 1 + sizeof(short);
-       addr->hash = unix_hash_fold(csum_partial((void *)addr->name, addr->len, 0));
+       addr->hash = unix_hash_fold(csum_partial(addr->name, addr->len, 0));
 
        spin_lock(&unix_table_lock);
        ordernum = (ordernum+1)&0xFFFFF;