Commit 586f83e2 authored by David Rientjes's avatar David Rientjes Committed by Linus Torvalds

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: default avatarDavid 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ff859ba6
...@@ -142,7 +142,9 @@ void __pnp_remove_device(struct pnp_dev *dev); ...@@ -142,7 +142,9 @@ void __pnp_remove_device(struct pnp_dev *dev);
int pnp_check_port(struct pnp_dev *dev, struct resource *res); int pnp_check_port(struct pnp_dev *dev, struct resource *res);
int pnp_check_mem(struct pnp_dev *dev, struct resource *res); int pnp_check_mem(struct pnp_dev *dev, struct resource *res);
int pnp_check_irq(struct pnp_dev *dev, struct resource *res); int pnp_check_irq(struct pnp_dev *dev, struct resource *res);
#ifdef CONFIG_ISA_DMA_API
int pnp_check_dma(struct pnp_dev *dev, struct resource *res); int pnp_check_dma(struct pnp_dev *dev, struct resource *res);
#endif
char *pnp_resource_type_name(struct resource *res); char *pnp_resource_type_name(struct resource *res);
void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc); void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
......
...@@ -171,6 +171,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) ...@@ -171,6 +171,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
return 0; return 0;
} }
#ifdef CONFIG_ISA_DMA_API
static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
{ {
struct resource *res, local_res; struct resource *res, local_res;
...@@ -210,6 +211,7 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) ...@@ -210,6 +211,7 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
pnp_add_dma_resource(dev, res->start, res->flags); pnp_add_dma_resource(dev, res->start, res->flags);
return 0; return 0;
} }
#endif /* CONFIG_ISA_DMA_API */
void pnp_init_resources(struct pnp_dev *dev) void pnp_init_resources(struct pnp_dev *dev)
{ {
...@@ -234,7 +236,8 @@ static void pnp_clean_resource_table(struct pnp_dev *dev) ...@@ -234,7 +236,8 @@ static void pnp_clean_resource_table(struct pnp_dev *dev)
static int pnp_assign_resources(struct pnp_dev *dev, int set) static int pnp_assign_resources(struct pnp_dev *dev, int set)
{ {
struct pnp_option *option; struct pnp_option *option;
int nport = 0, nmem = 0, nirq = 0, ndma = 0; int nport = 0, nmem = 0, nirq = 0;
int ndma __maybe_unused = 0;
int ret = 0; int ret = 0;
pnp_dbg(&dev->dev, "pnp_assign_resources, try dependent set %d\n", set); 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,9 +259,11 @@ static int pnp_assign_resources(struct pnp_dev *dev, int set)
case IORESOURCE_IRQ: case IORESOURCE_IRQ:
ret = pnp_assign_irq(dev, &option->u.irq, nirq++); ret = pnp_assign_irq(dev, &option->u.irq, nirq++);
break; break;
#ifdef CONFIG_ISA_DMA_API
case IORESOURCE_DMA: case IORESOURCE_DMA:
ret = pnp_assign_dma(dev, &option->u.dma, ndma++); ret = pnp_assign_dma(dev, &option->u.dma, ndma++);
break; break;
#endif
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
......
...@@ -409,9 +409,9 @@ int pnp_check_irq(struct pnp_dev *dev, struct resource *res) ...@@ -409,9 +409,9 @@ int pnp_check_irq(struct pnp_dev *dev, struct resource *res)
return 1; return 1;
} }
#ifdef CONFIG_ISA_DMA_API
int pnp_check_dma(struct pnp_dev *dev, struct resource *res) int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
{ {
#ifndef CONFIG_IA64
int i; int i;
struct pnp_dev *tdev; struct pnp_dev *tdev;
struct resource *tres; struct resource *tres;
...@@ -466,11 +466,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res) ...@@ -466,11 +466,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
} }
return 1; return 1;
#else
/* IA64 does not have legacy DMA */
return 0;
#endif
} }
#endif /* CONFIG_ISA_DMA_API */
unsigned long pnp_resource_type(struct resource *res) unsigned long pnp_resource_type(struct resource *res)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment