diff options
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/base.h | 1 | ||||
-rw-r--r-- | drivers/pnp/isapnp/proc.c | 2 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/Kconfig | 16 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 1 | ||||
-rw-r--r-- | drivers/pnp/system.c | 52 |
5 files changed, 30 insertions, 42 deletions
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h index 6b8c4cfd02a6..31a633f65547 100644 --- a/drivers/pnp/base.h +++ b/drivers/pnp/base.h @@ -1,4 +1,3 @@ -extern struct bus_type pnp_bus_type; extern spinlock_t pnp_lock; void *pnp_alloc(long size); int pnp_interface_attach_device(struct pnp_dev *dev); diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c index d21f3c1e72fc..40b724ebe23b 100644 --- a/drivers/pnp/isapnp/proc.c +++ b/drivers/pnp/isapnp/proc.c @@ -85,7 +85,7 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t return nbytes; } -static struct file_operations isapnp_proc_bus_file_operations = +static const struct file_operations isapnp_proc_bus_file_operations = { .llseek = isapnp_proc_bus_lseek, .read = isapnp_proc_bus_read, diff --git a/drivers/pnp/pnpacpi/Kconfig b/drivers/pnp/pnpacpi/Kconfig index b1854171b963..b04767ce273e 100644 --- a/drivers/pnp/pnpacpi/Kconfig +++ b/drivers/pnp/pnpacpi/Kconfig @@ -2,17 +2,5 @@ # Plug and Play ACPI configuration # config PNPACPI - bool "Plug and Play ACPI support (EXPERIMENTAL)" - depends on PNP && ACPI && EXPERIMENTAL - default y - ---help--- - Linux uses the PNPACPI to autodetect built-in - mainboard resources (e.g. parallel port resources). - - Some features (e.g. real hotplug) are not currently - implemented. - - If you would like the kernel to detect and allocate resources to - your mainboard devices (on some systems they are disabled by the - BIOS) say Y here. Also the PNPACPI can help prevent resource - conflicts between mainboard devices and other bus devices. + bool + default (PNP && ACPI) diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 95b79685a9d1..3c2ab8394e3f 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c @@ -530,7 +530,6 @@ pnpbios_parse_compatible_ids(unsigned char *p, unsigned char *end, struct pnp_de dev_id = kzalloc(sizeof (struct pnp_id), GFP_KERNEL); if (!dev_id) return NULL; - memset(dev_id, 0, sizeof(struct pnp_id)); pnpid32_to_pnpid(p[1] | p[2] << 8 | p[3] << 16 | p[4] << 24,id); memcpy(&dev_id->id, id, 7); pnp_add_id(dev_id, dev); diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index d42015c382af..2065e74bb63f 100644 --- a/drivers/pnp/system.c +++ b/drivers/pnp/system.c @@ -3,7 +3,8 @@ * * Some code is based on pnpbios_core.c * Copyright 2002 Adam Belay <ambx1@neo.rr.com> - * + * (c) Copyright 2007 Hewlett-Packard Development Company, L.P. + * Bjorn Helgaas <bjorn.helgaas@hp.com> */ #include <linux/pnp.h> @@ -21,18 +22,21 @@ static const struct pnp_device_id pnp_dev_table[] = { { "", 0 } }; -static void reserve_ioport_range(char *pnpid, int start, int end) +static void reserve_range(char *pnpid, int start, int end, int port) { struct resource *res; char *regionid; regionid = kmalloc(16, GFP_KERNEL); - if ( regionid == NULL ) + if (regionid == NULL) return; snprintf(regionid, 16, "pnp %s", pnpid); - res = request_region(start,end-start+1,regionid); - if ( res == NULL ) - kfree( regionid ); + if (port) + res = request_region(start,end-start+1,regionid); + else + res = request_mem_region(start,end-start+1,regionid); + if (res == NULL) + kfree(regionid); else res->flags &= ~IORESOURCE_BUSY; /* @@ -41,26 +45,20 @@ static void reserve_ioport_range(char *pnpid, int start, int end) * have double reservations. */ printk(KERN_INFO - "pnp: %s: ioport range 0x%x-0x%x %s reserved\n", - pnpid, start, end, - NULL != res ? "has been" : "could not be" - ); - - return; + "pnp: %s: %s range 0x%x-0x%x %s reserved\n", + pnpid, port ? "ioport" : "iomem", start, end, + NULL != res ? "has been" : "could not be"); } -static void reserve_resources_of_dev( struct pnp_dev *dev ) +static void reserve_resources_of_dev(struct pnp_dev *dev) { int i; - for (i=0;i<PNP_MAX_PORT;i++) { + for (i = 0; i < PNP_MAX_PORT; i++) { if (!pnp_port_valid(dev, i)) - /* end of resources */ continue; if (pnp_port_start(dev, i) == 0) - /* disabled */ - /* Do nothing */ - continue; + continue; /* disabled */ if (pnp_port_start(dev, i) < 0x100) /* * Below 0x100 is only standard PC hardware @@ -72,14 +70,18 @@ static void reserve_resources_of_dev( struct pnp_dev *dev ) */ continue; if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) - /* invalid endpoint */ - /* Do nothing */ + continue; /* invalid */ + + reserve_range(dev->dev.bus_id, pnp_port_start(dev, i), + pnp_port_end(dev, i), 1); + } + + for (i = 0; i < PNP_MAX_MEM; i++) { + if (!pnp_mem_valid(dev, i)) continue; - reserve_ioport_range( - dev->dev.bus_id, - pnp_port_start(dev, i), - pnp_port_end(dev, i) - ); + + reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i), + pnp_mem_end(dev, i), 0); } return; |