lkml.org 
[lkml]   [2008]   [Jul]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateWed, 2 Jul 2008 08:10:00 +0300
FromAdrian Bunk <>
Subject[RFC: 2.6 patch] remove the switch in b43legacy_dma_init()
On Mon, Jun 30, 2008 at 04:18:25PM -0700, Andrew Morton wrote:
> On Fri, 13 Jun 2008 14:09:58 +0100
> David Howells <dhowells@redhat.com> wrote:
> 
> > Provide __ucmpdi2() for MN10300 so that allmodconfig can be built.
> 
> Well...  x86 has this problem as well, and when it pops up we address
> it by going in and looking at the codesite which is generating the call
> and fixing it.  And I do mean "fixing", because it's often the case
> that the caller was doing something silly and inefficient.

In this case I'd blame the gcc 3.4 fork used by MN10300.

> So are you sure that we should do this, rather than massaging the
> callers?

Patch to fix the callers (if wanted) is below.

cu
Adrian


<--  snip  -->


The gcc 3.4 fork used to compile the MN10300 port emits unwanted 
__ucmpdi2() calls for this switch on a 64bit value.

Fix it by transforming the switch to equivalent "if ... else if ..."
statements.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
a89c72d736986777b2cc4e07589aa46e957c15a5 
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index c990f87..794dc83 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -1028,19 +1028,15 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
 	enum b43legacy_dmatype type;
 
 	dmamask = supported_dma_mask(dev);
-	switch (dmamask) {
-	default:
-		B43legacy_WARN_ON(1);
-	case DMA_30BIT_MASK:
+
+	if (dmamask == DMA_30BIT_MASK)
 		type = B43legacy_DMA_30BIT;
-		break;
-	case DMA_32BIT_MASK:
+	else if (dmamask == DMA_32BIT_MASK)
 		type = B43legacy_DMA_32BIT;
-		break;
-	case DMA_64BIT_MASK:
+	else if (dmamask == DMA_64BIT_MASK)
 		type = B43legacy_DMA_64BIT;
-		break;
-	}
+	else
+		B43legacy_WARN_ON(1);
 
 	err = ssb_dma_set_mask(dev->dev, dmamask);
 	if (err) {


\
 
 \ /
  Last update: 2008-07-02 07:13    [from the cache]
©2003-2008