Commit 498a7c08 authored by Adam Belay's avatar Adam Belay

Resource Management Performance Fix

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.
parent 748d7b55
...@@ -602,10 +602,6 @@ int pnp_activate_dev(struct pnp_dev *dev) ...@@ -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); pnp_info("res: The PnP device '%s' is already active.", dev->dev.bus_id);
return -EBUSY; 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 /* 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 */ * so we use the simple config engine which ignores cold conflicts, this of course may lead to new failures */
if (!pnp_is_active(dev)) { if (!pnp_is_active(dev)) {
...@@ -614,6 +610,11 @@ int pnp_activate_dev(struct pnp_dev *dev) ...@@ -614,6 +610,11 @@ int pnp_activate_dev(struct pnp_dev *dev)
goto fail; 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) { 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); pnp_info("res: Unable to activate the PnP device '%s' because its resource configuration is invalid.", dev->dev.bus_id);
goto fail; goto fail;
......
...@@ -268,7 +268,7 @@ struct pnp_dev * pnp_check_port_conflicts(struct pnp_dev * dev, int idx, int mod ...@@ -268,7 +268,7 @@ struct pnp_dev * pnp_check_port_conflicts(struct pnp_dev * dev, int idx, int mod
/* check for cold conflicts */ /* check for cold conflicts */
pnp_for_each_dev(tdev) { pnp_for_each_dev(tdev) {
/* Is the device configurable? */ /* Is the device configurable? */
if (tdev == dev || (mode ? !dev->active : dev->active)) if (tdev == dev || (mode ? !tdev->active : tdev->active))
continue; continue;
for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) { for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) {
if (tdev->res.port_resource[tmp].flags & IORESOURCE_IO) { 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 ...@@ -339,7 +339,7 @@ struct pnp_dev * pnp_check_mem_conflicts(struct pnp_dev * dev, int idx, int mode
/* check for cold conflicts */ /* check for cold conflicts */
pnp_for_each_dev(tdev) { pnp_for_each_dev(tdev) {
/* Is the device configurable? */ /* Is the device configurable? */
if (tdev == dev || (mode ? !dev->active : dev->active)) if (tdev == dev || (mode ? !tdev->active : tdev->active))
continue; continue;
for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) { for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) {
if (tdev->res.mem_resource[tmp].flags & IORESOURCE_MEM) { 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 ...@@ -408,7 +408,7 @@ struct pnp_dev * pnp_check_irq_conflicts(struct pnp_dev * dev, int idx, int mode
/* check for cold conflicts */ /* check for cold conflicts */
pnp_for_each_dev(tdev) { pnp_for_each_dev(tdev) {
/* Is the device configurable? */ /* Is the device configurable? */
if (tdev == dev || (mode ? !dev->active : dev->active)) if (tdev == dev || (mode ? !tdev->active : tdev->active))
continue; continue;
for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) { for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) {
if (tdev->res.irq_resource[tmp].flags & IORESOURCE_IRQ) { 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 ...@@ -490,7 +490,7 @@ struct pnp_dev * pnp_check_dma_conflicts(struct pnp_dev * dev, int idx, int mode
/* check for cold conflicts */ /* check for cold conflicts */
pnp_for_each_dev(tdev) { pnp_for_each_dev(tdev) {
/* Is the device configurable? */ /* Is the device configurable? */
if (tdev == dev || (mode ? !dev->active : dev->active)) if (tdev == dev || (mode ? !tdev->active : tdev->active))
continue; continue;
for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) { for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) {
if (tdev->res.dma_resource[tmp].flags & IORESOURCE_DMA) { if (tdev->res.dma_resource[tmp].flags & IORESOURCE_DMA) {
......
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