From: David Brownell <david-b@pacbell.net>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: mru@users.sourceforge.net, linux-kernel@vger.kernel.org,
Michal Jaegermann <michal@harddata.com>
Subject: Re: USB and DMA on Alpha with 2.6.0-test7
Date: Sat, 11 Oct 2003 16:03:46 -0700 [thread overview]
Message-ID: <3F888C52.9050006@pacbell.net> (raw)
In-Reply-To: <3F882F20.5090903@pacbell.net>
[-- Attachment #1: Type: text/plain, Size: 395 bytes --]
> Ivan Kokshaysky wrote:
>>
>> This doesn't work. You will always return success if mask = ~0ULL.
Whoops. I didn't copy what I thought I was copying:
(mask & *dev->dma_mask) == mask /* not "== dma_mask" */
Updated code is appended ... which also provides a BUG()-free
version of dma_set_mask(). I think the only arch/platform hook
needed would be for dma_supported().
- Dave
[-- Attachment #2: Diff.dma --]
[-- Type: text/plain, Size: 877 bytes --]
--- 1.4/include/asm-generic/dma-mapping.h Mon Jan 13 14:37:47 2003
+++ edited/include/asm-generic/dma-mapping.h Sat Oct 11 15:33:56 2003
@@ -13,20 +13,22 @@
/* need struct page definitions */
#include <linux/mm.h>
+/* FIXME use this everywhere there's no platform_dma_supported() */
static inline int
dma_supported(struct device *dev, u64 mask)
{
- BUG_ON(dev->bus != &pci_bus_type);
-
- return pci_dma_supported(to_pci_dev(dev), mask);
+ /* device can dma, using those address bits */
+ return dev->dma_mask
+ && (mask & *dev->dma_mask) == mask;
}
static inline int
-dma_set_mask(struct device *dev, u64 dma_mask)
+dma_set_mask(struct device *dev, u64 mask)
{
- BUG_ON(dev->bus != &pci_bus_type);
-
- return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
+ if (!dma_supported(dev, mask))
+ return 0;
+ *dev->dma_mask = mask;
+ return 1;
}
static inline void *
next prev parent reply other threads:[~2003-10-11 22:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-10 17:18 USB and DMA on Alpha with 2.6.0-test7 David Brownell
2003-10-10 18:19 ` Ivan Kokshaysky
2003-10-10 18:45 ` Måns Rullgård
2003-10-10 18:59 ` Ivan Kokshaysky
2003-10-10 20:15 ` David Brownell
2003-10-10 19:43 ` David Brownell
2003-10-11 13:27 ` Ivan Kokshaysky
2003-10-11 16:26 ` David Brownell
2003-10-11 23:03 ` David Brownell [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-10-10 9:22 Måns Rullgård
2003-10-10 10:47 ` Ivan Kokshaysky
2003-10-10 11:38 ` Måns Rullgård
2003-10-10 13:31 ` Jamie Lokier
2003-10-10 13:41 ` Ivan Kokshaysky
2003-10-10 16:41 ` Måns Rullgård
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=3F888C52.9050006@pacbell.net \
--to=david-b@pacbell.net \
--cc=ink@jurassic.park.msu.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=michal@harddata.com \
--cc=mru@users.sourceforge.net \
/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