# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1414 -> 1.1415
# drivers/serial/8250_pnp.c 1.11 -> 1.12
# drivers/pnp/interface.c 1.14 -> 1.15
# drivers/pnp/base.h 1.4 -> 1.5
# drivers/pnp/core.c 1.9 -> 1.10
# drivers/pnp/support.c 1.2 -> 1.3
# drivers/pnp/isapnp/core.c 1.36 -> 1.37
# drivers/pnp/resource.c 1.13 -> 1.14
# drivers/pnp/quirks.c 1.10 -> 1.11
# drivers/pnp/manager.c 1.6 -> 1.7
# include/linux/pnp.h 1.20 -> 1.21
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/06/18 am...@neo.rr.com 1.1415
# [PNP] Resource Management Cleanups and Updates
#
# This patch does the following...
# 1.) changes struct pnp_resources to pnp_option for clarity
# 2.) greatly cleans up resource option registration
# 3.) removes some of the current conflict prevention code in
# order to increase flexibility, (users will have more control)
# 4.) various manager cleanups, resulting code is more efficient
# 5.) fixes the locking bugs many have reported (now uses a mutex)
# 6.) removes the conflict displaying interface
# - it is better to handle such things in user space
# 7.) also many misc. cleanups
# --------------------------------------------
#
diff -Nru a/drivers/pnp/base.h b/drivers/pnp/base.h
--- a/drivers/pnp/base.h Wed Jun 18 23:02:24 2003
+++ b/drivers/pnp/base.h Wed Jun 18 23:02:24 2003
@@ -4,29 +4,11 @@
int pnp_interface_attach_device(struct pnp_dev *dev);
void pnp_name_device(struct pnp_dev *dev);
void pnp_fixup_device(struct pnp_dev *dev);
-void pnp_free_resources(struct pnp_resources *resources);
+void pnp_free_option(struct pnp_option *option);
int __pnp_add_device(struct pnp_dev *dev);
void __pnp_remove_device(struct pnp_dev *dev);
-/* resource conflict types */
-#define CONFLICT_TYPE_NONE 0x0000 /* there are no conflicts, other than those in the link */
-#define CONFLICT_TYPE_RESERVED 0x0001 /* the resource requested was reserved */
-#define CONFLICT_TYPE_IN_USE 0x0002 /* there is a conflict because the resource is in use */
-#define CONFLICT_TYPE_PCI 0x0004 /* there is a conflict with a pci device */
-#define CONFLICT_TYPE_INVALID 0x0008 /* the resource requested is invalid */
-#define CONFLICT_TYPE_INTERNAL 0x0010 /* resources within the device conflict with each ohter */
-#define CONFLICT_TYPE_PNP_WARM 0x0020 /* there is a conflict with a pnp device that is active */
-#define CONFLICT_TYPE_PNP_COLD 0x0040 /* there is a conflict with a pnp device that is disabled */
-
-/* conflict search modes */
-#define SEARCH_WARM 1 /* check for conflicts with active devices */
-#define SEARCH_COLD 0 /* check for conflicts with disabled devices */
-
-struct pnp_dev * pnp_check_port_conflicts(struct pnp_dev * dev, int idx, int mode);
int pnp_check_port(struct pnp_dev * dev, int idx);
-struct pnp_dev * pnp_check_mem_conflicts(struct pnp_dev * dev, int idx, int mode);
int pnp_check_mem(struct pnp_dev * dev, int idx);
-struct pnp_dev * pnp_check_irq_conflicts(struct pnp_dev * dev, int idx, int mode);
int pnp_check_irq(struct pnp_dev * dev, int idx);
-struct pnp_dev * pnp_check_dma_conflicts(struct pnp_dev * dev, int idx, int mode);
int pnp_check_dma(struct pnp_dev * dev, int idx);
diff -Nru a/drivers/pnp/core.c b/drivers/pnp/core.c
--- a/drivers/pnp/core.c Wed Jun 18 23:02:24 2003
+++ b/drivers/pnp/core.c Wed Jun 18 23:02:24 2003
@@ -104,8 +104,8 @@
static void pnp_release_device(struct device *dmdev)
{
struct pnp_dev * dev = to_pnp_dev(dmdev);
- if (dev->possible)
- pnp_free_resources(dev->possible);
+ pnp_free_option(dev->independent);
+ pnp_free_option(dev->dependent);
pnp_free_ids(dev);
kfree(dev);
}
@@ -122,7 +122,7 @@
list_add_tail(&dev->global_list, &pnp_global);
list_add_tail(&dev->protocol_list, &dev->protocol->devices);
spin_unlock(&pnp_lock);
- pnp_auto_config_dev(dev);
+
ret = device_register(&dev->dev);
if (ret == 0)
pnp_interface_attach_device(dev);
diff -Nru a/drivers/pnp/interface.c b/drivers/pnp/interface.c
--- a/drivers/pnp/interface.c Wed Jun 18 23:02:24 2003
+++ b/drivers/pnp/interface.c Wed Jun 18 23:02:24 2003
@@ -168,7 +168,8 @@
pnp_printf(buffer, ", %s\n", s);
}
-static void pnp_print_resources(pnp_info_buffer_t *buffer, char *space, struct pnp_resources *res, int dep)
+static void pnp_print_option(pnp_info_buffer_t *buffer, char *space,
+ struct pnp_option *option, int dep)
{
char *s;
struct pnp_port *port;
@@ -176,49 +177,55 @@
struct pnp_dma *dma;
struct pnp_mem *mem;
- switch (res->priority) {
- case PNP_RES_PRIORITY_PREFERRED:
- s = "preferred";
- break;
- case PNP_RES_PRIORITY_ACCEPTABLE:
- s = "acceptable";
- break;
- case PNP_RES_PRIORITY_FUNCTIONAL:
- s = "functional";
- break;
- default:
- s = "invalid";
- }
- if (dep > 0)
+ if (dep) {
+ switch (option->priority) {
+ case PNP_RES_PRIORITY_PREFERRED:
+ s = "preferred";
+ break;
+ case PNP_RES_PRIORITY_ACCEPTABLE:
+ s = "acceptable";
+ break;
+ case PNP_RES_PRIORITY_FUNCTIONAL:
+ s = "functional";
+ break;
+ default:
+ s = "invalid";
+ }
pnp_printf(buffer, "Dependent: %02i - Priority %s\n",dep, s);
- for (port = res->port; port; port = port->next)
+ }
+
+ for (port = option->port; port; port = port->next)
pnp_print_port(buffer, space, port);
- for (irq = res->irq; irq; irq = irq->next)
+ for (irq = option->irq; irq; irq = irq->next)
pnp_print_irq(buffer, space, irq);
- for (dma = res->dma; dma; dma = dma->next)
+ for (dma = option->dma; dma; dma = dma->next)
pnp_print_dma(buffer, space, dma);
- for (mem = res->mem; mem; mem = mem->next)
+ for (mem = option->mem; mem; mem = mem->next)
pnp_print_mem(buffer, space, mem);
}
-static ssize_t pnp_show_possible_resources(struct device *dmdev, char *buf)
+
+static ssize_t pnp_show_options(struct device *dmdev, char *buf)
{
struct pnp_dev *dev = to_pnp_dev(dmdev);
- struct pnp_resources * res = dev->possible;
- int ret, dep = 0;
+ struct pnp_option * independent = dev->independent;
+ struct pnp_option * dependent = dev->dependent;
+ int ret, dep = 1;
+
pnp_info_buffer_t *buffer = (pnp_info_buffer_t *)
pnp_alloc(sizeof(pnp_info_buffer_t));
if (!buffer)
return -ENOMEM;
+
buffer->len = PAGE_SIZE;
buffer->buffer = buf;
buffer->curr = buffer->buffer;
- while (res){
- if (dep == 0)
- pnp_print_resources(buffer, "", res, dep);
- else
- pnp_print_resources(buffer, " ", res, dep);
- res = res->dep;
+ if (independent)
+ pnp_print_option(buffer, "", independent, 0);
+
+ while (dependent){
+ pnp_print_option(buffer, " ", dependent, dep);
+ dependent = dependent->next;
dep++;
}
ret = (buffer->curr - buf);
@@ -226,97 +233,8 @@
return ret;
}
-static DEVICE_ATTR(possible,S_IRUGO,pnp_show_possible_resources,NULL);
-
-static void pnp_print_conflict_node(pnp_info_buffer_t *buffer, struct pnp_dev * dev)
-{
- if (!dev)
- return;
- pnp_printf(buffer, "'%s'.\n", dev->dev.bus_id);
-}
-
-static void pnp_print_conflict_desc(pnp_info_buffer_t *buffer, int conflict)
-{
- if (!conflict)
- return;
- pnp_printf(buffer, " Conflict Detected: %2x - ", conflict);
- switch (conflict) {
- case CONFLICT_TYPE_RESERVED:
- pnp_printf(buffer, "manually reserved.\n");
- break;
-
- case CONFLICT_TYPE_IN_USE:
- pnp_printf(buffer, "currently in use.\n");
- break;
-
- case CONFLICT_TYPE_PCI:
- pnp_printf(buffer, "PCI device.\n");
- break;
-
- case CONFLICT_TYPE_INVALID:
- pnp_printf(buffer, "invalid.\n");
- break;
-
- case CONFLICT_TYPE_INTERNAL:
- pnp_printf(buffer, "another resource on this device.\n");
- break;
-
- case CONFLICT_TYPE_PNP_WARM:
- pnp_printf(buffer, "active PnP device ");
- break;
-
- case CONFLICT_TYPE_PNP_COLD:
- pnp_printf(buffer, "disabled PnP device ");
- break;
- default:
- pnp_printf(buffer, "Unknown conflict.\n");
- break;
- }
-}
+static DEVICE_ATTR(options,S_IRUGO,pnp_show_options,NULL);
-static void pnp_print_conflict(pnp_info_buffer_t *buffer, struct pnp_dev * dev, int idx, int type)
-{
- struct pnp_dev * cdev, * wdev = NULL;
- int conflict;
- switch (type) {
- case IORESOURCE_IO:
- conflict = pnp_check_port(dev, idx);
- if (conflict == CONFLICT_TYPE_PNP_WARM)
- wdev = pnp_check_port_conflicts(dev, idx, SEARCH_WARM);
- cdev = pnp_check_port_conflicts(dev, idx, SEARCH_COLD);
- break;
- case IORESOURCE_MEM:
- conflict = pnp_check_mem(dev, idx);
- if (conflict == CONFLICT_TYPE_PNP_WARM)
- wdev = pnp_check_mem_conflicts(dev, idx, SEARCH_WARM);
- cdev = pnp_check_mem_conflicts(dev, idx, SEARCH_COLD);
- break;
- case IORESOURCE_IRQ:
- conflict = pnp_check_irq(dev, idx);
- if (conflict == CONFLICT_TYPE_PNP_WARM)
- wdev = pnp_check_irq_conflicts(dev, idx, SEARCH_WARM);
- cdev = pnp_check_irq_conflicts(dev, idx, SEARCH_COLD);
- break;
- case IORESOURCE_DMA:
- conflict = pnp_check_dma(dev, idx);
- if (conflict == CONFLICT_TYPE_PNP_WARM)
- wdev = pnp_check_dma_conflicts(dev, idx, SEARCH_WARM);
- cdev = pnp_check_dma_conflicts(dev, idx, SEARCH_COLD);
- break;
- default:
- return;
- }
-
- pnp_print_conflict_desc(buffer, conflict);
-
- if (wdev)
- pnp_print_conflict_node(buffer, wdev);
-
- if (cdev) {
- pnp_print_conflict_desc(buffer, CONFLICT_TYPE_PNP_COLD);
- pnp_print_conflict_node(buffer, cdev);
- }
-}
static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
{
@@ -332,12 +250,6 @@
buffer->buffer = buf;
buffer->curr = buffer->buffer;
- pnp_printf(buffer,"mode = ");
- if (dev->config_mode & PNP_CONFIG_MANUAL)
- pnp_printf(buffer,"manual\n");
- else
- pnp_printf(buffer,"auto\n");
-
pnp_printf(buffer,"state = ");
if (dev->active)
pnp_printf(buffer,"active\n");
@@ -350,7 +262,6 @@
pnp_printf(buffer," 0x%lx-0x%lx \n",
pnp_port_start(dev, i),
pnp_port_end(dev, i));
-
...
read more »