aboutsummaryrefslogtreecommitdiff
path: root/drivers/pnp/pnpacpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 16:34:35 -0600
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:28 -0400
commitdc16f5f2ede8cc2acf8ac22857a7fecf3a4296c2 (patch)
treeb4ba965b7c5e1e6011697160aa5346b63afbbbf9 /drivers/pnp/pnpacpi
parentdbddd0383c59d588f8db5e773b062756e39117ec (diff)
PNP: make generic pnp_add_dma_resource()
Add a pnp_add_dma_resource() that can be used by all the PNP backends. This consolidates a little more pnp_resource_table knowledge into one place. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 0b67dff1e7c..fc7cf73b7a7 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -158,34 +158,6 @@ static int dma_flags(int type, int bus_master, int transfer)
return flags;
}
-static void pnpacpi_parse_allocated_dmaresource(struct pnp_dev *dev,
- u32 dma, int flags)
-{
- struct resource *res;
- int i;
- static unsigned char warned;
-
- for (i = 0; i < PNP_MAX_DMA; i++) {
- res = pnp_get_resource(dev, IORESOURCE_DMA, i);
- if (!pnp_resource_valid(res))
- break;
- }
- if (i < PNP_MAX_DMA) {
- res->flags = IORESOURCE_DMA; // Also clears _UNSET flag
- res->flags |= flags;
- if (dma == -1) {
- res->flags |= IORESOURCE_DISABLED;
- return;
- }
- res->start = dma;
- res->end = dma;
- } else if (!warned) {
- printk(KERN_WARNING "pnpacpi: exceeded the max number of DMA "
- "resources: %d \n", PNP_MAX_DMA);
- warned = 1;
- }
-}
-
static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev,
u64 io, u64 len, int io_decode)
{
@@ -285,7 +257,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
struct acpi_resource_memory32 *memory32;
struct acpi_resource_fixed_memory32 *fixed_memory32;
struct acpi_resource_extended_irq *extended_irq;
- int i;
+ int i, flags;
switch (res->type) {
case ACPI_RESOURCE_TYPE_IRQ:
@@ -305,11 +277,13 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
case ACPI_RESOURCE_TYPE_DMA:
dma = &res->data.dma;
- if (dma->channel_count > 0)
- pnpacpi_parse_allocated_dmaresource(dev,
- dma->channels[0],
- dma_flags(dma->type, dma->bus_master,
- dma->transfer));
+ if (dma->channel_count > 0) {
+ flags = dma_flags(dma->type, dma->bus_master,
+ dma->transfer);
+ if (dma->channels[0] == (u8) -1)
+ flags |= IORESOURCE_DISABLED;
+ pnp_add_dma_resource(dev, dma->channels[0], flags);
+ }
break;
case ACPI_RESOURCE_TYPE_IO: