From: Adam Belay <ambx1@neo.rr.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] PnP Updates for 2.6.0-test2
Date: Tue, 5 Aug 2003 22:14:15 +0000 [thread overview]
Message-ID: <20030805221415.GB13275@neo.rr.com> (raw)
# --------------------------------------------
# 03/08/05 ambx1@neo.rr.com 1.1107
# [PNP] Handle unset resources properly
#
# This patch is similar to the disabled resource patch in that it
# avoids direct numeric comparisons with data in unset resource
# structures.
# --------------------------------------------
#
diff -Nru a/drivers/pnp/manager.c b/drivers/pnp/manager.c
--- a/drivers/pnp/manager.c Tue Aug 5 21:25:12 2003
+++ b/drivers/pnp/manager.c Tue Aug 5 21:25:12 2003
@@ -45,7 +45,8 @@
flags = &dev->res.port_resource[idx].flags;
/* set the initial values */
- *flags = *flags | rule->flags | IORESOURCE_IO;
+ *flags |= rule->flags | IORESOURCE_IO;
+ *flags &= ~IORESOURCE_UNSET;
if (!rule->size) {
*flags |= IORESOURCE_DISABLED;
@@ -87,7 +88,8 @@
flags = &dev->res.mem_resource[idx].flags;
/* set the initial values */
- *flags = *flags | rule->flags | IORESOURCE_MEM;
+ *flags |= rule->flags | IORESOURCE_MEM;
+ *flags &= ~IORESOURCE_UNSET;
/* convert pnp flags to standard Linux flags */
if (!(rule->flags & IORESOURCE_MEM_WRITEABLE))
@@ -145,7 +147,8 @@
flags = &dev->res.irq_resource[idx].flags;
/* set the initial values */
- *flags = *flags | rule->flags | IORESOURCE_IRQ;
+ *flags |= rule->flags | IORESOURCE_IRQ;
+ *flags &= ~IORESOURCE_UNSET;
if (!rule->map) {
*flags |= IORESOURCE_DISABLED;
@@ -190,7 +193,8 @@
flags = &dev->res.dma_resource[idx].flags;
/* set the initial values */
- *flags = *flags | rule->flags | IORESOURCE_DMA;
+ *flags |= rule->flags | IORESOURCE_DMA;
+ *flags &= ~IORESOURCE_UNSET;
if (!rule->map) {
*flags |= IORESOURCE_DISABLED;
@@ -219,25 +223,25 @@
table->irq_resource[idx].name = NULL;
table->irq_resource[idx].start = -1;
table->irq_resource[idx].end = -1;
- table->irq_resource[idx].flags = IORESOURCE_AUTO;
+ table->irq_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
}
for (idx = 0; idx < PNP_MAX_DMA; idx++) {
table->dma_resource[idx].name = NULL;
table->dma_resource[idx].start = -1;
table->dma_resource[idx].end = -1;
- table->dma_resource[idx].flags = IORESOURCE_AUTO;
+ table->dma_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
}
for (idx = 0; idx < PNP_MAX_PORT; idx++) {
table->port_resource[idx].name = NULL;
table->port_resource[idx].start = 0;
table->port_resource[idx].end = 0;
- table->port_resource[idx].flags = IORESOURCE_AUTO;
+ table->port_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
}
for (idx = 0; idx < PNP_MAX_MEM; idx++) {
table->mem_resource[idx].name = NULL;
table->mem_resource[idx].start = 0;
table->mem_resource[idx].end = 0;
- table->mem_resource[idx].flags = IORESOURCE_AUTO;
+ table->mem_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
}
}
@@ -254,28 +258,28 @@
continue;
res->irq_resource[idx].start = -1;
res->irq_resource[idx].end = -1;
- res->irq_resource[idx].flags = IORESOURCE_AUTO;
+ res->irq_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
}
for (idx = 0; idx < PNP_MAX_DMA; idx++) {
if (!(res->dma_resource[idx].flags & IORESOURCE_AUTO))
continue;
res->dma_resource[idx].start = -1;
res->dma_resource[idx].end = -1;
- res->dma_resource[idx].flags = IORESOURCE_AUTO;
+ res->dma_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
}
for (idx = 0; idx < PNP_MAX_PORT; idx++) {
if (!(res->port_resource[idx].flags & IORESOURCE_AUTO))
continue;
res->port_resource[idx].start = 0;
res->port_resource[idx].end = 0;
- res->port_resource[idx].flags = IORESOURCE_AUTO;
+ res->port_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
}
for (idx = 0; idx < PNP_MAX_MEM; idx++) {
if (!(res->mem_resource[idx].flags & IORESOURCE_AUTO))
continue;
res->mem_resource[idx].start = 0;
res->mem_resource[idx].end = 0;
- res->mem_resource[idx].flags = IORESOURCE_AUTO;
+ res->mem_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
}
}
diff -Nru a/drivers/pnp/resource.c b/drivers/pnp/resource.c
--- a/drivers/pnp/resource.c Tue Aug 5 21:25:12 2003
+++ b/drivers/pnp/resource.c Tue Aug 5 21:25:12 2003
@@ -252,7 +252,7 @@
end = &dev->res.port_resource[idx].end;
/* if the resource doesn't exist, don't complain about it */
- if (dev->res.port_resource[idx].start == 0)
+ if (dev->res.port_resource[idx].flags & IORESOURCE_UNSET)
return 1;
/* check if the resource is already in use, skip if the
@@ -308,7 +308,7 @@
end = &dev->res.mem_resource[idx].end;
/* if the resource doesn't exist, don't complain about it */
- if (dev->res.mem_resource[idx].start == 0)
+ if (dev->res.mem_resource[idx].flags & IORESOURCE_UNSET)
return 1;
/* check if the resource is already in use, skip if the
@@ -367,7 +367,7 @@
unsigned long * irq = &dev->res.irq_resource[idx].start;
/* if the resource doesn't exist, don't complain about it */
- if (dev->res.irq_resource[idx].start == -1)
+ if (dev->res.irq_resource[idx].flags & IORESOURCE_UNSET)
return 1;
/* check if the resource is valid */
@@ -431,7 +431,7 @@
unsigned long * dma = &dev->res.dma_resource[idx].start;
/* if the resource doesn't exist, don't complain about it */
- if (dev->res.dma_resource[idx].start == -1)
+ if (dev->res.dma_resource[idx].flags & IORESOURCE_UNSET)
return 1;
/* check if the resource is valid */
next reply other threads:[~2003-08-06 2:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-05 22:14 Adam Belay [this message]
2003-08-05 22:15 ` [PATCH] PnP Updates for 2.6.0-test2 Adam Belay
2003-08-05 22:15 ` Adam Belay
2003-08-05 22:16 ` Adam Belay
2003-08-05 22:17 ` Adam Belay
2003-08-05 22:17 ` Adam Belay
2003-08-05 22:18 ` Adam Belay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030805221415.GB13275@neo.rr.com \
--to=ambx1@neo.rr.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox