]> git.hungrycats.org Git - linux/commitdiff
Resource Management Performance Fix
authorAdam Belay <ambx1@neo.rr.com>
Sat, 22 Feb 2003 21:40:51 +0000 (21:40 +0000)
committerAdam Belay <ambx1@neo.rr.com>
Sat, 22 Feb 2003 21:40:51 +0000 (21:40 +0000)
Fixes a typo in pnp_check_*_conflicts functions.  Without this fix the
resource algorithm will work but will take longer to assign resources.

Also contains some minor reordering in pnp_activate_dev.

drivers/pnp/manager.c
drivers/pnp/resource.c

index 59c7cf5fa640c2ed4820e658864c5adea363383c..0d12259575ac3b33d5de0f84c9bb934c16276a92 100644 (file)
@@ -602,10 +602,6 @@ int pnp_activate_dev(struct pnp_dev *dev)
                pnp_info("res: The PnP device '%s' is already active.", dev->dev.bus_id);
                return -EBUSY;
        }
-       spin_lock(&pnp_lock);   /* we lock just in case the device is being configured during this call */
-       dev->active = 1;
-       spin_unlock(&pnp_lock); /* once the device is claimed active we know it won't be configured so we can unlock */
-
        /* If this condition is true, advanced configuration failed, we need to get this device up and running
         * so we use the simple config engine which ignores cold conflicts, this of course may lead to new failures */
        if (!pnp_is_active(dev)) {
@@ -614,6 +610,11 @@ int pnp_activate_dev(struct pnp_dev *dev)
                        goto fail;
                }
        }
+
+       spin_lock(&pnp_lock);   /* we lock just in case the device is being configured during this call */
+       dev->active = 1;
+       spin_unlock(&pnp_lock); /* once the device is claimed active we know it won't be configured so we can unlock */
+
        if (dev->config_mode & PNP_CONFIG_INVALID) {
                pnp_info("res: Unable to activate the PnP device '%s' because its resource configuration is invalid.", dev->dev.bus_id);
                goto fail;
index 1b0ac165450c492eea9ecdf23f3449b0a83a4ff8..da5465ca2e07760dab2355a62261b2f17589e7b8 100644 (file)
@@ -268,7 +268,7 @@ struct pnp_dev * pnp_check_port_conflicts(struct pnp_dev * dev, int idx, int mod
        /* check for cold conflicts */
        pnp_for_each_dev(tdev) {
                /* Is the device configurable? */
-               if (tdev == dev || (mode ? !dev->active : dev->active))
+               if (tdev == dev || (mode ? !tdev->active : tdev->active))
                        continue;
                for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) {
                        if (tdev->res.port_resource[tmp].flags & IORESOURCE_IO) {
@@ -339,7 +339,7 @@ struct pnp_dev * pnp_check_mem_conflicts(struct pnp_dev * dev, int idx, int mode
        /* check for cold conflicts */
        pnp_for_each_dev(tdev) {
                /* Is the device configurable? */
-               if (tdev == dev || (mode ? !dev->active : dev->active))
+               if (tdev == dev || (mode ? !tdev->active : tdev->active))
                        continue;
                for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) {
                        if (tdev->res.mem_resource[tmp].flags & IORESOURCE_MEM) {
@@ -408,7 +408,7 @@ struct pnp_dev * pnp_check_irq_conflicts(struct pnp_dev * dev, int idx, int mode
        /* check for cold conflicts */
        pnp_for_each_dev(tdev) {
                /* Is the device configurable? */
-               if (tdev == dev || (mode ? !dev->active : dev->active))
+               if (tdev == dev || (mode ? !tdev->active : tdev->active))
                        continue;
                for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) {
                        if (tdev->res.irq_resource[tmp].flags & IORESOURCE_IRQ) {
@@ -490,7 +490,7 @@ struct pnp_dev * pnp_check_dma_conflicts(struct pnp_dev * dev, int idx, int mode
        /* check for cold conflicts */
        pnp_for_each_dev(tdev) {
                /* Is the device configurable? */
-               if (tdev == dev || (mode ? !dev->active : dev->active))
+               if (tdev == dev || (mode ? !tdev->active : tdev->active))
                        continue;
                for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) {
                        if (tdev->res.dma_resource[tmp].flags & IORESOURCE_DMA) {