public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
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>, Adam M Belay <abelay@mit.edu>,
	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 38/55] PNP: convert assign, interface to use pnp_get_resource(), not pnp_resource_table
Date: Mon, 28 Apr 2008 16:34:25 -0600	[thread overview]
Message-ID: <20080428223624.295390288@ldl.fc.hp.com> (raw)
In-Reply-To: 20080428223347.233593713@ldl.fc.hp.com

[-- Attachment #1: pnp-convert-assigns-to-pnp_get_resource --]
[-- Type: text/plain, Size: 6109 bytes --]

This removes more direct references to pnp_resource_table from the
pnp_assign_resources() path and the /sys user interface path.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Index: work10/drivers/pnp/manager.c
===================================================================
--- work10.orig/drivers/pnp/manager.c	2008-04-28 16:09:34.000000000 -0600
+++ work10/drivers/pnp/manager.c	2008-04-28 16:09:36.000000000 -0600
@@ -21,14 +21,13 @@
 {
 	struct resource *res;
 
-	if (idx >= PNP_MAX_PORT) {
+	res = pnp_get_resource(dev, IORESOURCE_IO, idx);
+	if (!res) {
 		dev_err(&dev->dev, "too many I/O port resources\n");
 		/* pretend we were successful so at least the manager won't try again */
 		return 1;
 	}
 
-	res = &dev->res.port_resource[idx];
-
 	/* check if this resource has been manually set, if so skip */
 	if (!(res->flags & IORESOURCE_AUTO)) {
 		dev_dbg(&dev->dev, "  io %d already set to %#llx-%#llx "
@@ -68,14 +67,13 @@
 {
 	struct resource *res;
 
-	if (idx >= PNP_MAX_MEM) {
+	res = pnp_get_resource(dev, IORESOURCE_MEM, idx);
+	if (!res) {
 		dev_err(&dev->dev, "too many memory resources\n");
 		/* pretend we were successful so at least the manager won't try again */
 		return 1;
 	}
 
-	res = &dev->res.mem_resource[idx];
-
 	/* check if this resource has been manually set, if so skip */
 	if (!(res->flags & IORESOURCE_AUTO)) {
 		dev_dbg(&dev->dev, "  mem %d already set to %#llx-%#llx "
@@ -131,14 +129,13 @@
 		5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2
 	};
 
-	if (idx >= PNP_MAX_IRQ) {
+	res = pnp_get_resource(dev, IORESOURCE_IRQ, idx);
+	if (!res) {
 		dev_err(&dev->dev, "too many IRQ resources\n");
 		/* pretend we were successful so at least the manager won't try again */
 		return 1;
 	}
 
-	res = &dev->res.irq_resource[idx];
-
 	/* check if this resource has been manually set, if so skip */
 	if (!(res->flags & IORESOURCE_AUTO)) {
 		dev_dbg(&dev->dev, "  irq %d already set to %d flags %#lx\n",
@@ -188,13 +185,12 @@
 		1, 3, 5, 6, 7, 0, 2, 4
 	};
 
-	if (idx >= PNP_MAX_DMA) {
+	res = pnp_get_resource(dev, IORESOURCE_DMA, idx);
+	if (!res) {
 		dev_err(&dev->dev, "too many DMA resources\n");
 		return;
 	}
 
-	res = &dev->res.dma_resource[idx];
-
 	/* check if this resource has been manually set, if so skip */
 	if (!(res->flags & IORESOURCE_AUTO)) {
 		dev_dbg(&dev->dev, "  dma %d already set to %d flags %#lx\n",
Index: work10/drivers/pnp/interface.c
===================================================================
--- work10.orig/drivers/pnp/interface.c	2008-04-28 16:09:33.000000000 -0600
+++ work10/drivers/pnp/interface.c	2008-04-28 16:09:36.000000000 -0600
@@ -383,7 +383,10 @@
 				buf += 2;
 				while (isspace(*buf))
 					++buf;
-				res = &dev->res.port_resource[nport];
+				res = pnp_get_resource(dev, IORESOURCE_IO,
+						       nport);
+				if (!res)
+					break;
 				res->start = simple_strtoul(buf, &buf, 0);
 				while (isspace(*buf))
 					++buf;
@@ -396,15 +399,16 @@
 					res->end = res->start;
 				res->flags = IORESOURCE_IO;
 				nport++;
-				if (nport >= PNP_MAX_PORT)
-					break;
 				continue;
 			}
 			if (!strnicmp(buf, "mem", 3)) {
 				buf += 3;
 				while (isspace(*buf))
 					++buf;
-				res = &dev->res.mem_resource[nmem];
+				res = pnp_get_resource(dev, IORESOURCE_MEM,
+						       nmem);
+				if (!res)
+					break;
 				res->start = simple_strtoul(buf, &buf, 0);
 				while (isspace(*buf))
 					++buf;
@@ -417,34 +421,34 @@
 					res->end = res->start;
 				res->flags = IORESOURCE_MEM;
 				nmem++;
-				if (nmem >= PNP_MAX_MEM)
-					break;
 				continue;
 			}
 			if (!strnicmp(buf, "irq", 3)) {
 				buf += 3;
 				while (isspace(*buf))
 					++buf;
-				res = &dev->res.irq_resource[nirq];
+				res = pnp_get_resource(dev, IORESOURCE_IRQ,
+						       nirq);
+				if (!res)
+					break;
 				res->start = res->end =
 				    simple_strtoul(buf, &buf, 0);
 				res->flags = IORESOURCE_IRQ;
 				nirq++;
-				if (nirq >= PNP_MAX_IRQ)
-					break;
 				continue;
 			}
 			if (!strnicmp(buf, "dma", 3)) {
 				buf += 3;
 				while (isspace(*buf))
 					++buf;
-				res = &dev->res.dma_resource[ndma];
+				res = pnp_get_resource(dev, IORESOURCE_DMA,
+						       ndma);
+				if (!res)
+					break;
 				res->start = res->end =
 				    simple_strtoul(buf, &buf, 0);
 				res->flags = IORESOURCE_DMA;
 				ndma++;
-				if (ndma >= PNP_MAX_DMA)
-					break;
 				continue;
 			}
 			break;
Index: work10/drivers/pnp/support.c
===================================================================
--- work10.orig/drivers/pnp/support.c	2008-04-28 16:09:22.000000000 -0600
+++ work10/drivers/pnp/support.c	2008-04-28 16:09:36.000000000 -0600
@@ -61,27 +61,27 @@
 	dev_dbg(&dev->dev, "current resources: %s\n", desc);
 
 	for (i = 0; i < PNP_MAX_IRQ; i++) {
-		res = &dev->res.irq_resource[i];
-		if (!(res->flags & IORESOURCE_UNSET))
+		res = pnp_get_resource(dev, IORESOURCE_IRQ, i);
+		if (res && !(res->flags & IORESOURCE_UNSET))
 			dev_dbg(&dev->dev, "  irq %lld flags %#lx\n",
 				(unsigned long long) res->start, res->flags);
 	}
 	for (i = 0; i < PNP_MAX_DMA; i++) {
-		res = &dev->res.dma_resource[i];
-		if (!(res->flags & IORESOURCE_UNSET))
+		res = pnp_get_resource(dev, IORESOURCE_DMA, i);
+		if (res && !(res->flags & IORESOURCE_UNSET))
 			dev_dbg(&dev->dev, "  dma %lld flags %#lx\n",
 				(unsigned long long) res->start, res->flags);
 	}
 	for (i = 0; i < PNP_MAX_PORT; i++) {
-		res = &dev->res.port_resource[i];
-		if (!(res->flags & IORESOURCE_UNSET))
+		res = pnp_get_resource(dev, IORESOURCE_IO, i);
+		if (res && !(res->flags & IORESOURCE_UNSET))
 			dev_dbg(&dev->dev, "  io  %#llx-%#llx flags %#lx\n",
 				(unsigned long long) res->start,
 				(unsigned long long) res->end, res->flags);
 	}
 	for (i = 0; i < PNP_MAX_MEM; i++) {
-		res = &dev->res.mem_resource[i];
-		if (!(res->flags & IORESOURCE_UNSET))
+		res = pnp_get_resource(dev, IORESOURCE_MEM, i);
+		if (res && !(res->flags & IORESOURCE_UNSET))
 			dev_dbg(&dev->dev, "  mem %#llx-%#llx flags %#lx\n",
 				(unsigned long long) res->start,
 				(unsigned long long) res->end, res->flags);

-- 

  parent reply	other threads:[~2008-04-28 22:37 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-28 22:33 [patch 00/55] PNP cleanup, v5 Bjorn Helgaas
2008-04-28 22:33 ` [patch 01/55] PNP: turn on -DDEBUG when CONFIG_PNP_DEBUG is set Bjorn Helgaas
2008-04-28 22:33 ` [patch 02/55] ISAPNP: move config register addresses out of isapnp.h Bjorn Helgaas
2008-04-28 22:33 ` [patch 03/55] PNPACPI: continue after _CRS and _PRS errors Bjorn Helgaas
2008-04-28 22:33 ` [patch 04/55] PNP: make pnp_add_id() internal to PNP core Bjorn Helgaas
2008-04-28 22:33 ` [patch 05/55] PNP: change pnp_add_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-28 22:33 ` [patch 06/55] PNP: add pnp_eisa_id_to_string() Bjorn Helgaas
2008-04-28 22:33 ` [patch 07/55] PNP: add pnp_alloc_dev() Bjorn Helgaas
2008-04-28 22:33 ` [patch 08/55] PNP: make pnp_add_card_id() internal to PNP core Bjorn Helgaas
2008-04-28 22:33 ` [patch 09/55] PNP: change pnp_add_card_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-28 22:33 ` [patch 10/55] ISAPNP: pull pnp_add_card_id() out of isapnp_parse_card_id() Bjorn Helgaas
2008-04-28 22:33 ` [patch 11/55] PNP: add pnp_alloc_card() Bjorn Helgaas
2008-04-28 22:33 ` [patch 12/55] PNPACPI: pnpacpi_encode_ext_irq() wrongly set "irq" instead of "extended_irq" Bjorn Helgaas
2008-04-28 22:34 ` [patch 13/55] PNPACPI: use temporaries to reduce repetition Bjorn Helgaas
2008-04-28 22:34 ` [patch 14/55] PNPACPI: hoist dma_flags() out of pnpacpi_parse_allocated_dmaresource() Bjorn Helgaas
2008-04-28 22:34 ` [patch 15/55] PNPACPI: extend irq_flags() to set IORESOURCE_IRQ_SHAREABLE when appropriate Bjorn Helgaas
2008-04-28 22:34 ` [patch 16/55] PNPACPI: pass pnp_dev instead of acpi_handle Bjorn Helgaas
2008-04-28 22:34 ` [patch 17/55] PNP: add debug output to option registration Bjorn Helgaas
2008-04-28 22:34 ` [patch 18/55] PNP: remove pnp_resource_table from internal get/set interfaces Bjorn Helgaas
2008-04-28 22:34 ` [patch 19/55] PNP: remove more pnp_resource_table arguments Bjorn Helgaas
2008-04-28 22:34 ` [patch 20/55] PNP: add debug output to encoders Bjorn Helgaas
2008-04-28 22:34 ` [patch 21/55] PNP: add debug when assigning PNP resources Bjorn Helgaas
2008-04-28 22:34 ` [patch 22/55] PNP: add pnp_init_resources(struct pnp_dev *) interface Bjorn Helgaas
2008-04-28 22:34 ` [patch 23/55] PNP: remove pnp_resource_table from internal pnp_clean_resource_table interface Bjorn Helgaas
2008-04-28 22:34 ` [patch 24/55] PNP: remove unused interfaces using pnp_resource_table Bjorn Helgaas
2008-04-28 22:34 ` [patch 25/55] PNP: use dev_printk when possible Bjorn Helgaas
2008-04-28 22:34 ` [patch 26/55] PNP: factor pnp_init_resource_table() and pnp_clean_resource_table() Bjorn Helgaas
2008-04-28 22:34 ` [patch 27/55] PNP: add pnp_get_resource() interface Bjorn Helgaas
2008-04-28 22:34 ` [patch 28/55] PNP: remove pnp_mem_flags() as an lvalue Bjorn Helgaas
2008-04-28 22:34 ` [patch 29/55] PNP: convert resource accessors to use pnp_get_resource(), not pnp_resource_table Bjorn Helgaas
2008-04-28 22:34 ` [patch 30/55] PNP: use conventional "i" for loop indices Bjorn Helgaas
2008-04-28 22:34 ` [patch 31/55] PNP: reduce redundancy in pnp_assign_port() and others Bjorn Helgaas
2008-04-28 22:34 ` [patch 32/55] PNP: reduce redundancy in pnp_check_port() " Bjorn Helgaas
2008-04-28 22:34 ` [patch 33/55] PNP: reduce redundancy in pnp_set_current_resources() Bjorn Helgaas
2008-04-28 22:34 ` [patch 34/55] PNP: check for conflicts with all resources, not just earlier ones Bjorn Helgaas
2008-04-28 22:34 ` [patch 35/55] PNP: pass resources, not indexes, to pnp_check_port(), et al Bjorn Helgaas
2008-04-28 22:34 ` [patch 36/55] PNP: convert resource checks to use pnp_get_resource(), not pnp_resource_table Bjorn Helgaas
2008-04-28 22:34 ` [patch 37/55] PNP: convert encoders " Bjorn Helgaas
2008-04-28 22:34 ` Bjorn Helgaas [this message]
2008-04-28 22:34 ` [patch 39/55] PNP: remove PNP_MAX_* uses Bjorn Helgaas
2008-04-28 22:34 ` [patch 40/55] rtc: dont reference pnp_resource_table directly Bjorn Helgaas
2008-04-28 22:34 ` [patch 41/55] PNP: make pnp_resource_table private to PNP core Bjorn Helgaas
2008-04-28 22:34 ` [patch 42/55] PNP: remove pnp_resource_table references from resource decoders Bjorn Helgaas
2008-04-28 22:34 ` [patch 43/55] PNP: add struct pnp_resource Bjorn Helgaas
2008-04-28 22:34 ` [patch 44/55] PNP: add pnp_get_pnp_resource() Bjorn Helgaas
2008-04-28 22:34 ` [patch 45/55] PNP: add pnp_resource index for ISAPNP Bjorn Helgaas
2008-04-28 22:34 ` [patch 46/55] PNP: add pnp_new_resource() to find a new unset pnp_resource Bjorn Helgaas
2008-04-28 22:34 ` [patch 47/55] PNP: make generic pnp_add_irq_resource() Bjorn Helgaas
2008-04-28 22:34 ` [patch 48/55] PNP: make generic pnp_add_dma_resource() Bjorn Helgaas
2008-04-28 22:34 ` [patch 49/55] PNP: make generic pnp_add_io_resource() Bjorn Helgaas
2008-04-28 22:34 ` [patch 50/55] PNP: make generic pnp_add_mem_resource() Bjorn Helgaas
2008-04-28 22:34 ` [patch 51/55] ISAPNP: fold isapnp_read_resources() back into isapnp_get_resources() Bjorn Helgaas
2008-04-28 22:34 ` [patch 52/55] PNPACPI: move _CRS/_PRS warnings closer to the action Bjorn Helgaas
2008-04-28 22:34 ` [patch 53/55] PNP: make interfaces private to the PNP core Bjorn Helgaas
2008-04-28 22:34 ` [patch 54/55] ISAPNP: remove unused pnp_dev->regs field Bjorn Helgaas
2008-04-28 22:34 ` [patch 55/55] PNPBIOS: remove include/linux/pnpbios.h Bjorn Helgaas
2008-04-29  8:38 ` [patch 00/55] PNP cleanup, v5 Len Brown

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=20080428223624.295390288@ldl.fc.hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=abelay@mit.edu \
    --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