diff options
author | David Rientjes <rientjes@google.com> | 2011-03-22 19:34:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:16 -0400 |
commit | 586f83e2b4c080073b115c1a0fcc2757f52839b8 (patch) | |
tree | 72d1647d12216e7fb74f4567f583de2ed732a75d /drivers/pnp | |
parent | ff859ba6d166202d6fd8d6344a41be54e4c8a2b6 (diff) |
pnp: only assign IORESOURCE_DMA if CONFIG_ISA_DMA_API is enabled
IORESOURCE_DMA cannot be assigned without utilizing the interface
provided by CONFIG_ISA_DMA_API, specifically request_dma() and
free_dma(). Thus, there's a strict dependency on the config option and
limits IORESOURCE_DMA only to architectures that support ISA-style DMA.
ia64 is not one of those architectures, so pnp_check_dma() no longer
needs to be special-cased for that architecture.
pnp_assign_resources() will now return -EINVAL if IORESOURCE_DMA is
attempted on such a kernel.
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/base.h | 2 | ||||
-rw-r--r-- | drivers/pnp/manager.c | 7 | ||||
-rw-r--r-- | drivers/pnp/resource.c | 7 |
3 files changed, 10 insertions, 6 deletions
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h index 19bc73695475..fa4e0a5db3f8 100644 --- a/drivers/pnp/base.h +++ b/drivers/pnp/base.h | |||
@@ -142,7 +142,9 @@ void __pnp_remove_device(struct pnp_dev *dev); | |||
142 | int pnp_check_port(struct pnp_dev *dev, struct resource *res); | 142 | int pnp_check_port(struct pnp_dev *dev, struct resource *res); |
143 | int pnp_check_mem(struct pnp_dev *dev, struct resource *res); | 143 | int pnp_check_mem(struct pnp_dev *dev, struct resource *res); |
144 | int pnp_check_irq(struct pnp_dev *dev, struct resource *res); | 144 | int pnp_check_irq(struct pnp_dev *dev, struct resource *res); |
145 | #ifdef CONFIG_ISA_DMA_API | ||
145 | int pnp_check_dma(struct pnp_dev *dev, struct resource *res); | 146 | int pnp_check_dma(struct pnp_dev *dev, struct resource *res); |
147 | #endif | ||
146 | 148 | ||
147 | char *pnp_resource_type_name(struct resource *res); | 149 | char *pnp_resource_type_name(struct resource *res); |
148 | void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc); | 150 | void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc); |
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 0a15664eef1c..ed9ce507149a 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
@@ -171,6 +171,7 @@ __add: | |||
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | #ifdef CONFIG_ISA_DMA_API | ||
174 | static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) | 175 | static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) |
175 | { | 176 | { |
176 | struct resource *res, local_res; | 177 | struct resource *res, local_res; |
@@ -210,6 +211,7 @@ __add: | |||
210 | pnp_add_dma_resource(dev, res->start, res->flags); | 211 | pnp_add_dma_resource(dev, res->start, res->flags); |
211 | return 0; | 212 | return 0; |
212 | } | 213 | } |
214 | #endif /* CONFIG_ISA_DMA_API */ | ||
213 | 215 | ||
214 | void pnp_init_resources(struct pnp_dev *dev) | 216 | void pnp_init_resources(struct pnp_dev *dev) |
215 | { | 217 | { |
@@ -234,7 +236,8 @@ static void pnp_clean_resource_table(struct pnp_dev *dev) | |||
234 | static int pnp_assign_resources(struct pnp_dev *dev, int set) | 236 | static int pnp_assign_resources(struct pnp_dev *dev, int set) |
235 | { | 237 | { |
236 | struct pnp_option *option; | 238 | struct pnp_option *option; |
237 | int nport = 0, nmem = 0, nirq = 0, ndma = 0; | 239 | int nport = 0, nmem = 0, nirq = 0; |
240 | int ndma __maybe_unused = 0; | ||
238 | int ret = 0; | 241 | int ret = 0; |
239 | 242 | ||
240 | pnp_dbg(&dev->dev, "pnp_assign_resources, try dependent set %d\n", set); | 243 | pnp_dbg(&dev->dev, "pnp_assign_resources, try dependent set %d\n", set); |
@@ -256,9 +259,11 @@ static int pnp_assign_resources(struct pnp_dev *dev, int set) | |||
256 | case IORESOURCE_IRQ: | 259 | case IORESOURCE_IRQ: |
257 | ret = pnp_assign_irq(dev, &option->u.irq, nirq++); | 260 | ret = pnp_assign_irq(dev, &option->u.irq, nirq++); |
258 | break; | 261 | break; |
262 | #ifdef CONFIG_ISA_DMA_API | ||
259 | case IORESOURCE_DMA: | 263 | case IORESOURCE_DMA: |
260 | ret = pnp_assign_dma(dev, &option->u.dma, ndma++); | 264 | ret = pnp_assign_dma(dev, &option->u.dma, ndma++); |
261 | break; | 265 | break; |
266 | #endif | ||
262 | default: | 267 | default: |
263 | ret = -EINVAL; | 268 | ret = -EINVAL; |
264 | break; | 269 | break; |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index a925e6b63d72..b0ecacbe53b1 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -409,9 +409,9 @@ int pnp_check_irq(struct pnp_dev *dev, struct resource *res) | |||
409 | return 1; | 409 | return 1; |
410 | } | 410 | } |
411 | 411 | ||
412 | #ifdef CONFIG_ISA_DMA_API | ||
412 | int pnp_check_dma(struct pnp_dev *dev, struct resource *res) | 413 | int pnp_check_dma(struct pnp_dev *dev, struct resource *res) |
413 | { | 414 | { |
414 | #ifndef CONFIG_IA64 | ||
415 | int i; | 415 | int i; |
416 | struct pnp_dev *tdev; | 416 | struct pnp_dev *tdev; |
417 | struct resource *tres; | 417 | struct resource *tres; |
@@ -466,11 +466,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res) | |||
466 | } | 466 | } |
467 | 467 | ||
468 | return 1; | 468 | return 1; |
469 | #else | ||
470 | /* IA64 does not have legacy DMA */ | ||
471 | return 0; | ||
472 | #endif | ||
473 | } | 469 | } |
470 | #endif /* CONFIG_ISA_DMA_API */ | ||
474 | 471 | ||
475 | unsigned long pnp_resource_type(struct resource *res) | 472 | unsigned long pnp_resource_type(struct resource *res) |
476 | { | 473 | { |