On 14-05-08 01:18, Bjorn Helgaas wrote:
On Tuesday 13 May 2008 11:33:25 am Rene Herman wrote:
No, isa_device is its own thing, on its own isa_bus (*). It has a struct device * readily available though...
(*) drivers/base/isa.c, and explanatory changelog at:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdif...
Thanks for the nice changelog.
isa_register_driver() currently doesn't set a DMA mask. Should it?
If it's going to be useful, definitely. The attached does not just set
dev->dma_mask = &dev->coherent_dma_mask
as in the fallback_dev when dma_alloc_coherent() is passed a NULL device only due to the mask juggling in snd_dma_hack_alloc_coherent() (which wouldn't break, but...) but introduces its own copy in struct isa_dev same as struct pnp_dev. As far as I'm aware, there's no actual reason for keeping it other than that and if the hack could go I'd rather lose the private mask copy again also.
(the device model still uses a plain u64 by the way but I guess the clean type would be a dma64_addr_t)
Inlining is whitespace-failing here. Patch itself is trivial...
I only see about 35 dma_alloc_coherent() calls that pass NULL. I guess even those would be a fair amount of work to change, and I suppose there would be more that I missed.
At least the ALSA one isn't passing a literal NULL it seems. But yes, current NULL-hack reinstatement (it's been merged by Linus already) is definitely the correct fix for now.
Would like a comment on the snd_dma_hack_alloc_coherent thing first (no signoff...) but other than that I'll submit this in preparation for it being useful, I guess?
Rene.
From: Rene Herman rene.herman@gmail.com
ISA: set 24-bit dma_mask for ISA devices
Set the ISA device dma_mask in preparation for using the actual device with the DMA API. --- drivers/base/isa.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/base/isa.c b/drivers/base/isa.c index d222239..842ca08 100644 --- a/drivers/base/isa.c +++ b/drivers/base/isa.c @@ -7,6 +7,8 @@ #include <linux/slab.h> #include <linux/module.h> #include <linux/init.h> +#include <linux/types.h> +#include <linux/dma-mapping.h> #include <linux/isa.h>
static struct device isa_bus = { @@ -17,6 +19,7 @@ struct isa_dev { struct device dev; struct device *next; unsigned int id; + u64 dma_mask; };
#define to_isa_dev(x) container_of((x), struct isa_dev, dev) @@ -131,6 +134,9 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev) break; }
+ isa_dev->id = id; + isa_dev->dma_mask = DMA_24BIT_MASK; + isa_dev->dev.parent = &isa_bus; isa_dev->dev.bus = &isa_bus_type;
@@ -138,8 +144,9 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev) isa_driver->driver.name, id);
isa_dev->dev.platform_data = isa_driver; + isa_dev->dev.dma_mask = &isa_dev->dma_mask; + isa_dev->dev.coherent_dma_mask = isa_dev->dma_mask; isa_dev->dev.release = isa_dev_release; - isa_dev->id = id;
error = device_register(&isa_dev->dev); if (error) {