[patch 35/55] PNP: pass resources, not indexes, to pnp_check_port(), et al

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The caller already has the struct resource pointer, so no need for
pnp_check_port(), pnp_check_mem(), etc., to look it up again.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
Acked-By: Rene Herman <rene.herman@xxxxxxxxx>

Index: work10/drivers/pnp/base.h
===================================================================
--- work10.orig/drivers/pnp/base.h	2008-04-28 16:09:25.000000000 -0600
+++ work10/drivers/pnp/base.h	2008-04-28 16:09:34.000000000 -0600
@@ -12,10 +12,10 @@
 int __pnp_add_device(struct pnp_dev *dev);
 void __pnp_remove_device(struct pnp_dev *dev);
 
-int pnp_check_port(struct pnp_dev * dev, int idx);
-int pnp_check_mem(struct pnp_dev * dev, int idx);
-int pnp_check_irq(struct pnp_dev * dev, int idx);
-int pnp_check_dma(struct pnp_dev * dev, int idx);
+int pnp_check_port(struct pnp_dev *dev, struct resource *res);
+int pnp_check_mem(struct pnp_dev *dev, struct resource *res);
+int pnp_check_irq(struct pnp_dev *dev, struct resource *res);
+int pnp_check_dma(struct pnp_dev *dev, struct resource *res);
 
 void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
 
Index: work10/drivers/pnp/manager.c
===================================================================
--- work10.orig/drivers/pnp/manager.c	2008-04-28 16:09:31.000000000 -0600
+++ work10/drivers/pnp/manager.c	2008-04-28 16:09:34.000000000 -0600
@@ -51,7 +51,7 @@
 	res->end = res->start + rule->size - 1;
 
 	/* run through until pnp_check_port is happy */
-	while (!pnp_check_port(dev, idx)) {
+	while (!pnp_check_port(dev, res)) {
 		res->start += rule->align;
 		res->end = res->start + rule->size - 1;
 		if (res->start > rule->max || !rule->align) {
@@ -108,7 +108,7 @@
 	res->end = res->start + rule->size - 1;
 
 	/* run through until pnp_check_mem is happy */
-	while (!pnp_check_mem(dev, idx)) {
+	while (!pnp_check_mem(dev, res)) {
 		res->start += rule->align;
 		res->end = res->start + rule->size - 1;
 		if (res->start > rule->max || !rule->align) {
@@ -167,7 +167,7 @@
 	for (i = 0; i < 16; i++) {
 		if (test_bit(xtab[i], rule->map)) {
 			res->start = res->end = xtab[i];
-			if (pnp_check_irq(dev, idx)) {
+			if (pnp_check_irq(dev, res)) {
 				dev_dbg(&dev->dev, "  assign irq %d %d\n", idx,
 					(int) res->start);
 				return 1;
@@ -209,7 +209,7 @@
 	for (i = 0; i < 8; i++) {
 		if (rule->map & (1 << xtab[i])) {
 			res->start = res->end = xtab[i];
-			if (pnp_check_dma(dev, idx)) {
+			if (pnp_check_dma(dev, res)) {
 				dev_dbg(&dev->dev, "  assign dma %d %d\n", idx,
 					(int) res->start);
 				return;
Index: work10/drivers/pnp/resource.c
===================================================================
--- work10.orig/drivers/pnp/resource.c	2008-04-28 16:09:33.000000000 -0600
+++ work10/drivers/pnp/resource.c	2008-04-28 16:09:34.000000000 -0600
@@ -239,14 +239,13 @@
 #define cannot_compare(flags) \
 ((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED))
 
-int pnp_check_port(struct pnp_dev *dev, int idx)
+int pnp_check_port(struct pnp_dev *dev, struct resource *res)
 {
 	int i;
 	struct pnp_dev *tdev;
-	struct resource *res, *tres;
+	struct resource *tres;
 	resource_size_t *port, *end, *tport, *tend;
 
-	res = &dev->res.port_resource[idx];
 	port = &res->start;
 	end = &res->end;
 
@@ -300,14 +299,13 @@
 	return 1;
 }
 
-int pnp_check_mem(struct pnp_dev *dev, int idx)
+int pnp_check_mem(struct pnp_dev *dev, struct resource *res)
 {
 	int i;
 	struct pnp_dev *tdev;
-	struct resource *res, *tres;
+	struct resource *tres;
 	resource_size_t *addr, *end, *taddr, *tend;
 
-	res = &dev->res.mem_resource[idx];
 	addr = &res->start;
 	end = &res->end;
 
@@ -366,14 +364,13 @@
 	return IRQ_HANDLED;
 }
 
-int pnp_check_irq(struct pnp_dev *dev, int idx)
+int pnp_check_irq(struct pnp_dev *dev, struct resource *res)
 {
 	int i;
 	struct pnp_dev *tdev;
-	struct resource *res, *tres;
+	struct resource *tres;
 	resource_size_t *irq;
 
-	res = &dev->res.irq_resource[idx];
 	irq = &res->start;
 
 	/* if the resource doesn't exist, don't complain about it */
@@ -439,15 +436,14 @@
 	return 1;
 }
 
-int pnp_check_dma(struct pnp_dev *dev, int idx)
+int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
 {
 #ifndef CONFIG_IA64
 	int i;
 	struct pnp_dev *tdev;
-	struct resource *res, *tres;
+	struct resource *tres;
 	resource_size_t *dma;
 
-	res = &dev->res.dma_resource[idx];
 	dma = &res->start;
 
 	/* if the resource doesn't exist, don't complain about it */

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux