[DCCP]: Fix sparse warnings

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 09274f3..21948d0 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -82,12 +82,13 @@
 
 static int ccid3_debug;
 
-struct dccp_tx_hist *ccid3_tx_hist;
-struct dccp_rx_hist *ccid3_rx_hist;
+static struct dccp_tx_hist *ccid3_tx_hist;
+static struct dccp_rx_hist *ccid3_rx_hist;
 
 static kmem_cache_t *ccid3_loss_interval_hist_slab;
 
-static inline struct ccid3_loss_interval_hist_entry *ccid3_loss_interval_hist_entry_new(int prio)
+static inline struct ccid3_loss_interval_hist_entry *
+	ccid3_loss_interval_hist_entry_new(const unsigned int __nocast prio)
 {
 	return kmem_cache_alloc(ccid3_loss_interval_hist_slab, prio);
 }
@@ -1593,7 +1594,9 @@
  * These are integers as per section 8 of RFC3448. We can then divide by 4 *
  * when we use it.
  */
-const int ccid3_hc_rx_w[TFRC_RECV_IVAL_F_LENGTH] = { 4, 4, 4, 4, 3, 2, 1, 1, };
+static const int ccid3_hc_rx_w[TFRC_RECV_IVAL_F_LENGTH] = {
+	4, 4, 4, 4, 3, 2, 1, 1,
+};
 
 /*
  * args: fvalue - function value to match
@@ -1601,7 +1604,7 @@
  *
  * both fvalue and p are multiplied by 1,000,000 to use ints
  */
-u32 calcx_reverse_lookup(u32 fvalue) {
+static u32 calcx_reverse_lookup(u32 fvalue) {
 	int ctr = 0;
 	int small;
 
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 270f194..148e8a6 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -231,19 +231,22 @@
 extern struct sk_buff	*dccp_make_response(struct sock *sk,
 					    struct dst_entry *dst,
 					    struct request_sock *req);
+extern struct sk_buff	*dccp_make_reset(struct sock *sk,
+					 struct dst_entry *dst,
+					 enum dccp_reset_codes code);
 
 extern int	   dccp_connect(struct sock *sk);
 extern int	   dccp_disconnect(struct sock *sk, int flags);
 extern int	   dccp_getsockopt(struct sock *sk, int level, int optname,
-				   char *optval, int *optlen);
+				   char __user *optval, int __user *optlen);
+extern int	   dccp_setsockopt(struct sock *sk, int level, int optname,
+				   char __user *optval, int optlen);
 extern int	   dccp_ioctl(struct sock *sk, int cmd, unsigned long arg);
 extern int	   dccp_sendmsg(struct kiocb *iocb, struct sock *sk,
 				struct msghdr *msg, size_t size);
 extern int	   dccp_recvmsg(struct kiocb *iocb, struct sock *sk,
 				struct msghdr *msg, size_t len, int nonblock,
 				int flags, int *addr_len);
-extern int	   dccp_setsockopt(struct sock *sk, int level, int optname,
-				   char *optval, int optlen);
 extern void	   dccp_shutdown(struct sock *sk, int how);
 
 extern int	   dccp_v4_checksum(const struct sk_buff *skb,
@@ -419,7 +422,9 @@
 	u8			dccpap_buf[0];
 };
 
-extern struct dccp_ackpkts *dccp_ackpkts_alloc(unsigned int len, int priority);
+extern struct dccp_ackpkts *
+		dccp_ackpkts_alloc(unsigned int len,
+				  const unsigned int __nocast priority);
 extern void dccp_ackpkts_free(struct dccp_ackpkts *ap);
 extern int dccp_ackpkts_add(struct dccp_ackpkts *ap, u64 ackno, u8 state);
 extern void dccp_ackpkts_check_rcv_ackno(struct dccp_ackpkts *ap,
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 42d9c87..bc3cfc0 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -617,9 +617,6 @@
 	sock_put(sk);
 }
 
-extern struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst,
-				       enum dccp_reset_codes code);
-
 int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code)
 {
 	struct sk_buff *skb;
@@ -881,7 +878,7 @@
 	return &rt->u.dst;
 }
 
-void dccp_v4_ctl_send_reset(struct sk_buff *rxskb)
+static void dccp_v4_ctl_send_reset(struct sk_buff *rxskb)
 {
 	int err;
 	struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh;
@@ -1268,7 +1265,7 @@
 	return 0;
 }
 
-int dccp_v4_destroy_sock(struct sock *sk)
+static int dccp_v4_destroy_sock(struct sock *sk)
 {
 	struct dccp_sock *dp = dccp_sk(sk);
 
diff --git a/net/dccp/options.c b/net/dccp/options.c
index fc363aa..d87d6be 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -499,7 +499,8 @@
 	}
 }
 
-struct dccp_ackpkts *dccp_ackpkts_alloc(unsigned int len, int priority)
+struct dccp_ackpkts *dccp_ackpkts_alloc(const unsigned int len,
+				        const unsigned int __nocast priority)
 {
 	struct dccp_ackpkts *ap = kmalloc(sizeof(*ap) + len, priority);
 
diff --git a/net/dccp/packet_history.h b/net/dccp/packet_history.h
index 489fff4..2e5ba34 100644
--- a/net/dccp/packet_history.h
+++ b/net/dccp/packet_history.h
@@ -79,8 +79,8 @@
 		dccp_rx_hist_find_data_packet(const struct list_head *list);
 
 static inline struct dccp_tx_hist_entry *
-			dccp_tx_hist_entry_new(struct dccp_tx_hist *hist,
-					       const int prio)
+		dccp_tx_hist_entry_new(struct dccp_tx_hist *hist,
+				       const unsigned int __nocast prio)
 {
 	struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab,
 							    prio);
@@ -127,10 +127,10 @@
 }
 
 static inline struct dccp_rx_hist_entry *
-			     dccp_rx_hist_entry_new(struct dccp_rx_hist *hist,
-					     	    const u32 ndp, 
-						    const struct sk_buff *skb,
-						    const int prio)
+		     dccp_rx_hist_entry_new(struct dccp_rx_hist *hist,
+				     	    const u32 ndp, 
+					    const struct sk_buff *skb,
+					    const unsigned int __nocast prio)
 {
 	struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab,
 							    prio);
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index be06692..0b715ce 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -147,7 +147,7 @@
 }
 
 int dccp_setsockopt(struct sock *sk, int level, int optname,
-		    char *optval, int optlen)
+		    char __user *optval, int optlen)
 {
 	dccp_pr_debug("entry\n");
 
@@ -158,7 +158,7 @@
 }
 
 int dccp_getsockopt(struct sock *sk, int level, int optname,
-		    char *optval, int *optlen)
+		    char __user *optval, int __user *optlen)
 {
 	dccp_pr_debug("entry\n");
 
@@ -439,7 +439,7 @@
 	dccp_pr_debug("entry\n");
 }
 
-struct proto_ops inet_dccp_ops = {
+static struct proto_ops inet_dccp_ops = {
 	.family		= PF_INET,
 	.owner		= THIS_MODULE,
 	.release	= inet_release,
@@ -539,9 +539,11 @@
 module_param(thash_entries, int, 0444);
 MODULE_PARM_DESC(thash_entries, "Number of ehash buckets");
 
+#ifdef CONFIG_IP_DCCP_DEBUG
 int dccp_debug;
 module_param(dccp_debug, int, 0444);
 MODULE_PARM_DESC(dccp_debug, "Enable debug messages");
+#endif
 
 static int __init dccp_init(void)
 {