From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Adam Belay <ambx1@neo.rr.com>, Li Shaohua <shaohua.li@intel.com>,
Matthieu Castet <castet.matthieu@free.fr>,
Thomas Renninger <trenn@suse.de>,
Rene Herman <rene.herman@keyaccess.nl>,
Jaroslav Kysela <perex@perex.cz>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [patch 31/37] PNP: convert resource checks to use pnp_get_resource(), not pnp_resource_table
Date: Tue, 01 Apr 2008 09:17:05 -0600 [thread overview]
Message-ID: <20080401151741.862705956@ldl.fc.hp.com> (raw)
In-Reply-To: 20080401151634.730901933@ldl.fc.hp.com
[-- Attachment #1: pnp-convert-checks-to-pnp_get_resource --]
[-- Type: text/plain, Size: 6323 bytes --]
This removes more direct references to pnp_resource_table.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: work7/drivers/pnp/resource.c
===================================================================
--- work7.orig/drivers/pnp/resource.c 2008-03-31 17:12:25.000000000 -0600
+++ work7/drivers/pnp/resource.c 2008-03-31 17:15:31.000000000 -0600
@@ -216,14 +216,17 @@
int pnp_check_port(struct pnp_dev *dev, int idx)
{
int i;
+ struct resource *res, *tres;
struct pnp_dev *tdev;
resource_size_t *port, *end, *tport, *tend;
- port = &dev->res.port_resource[idx].start;
- end = &dev->res.port_resource[idx].end;
+ res = pnp_get_resource(dev, IORESOURCE_IO, idx);
+
+ port = &res->start;
+ end = &res->end;
/* if the resource doesn't exist, don't complain about it */
- if (cannot_compare(dev->res.port_resource[idx].flags))
+ if (cannot_compare(res->flags))
return 1;
/* check if the resource is already in use, skip if the
@@ -243,9 +246,10 @@
/* check for internal conflicts */
for (i = 0; i < PNP_MAX_PORT && i != idx; i++) {
- if (dev->res.port_resource[i].flags & IORESOURCE_IO) {
- tport = &dev->res.port_resource[i].start;
- tend = &dev->res.port_resource[i].end;
+ tres = pnp_get_resource(dev, IORESOURCE_IO, i);
+ if (tres->flags & IORESOURCE_IO) {
+ tport = &tres->start;
+ tend = &tres->end;
if (ranged_conflict(port, end, tport, tend))
return 0;
}
@@ -256,12 +260,12 @@
if (tdev == dev)
continue;
for (i = 0; i < PNP_MAX_PORT; i++) {
- if (tdev->res.port_resource[i].flags & IORESOURCE_IO) {
- if (cannot_compare
- (tdev->res.port_resource[i].flags))
+ tres = pnp_get_resource(tdev, IORESOURCE_IO, i);
+ if (tres->flags & IORESOURCE_IO) {
+ if (cannot_compare(tres->flags))
continue;
- tport = &tdev->res.port_resource[i].start;
- tend = &tdev->res.port_resource[i].end;
+ tport = &tres->start;
+ tend = &tres->end;
if (ranged_conflict(port, end, tport, tend))
return 0;
}
@@ -274,14 +278,17 @@
int pnp_check_mem(struct pnp_dev *dev, int idx)
{
int i;
+ struct resource *res, *tres;
struct pnp_dev *tdev;
resource_size_t *addr, *end, *taddr, *tend;
- addr = &dev->res.mem_resource[idx].start;
- end = &dev->res.mem_resource[idx].end;
+ res = pnp_get_resource(dev, IORESOURCE_MEM, idx);
+
+ addr = &res->start;
+ end = &res->end;
/* if the resource doesn't exist, don't complain about it */
- if (cannot_compare(dev->res.mem_resource[idx].flags))
+ if (cannot_compare(res->flags))
return 1;
/* check if the resource is already in use, skip if the
@@ -301,9 +308,10 @@
/* check for internal conflicts */
for (i = 0; i < PNP_MAX_MEM && i != idx; i++) {
- if (dev->res.mem_resource[i].flags & IORESOURCE_MEM) {
- taddr = &dev->res.mem_resource[i].start;
- tend = &dev->res.mem_resource[i].end;
+ tres = pnp_get_resource(dev, IORESOURCE_MEM, i);
+ if (tres->flags & IORESOURCE_MEM) {
+ taddr = &tres->start;
+ tend = &tres->end;
if (ranged_conflict(addr, end, taddr, tend))
return 0;
}
@@ -314,12 +322,12 @@
if (tdev == dev)
continue;
for (i = 0; i < PNP_MAX_MEM; i++) {
- if (tdev->res.mem_resource[i].flags & IORESOURCE_MEM) {
- if (cannot_compare
- (tdev->res.mem_resource[i].flags))
+ tres = pnp_get_resource(tdev, IORESOURCE_MEM, i);
+ if (tres->flags & IORESOURCE_MEM) {
+ if (cannot_compare(tres->flags))
continue;
- taddr = &tdev->res.mem_resource[i].start;
- tend = &tdev->res.mem_resource[i].end;
+ taddr = &tres->start;
+ tend = &tres->end;
if (ranged_conflict(addr, end, taddr, tend))
return 0;
}
@@ -337,11 +345,16 @@
int pnp_check_irq(struct pnp_dev *dev, int idx)
{
int i;
+ struct resource *res, *tres;
struct pnp_dev *tdev;
- resource_size_t *irq = &dev->res.irq_resource[idx].start;
+ resource_size_t *irq;
+
+ res = pnp_get_resource(dev, IORESOURCE_IRQ, idx);
+
+ irq = &res->start;
/* if the resource doesn't exist, don't complain about it */
- if (cannot_compare(dev->res.irq_resource[idx].flags))
+ if (cannot_compare(res->flags))
return 1;
/* check if the resource is valid */
@@ -356,8 +369,9 @@
/* check for internal conflicts */
for (i = 0; i < PNP_MAX_IRQ && i != idx; i++) {
- if (dev->res.irq_resource[i].flags & IORESOURCE_IRQ) {
- if (dev->res.irq_resource[i].start == *irq)
+ tres = pnp_get_resource(dev, IORESOURCE_IRQ, i);
+ if (tres->flags & IORESOURCE_IRQ) {
+ if (tres->start == *irq)
return 0;
}
}
@@ -389,11 +403,11 @@
if (tdev == dev)
continue;
for (i = 0; i < PNP_MAX_IRQ; i++) {
- if (tdev->res.irq_resource[i].flags & IORESOURCE_IRQ) {
- if (cannot_compare
- (tdev->res.irq_resource[i].flags))
+ tres = pnp_get_resource(tdev, IORESOURCE_IRQ, i);
+ if (tres->flags & IORESOURCE_IRQ) {
+ if (cannot_compare(tres->flags))
continue;
- if ((tdev->res.irq_resource[i].start == *irq))
+ if (tres->start == *irq)
return 0;
}
}
@@ -406,11 +420,16 @@
{
#ifndef CONFIG_IA64
int i;
+ struct resource *res, *tres;
struct pnp_dev *tdev;
- resource_size_t *dma = &dev->res.dma_resource[idx].start;
+ resource_size_t *dma;
+
+ res = pnp_get_resource(dev, IORESOURCE_DMA, idx);
+
+ dma = &res->start;
/* if the resource doesn't exist, don't complain about it */
- if (cannot_compare(dev->res.dma_resource[idx].flags))
+ if (cannot_compare(res->flags))
return 1;
/* check if the resource is valid */
@@ -425,8 +444,9 @@
/* check for internal conflicts */
for (i = 0; i < PNP_MAX_DMA && i != idx; i++) {
- if (dev->res.dma_resource[i].flags & IORESOURCE_DMA) {
- if (dev->res.dma_resource[i].start == *dma)
+ tres = pnp_get_resource(dev, IORESOURCE_DMA, i);
+ if (tres->flags & IORESOURCE_DMA) {
+ if (tres->start == *dma)
return 0;
}
}
@@ -444,11 +464,11 @@
if (tdev == dev)
continue;
for (i = 0; i < PNP_MAX_DMA; i++) {
- if (tdev->res.dma_resource[i].flags & IORESOURCE_DMA) {
- if (cannot_compare
- (tdev->res.dma_resource[i].flags))
+ tres = pnp_get_resource(tdev, IORESOURCE_DMA, i);
+ if (tres->flags & IORESOURCE_DMA) {
+ if (cannot_compare(tres->flags))
continue;
- if ((tdev->res.dma_resource[i].start == *dma))
+ if (tres->start == *dma)
return 0;
}
}
--
next prev parent reply other threads:[~2008-04-01 15:18 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-01 15:16 [patch 00/37] PNP resource_table cleanups, v2 Bjorn Helgaas
2008-04-01 15:16 ` [patch 01/37] ISAPNP: move config register addresses out of isapnp.h Bjorn Helgaas
2008-04-01 15:16 ` [patch 02/37] PNPACPI: continue after _CRS and _PRS errors Bjorn Helgaas
2008-04-01 15:16 ` [patch 03/37] PNP: make pnp_add_id() internal to PNP core Bjorn Helgaas
2008-04-01 15:16 ` [patch 04/37] PNP: change pnp_add_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-01 15:16 ` [patch 05/37] PNP: add pnp_eisa_id_to_string() Bjorn Helgaas
2008-04-01 15:16 ` [patch 06/37] PNP: add pnp_alloc_dev() Bjorn Helgaas
2008-04-01 15:16 ` [patch 07/37] PNP: make pnp_add_card_id() internal to PNP core Bjorn Helgaas
2008-04-01 15:16 ` [patch 08/37] PNP: change pnp_add_card_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-01 15:16 ` [patch 09/37] ISAPNP: pull pnp_add_card_id() out of isapnp_parse_card_id() Bjorn Helgaas
2008-04-01 15:16 ` [patch 10/37] PNP: add pnp_alloc_card() Bjorn Helgaas
2008-04-01 15:16 ` [patch 11/37] PNPACPI: pnpacpi_encode_ext_irq() wrongly set "irq" instead of "extended_irq" Bjorn Helgaas
2008-04-01 15:16 ` [patch 12/37] PNPACPI: use temporaries to reduce repetition Bjorn Helgaas
2008-04-01 15:16 ` [patch 13/37] PNPACPI: hoist dma_flags() out of pnpacpi_parse_allocated_dmaresource() Bjorn Helgaas
2008-04-01 15:16 ` [patch 14/37] PNPACPI: extend irq_flags() to set IORESOURCE_IRQ_SHAREABLE when appropriate Bjorn Helgaas
2008-04-01 15:16 ` [patch 15/37] PNPACPI: pass pnp_dev instead of acpi_handle Bjorn Helgaas
2008-04-01 15:16 ` [patch 16/37] PNP: remove pnp_resource_table from internal get/set interfaces Bjorn Helgaas
2008-04-01 15:16 ` [patch 17/37] PNP: remove more pnp_resource_table arguments Bjorn Helgaas
2008-04-01 15:16 ` [patch 18/37] PNP: add pnp_init_resources(struct pnp_dev *) interface Bjorn Helgaas
2008-04-01 15:16 ` [patch 19/37] PNP: remove pnp_resource_table from internal pnp_clean_resource_table interface Bjorn Helgaas
2008-04-01 15:16 ` [patch 20/37] PNP: make generic pnp_add_irq_resource() Bjorn Helgaas
2008-04-01 15:16 ` [patch 21/37] PNP: make generic pnp_add_dma_resource() Bjorn Helgaas
2008-04-01 15:16 ` [patch 22/37] PNP: make generic pnp_add_io_resource() Bjorn Helgaas
2008-04-01 15:16 ` [patch 23/37] PNP: make generic pnp_add_mem_resource() Bjorn Helgaas
2008-04-01 15:16 ` [patch 24/37] PNP: use dev_printk when possible Bjorn Helgaas
2008-04-01 15:16 ` [patch 25/37] PNPACPI: remove redundant warnings about _CRS/_PRS failures Bjorn Helgaas
2008-04-01 15:17 ` [patch 26/37] PNPACPI: remove some pnp_dbg calls Bjorn Helgaas
2008-04-01 15:17 ` [patch 27/37] PNP: use conventional "i" for loop indices Bjorn Helgaas
2008-04-01 15:17 ` [patch 28/37] PNP: add pnp_get_resource() interface Bjorn Helgaas
2008-04-01 15:17 ` [patch 29/37] PNP: convert encoders to use pnp_get_resource(), not pnp_resource_table Bjorn Helgaas
2008-04-01 15:17 ` [patch 30/37] PNP: convert resource accessors " Bjorn Helgaas
2008-04-01 15:17 ` Bjorn Helgaas [this message]
2008-04-01 15:17 ` [patch 32/37] PNP: convert resource assign functions " Bjorn Helgaas
2008-04-01 15:17 ` [patch 33/37] PNP: remove PNP_MAX_* uses Bjorn Helgaas
2008-04-01 15:17 ` [patch 34/37] PNP: remove unused interfaces using pnp_resource_table Bjorn Helgaas
2008-04-01 15:17 ` [patch 35/37] rtc: dont reference pnp_resource_table directly Bjorn Helgaas
2008-04-01 15:17 ` [patch 36/37] PNP: make pnp_resource_table private to PNP core Bjorn Helgaas
2008-04-01 15:17 ` [patch 37/37] PNP: make interfaces private to the " Bjorn Helgaas
2008-04-01 23:43 ` [patch 00/37] PNP resource_table cleanups, v2 Rene Herman
2008-04-02 21:35 ` Bjorn Helgaas
2008-04-03 15:54 ` Rene Herman
2008-04-03 16:43 ` Bjorn Helgaas
2008-04-03 17:12 ` Rene Herman
2008-04-03 19:29 ` Rene Herman
2008-05-01 20:47 ` Bjorn Helgaas
2008-05-04 14:14 ` Rene Herman
2008-05-04 14:19 ` Rene Herman
2008-05-05 14:48 ` Bjorn Helgaas
-- strict thread matches above, loose matches on Subject: below --
2008-03-26 17:10 [patch 00/37] PNP resource_table cleanups Bjorn Helgaas
2008-03-26 17:11 ` [patch 31/37] PNP: convert resource checks to use pnp_get_resource(), not pnp_resource_table Bjorn Helgaas
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=20080401151741.862705956@ldl.fc.hp.com \
--to=bjorn.helgaas@hp.com \
--cc=akpm@linux-foundation.org \
--cc=ambx1@neo.rr.com \
--cc=castet.matthieu@free.fr \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=rene.herman@keyaccess.nl \
--cc=shaohua.li@intel.com \
--cc=trenn@suse.de \
/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