public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sven-Thorsten Dietrich <sdietrich@mvista.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: dwalker@mvista.com, LKML <linux-kernel@vger.kernel.org>
Subject: [patch] IPV4 spinlock_casting
Date: Sun, 07 Aug 2005 19:04:21 -0700	[thread overview]
Message-ID: <1123466661.20677.14.camel@localhost.localdomain> (raw)

Fix a compile error in net/ipv4/route.c when RT patch is applied:

LD      .tmp_vmlinux1
net/built-in.o(.text+0x19058): In function `rt_check_expire':
net/ipv4/route.c:628: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x1907a):net/ipv4/route.c:661: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x1918b): In function `rt_run_flush':
net/ipv4/route.c:684: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x191a3):net/ipv4/route.c:688: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x193b9): In function `rt_garbage_collect':
net/ipv4/route.c:821: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x193e7):net/ipv4/route.c:853: more undefined references to `__bad_spinlock_type' follow
make: *** [.tmp_vmlinux1] Error 1

Problem is related to the RT PICK_OP function.

Adds explicit casting to spinlock_t (whatever that happens to be for the
given .config)

Signed-off-by: Sven-Thorsten Dietrich <sdietrich@mvista.com>

Index: linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c
===================================================================
--- linux-2.6.13-rc4-RT-V0.7.52-14.orig/net/ipv4/route.c
+++ linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c
@@ -228,7 +228,7 @@
 		rt_hash_locks = kmalloc(sizeof(spinlock_t) * RT_HASH_LOCK_SZ, GFP_KERNEL); \
 		if (!rt_hash_locks) panic("IP: failed to allocate rt_hash_locks\n"); \
 		for (i = 0; i < RT_HASH_LOCK_SZ; i++) \
-			spin_lock_init(&rt_hash_locks[i]); \
+			spin_lock_init((spinlock_t *) &rt_hash_locks[i]); \
 		}
 #else
 # define rt_hash_lock_addr(slot) NULL
@@ -625,7 +625,7 @@
 
 		if (*rthp == 0)
 			continue;
-		spin_lock(rt_hash_lock_addr(i));
+		spin_lock((spinlock_t *) rt_hash_lock_addr(i));
 		while ((rth = *rthp) != NULL) {
 			if (rth->u.dst.expires) {
 				/* Entry is expired even if it is in use */
@@ -658,7 +658,7 @@
  			rt_free(rth);
 #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */
 		}
-		spin_unlock(rt_hash_lock_addr(i));
+		spin_unlock((spinlock_t *) rt_hash_lock_addr(i));
 
 		/* Fallback loop breaker. */
 		if (time_after(jiffies, now))
@@ -681,11 +681,11 @@
 	get_random_bytes(&rt_hash_rnd, 4);
 
 	for (i = rt_hash_mask; i >= 0; i--) {
-		spin_lock_bh(rt_hash_lock_addr(i));
+		spin_lock_bh((spinlock_t *) rt_hash_lock_addr(i));
 		rth = rt_hash_table[i].chain;
 		if (rth)
 			rt_hash_table[i].chain = NULL;
-		spin_unlock_bh(rt_hash_lock_addr(i));
+		spin_unlock_bh((spinlock_t *) rt_hash_lock_addr(i));
 
 		for (; rth; rth = next) {
 			next = rth->u.rt_next;
@@ -818,7 +818,7 @@
 
 			k = (k + 1) & rt_hash_mask;
 			rthp = &rt_hash_table[k].chain;
-			spin_lock_bh(rt_hash_lock_addr(k));
+			spin_lock_bh((spinlock_t *) rt_hash_lock_addr(k));
 			while ((rth = *rthp) != NULL) {
 				if (!rt_may_expire(rth, tmo, expire)) {
 					tmo >>= 1;
@@ -850,7 +850,7 @@
 				goal--;
 #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */
 			}
-			spin_unlock_bh(rt_hash_lock_addr(k));
+			spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(k));
 			if (goal <= 0)
 				break;
 		}
@@ -920,7 +920,7 @@
 
 	rthp = &rt_hash_table[hash].chain;
 
-	spin_lock_bh(rt_hash_lock_addr(hash));
+	spin_lock_bh((spinlock_t *) rt_hash_lock_addr(hash));
 	while ((rth = *rthp) != NULL) {
 #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
 		if (!(rth->u.dst.flags & DST_BALANCED) &&
@@ -946,7 +946,7 @@
 			rth->u.dst.__use++;
 			dst_hold(&rth->u.dst);
 			rth->u.dst.lastuse = now;
-			spin_unlock_bh(rt_hash_lock_addr(hash));
+			spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(hash));
 
 			rt_drop(rt);
 			*rp = rth;
@@ -987,7 +987,7 @@
 	if (rt->rt_type == RTN_UNICAST || rt->fl.iif == 0) {
 		int err = arp_bind_neighbour(&rt->u.dst);
 		if (err) {
-			spin_unlock_bh(rt_hash_lock_addr(hash));
+			spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(hash));
 
 			if (err != -ENOBUFS) {
 				rt_drop(rt);
@@ -1028,7 +1028,7 @@
 	}
 #endif
 	rt_hash_table[hash].chain = rt;
-	spin_unlock_bh(rt_hash_lock_addr(hash));
+	spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(hash));
 	*rp = rt;
 	return 0;
 }
@@ -1096,7 +1096,7 @@
 {
 	struct rtable **rthp;
 
-	spin_lock_bh(rt_hash_lock_addr(hash));
+	spin_lock_bh((spinlock_t *) rt_hash_lock_addr(hash));
 	ip_rt_put(rt);
 	for (rthp = &rt_hash_table[hash].chain; *rthp;
 	     rthp = &(*rthp)->u.rt_next)
@@ -1105,7 +1105,7 @@
 			rt_free(rt);
 			break;
 		}
-	spin_unlock_bh(rt_hash_lock_addr(hash));
+	spin_unlock_bh((spinlock_t *) rt_hash_lock_addr(hash));
 }
 
 void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,



             reply	other threads:[~2005-08-08  4:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-08  2:04 Sven-Thorsten Dietrich [this message]
2005-08-08  9:04 ` [patch] IPV4 spinlock_casting Ingo Molnar
2005-08-08  9:06   ` Ingo Molnar
2005-08-08 19:54     ` Sven-Thorsten Dietrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1123466661.20677.14.camel@localhost.localdomain \
    --to=sdietrich@mvista.com \
    --cc=dwalker@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox