linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Jesse Barnes <jbarnes@virtuousgeek.org>,
	John Linville <linville@tuxdriver.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	David Miller <davem@davemloft.net>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, Ingo Molnar <mingo@elte.hu>,
	bcm43xx-dev@lists.berlios.de, linux-wireless@vger.kernel.org,
	"linux-kernel" <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/3] b43: Use the new weak DMA-mask API
Date: Thu, 1 May 2008 16:43:08 +0200	[thread overview]
Message-ID: <200805011643.08605.mb@bu3sch.de> (raw)
In-Reply-To: <200805011638.15910.mb@bu3sch.de>

This adds a user for the new weak DMA mask API.
This removes the b43 DMA mask probe loop.

Signed-off-by: Michael Buesch <mb@bu3sch.de>


Index: linux-2.6/drivers/net/wireless/b43/dma.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/b43/dma.c	2008-05-01 13:19:51.000000000 +0200
+++ linux-2.6/drivers/net/wireless/b43/dma.c	2008-05-01 14:45:52.000000000 +0200
@@ -980,37 +980,27 @@ void b43_dma_free(struct b43_wldev *dev)
 	destroy_ring(dma, tx_ring_mcast);
 }
 
+static inline unsigned int mask_to_bit(u64 dma_mask)
+{
+	return fls64(dma_mask);
+}
+
 static int b43_dma_set_mask(struct b43_wldev *dev, u64 mask)
 {
 	u64 orig_mask = mask;
-	bool fallback = 0;
 	int err;
 
-	/* Try to set the DMA mask. If it fails, try falling back to a
-	 * lower mask, as we can always also support a lower one. */
-	while (1) {
-		err = ssb_dma_set_mask(dev->dev, mask);
-		if (!err)
-			break;
-		if (mask == DMA_64BIT_MASK) {
-			mask = DMA_32BIT_MASK;
-			fallback = 1;
-			continue;
-		}
-		if (mask == DMA_32BIT_MASK) {
-			mask = DMA_30BIT_MASK;
-			fallback = 1;
-			continue;
-		}
+	err = ssb_dma_set_mask_weak(dev->dev, &mask);
+	if (err) {
 		b43err(dev->wl, "The machine/kernel does not support "
 		       "the required %u-bit DMA mask\n",
-		       (unsigned int)dma_mask_to_engine_type(orig_mask));
+		       mask_to_bit(orig_mask));
 		return -EOPNOTSUPP;
 	}
-	if (fallback) {
+	if (mask != orig_mask) {
 		b43info(dev->wl, "DMA mask fallback from %u-bit to %u-bit\n",
-			(unsigned int)dma_mask_to_engine_type(orig_mask),
-			(unsigned int)dma_mask_to_engine_type(mask));
+			mask_to_bit(orig_mask),
+			mask_to_bit(mask));
 	}
 
 	return 0;


-- 
Greetings Michael.

  parent reply	other threads:[~2008-05-01 14:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-01 14:38 [PATCH 0/3] Add API for weak DMA masks Michael Buesch
2008-05-01  9:00 ` Arjan van de Ven
2008-05-01 14:40 ` [PATCH 1/3] Add dma_set_mask_weak() API Michael Buesch
2008-05-01 16:20   ` Alan Cox
2008-05-01 17:11     ` Michael Buesch
2008-05-01 14:41 ` [PATCH 2/3] ssb: Add weak DMA-mask API Michael Buesch
2008-05-01 14:43 ` Michael Buesch [this message]
2008-05-01 15:36 ` [PATCH 0/3] Add API for weak DMA masks Christoph Hellwig
2008-05-01 15:42   ` Michael Buesch
2008-05-01 15:43     ` Christoph Hellwig
2008-05-01 15:47       ` Michael Buesch
2008-05-01 15:58         ` Christoph Hellwig
2008-05-01 16:07           ` Michael Buesch
2008-05-01 16:30             ` Jesse Barnes
2008-05-01 17:16               ` Michael Buesch
2008-05-01 17:22                 ` Jesse Barnes
2008-05-01 17:25                   ` Michael Buesch
2008-05-01 17:27                 ` Jesse Barnes
2008-05-01 17:33                   ` Michael Buesch
2008-05-01 16:29   ` Alan Cox
2008-05-01 21:39     ` David Miller

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=200805011643.08605.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andi@firstfloor.org \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=davem@davemloft.net \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --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;
as well as URLs for NNTP newsgroup(s).