Re: [patch 00/37] PNP resource_table cleanups, v2

Rene Herman
2008-04-03T19:27:28Z

[-- Attachment #1: Type: text/plain, Size: 333 bytes --]

On 03-04-08 19:12, Rene Herman wrote:

>>> isapnp_read_resources() stores the resources as read from the
>>> hardware at the index in the table that matches the actual index in
>>> the hardware and isapnp_set_resources() stores them back into those
>>> same hardware indices.

While I was there a small cleanup by the way.

Rene.

[-- Attachment #2: isapnp_get_resources.diff --]
[-- Type: text/plain, Size: 2529 bytes --]

commit 8329f61f01c5edf3060ccf19c6341eb49953158f
Author: Rene Herman <rene.herman@gmail.com>
Date: Thu Apr 3 21:01:38 2008 +0200

ISAPNP: fold isapnp_read_resources() back into isapnp_get_resources()

Signed-off-by: Rene Herman <rene.herman@gmail.com>

diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index fa66597..0bec593 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -921,52 +921,37 @@ EXPORT_SYMBOL(isapnp_cfg_begin);
EXPORT_SYMBOL(isapnp_cfg_end);
EXPORT_SYMBOL(isapnp_write_byte);

-static int isapnp_read_resources(struct pnp_dev *dev)
+static int isapnp_get_resources(struct pnp_dev *dev)
{
- int tmp, ret;
+ int i, ret;

+ pnp_init_resources(dev);
+ isapnp_cfg_begin(dev->card->number, dev->number);
dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE);
if (dev->active) {
- for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) {
- ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1));
- if (!ret)
- continue;
- pnp_add_io_resource(dev, ret, 1, 0);
+ for (i = 0; i < ISAPNP_MAX_PORT; i++) {
+ ret = isapnp_read_word(ISAPNP_CFG_PORT + (i << 1));
+ if (ret)
+ pnp_add_io_resource(dev, ret, 1, 0);
}
- for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) {
- ret =
- isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8;
- if (!ret)
- continue;
- pnp_add_mem_resource(dev, ret, 1, 0);
+ for (i = 0; i < ISAPNP_MAX_MEM; i++) {
+ ret = isapnp_read_word(ISAPNP_CFG_MEM + (i << 3)) << 8;
+ if (ret)
+ pnp_add_mem_resource(dev, ret, 1, 0);
}
- for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) {
- ret =
- (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >>
- 8);
- if (!ret)
- continue;
- pnp_add_irq_resource(dev, ret, 0);
+ for (i = 0; i < ISAPNP_MAX_IRQ; i++) {
+ ret = isapnp_read_word(ISAPNP_CFG_IRQ + (i << 1)) >> 8;
+ if (ret)
+ pnp_add_irq_resource(dev, ret, 0);
}
- for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) {
- ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp);
- if (ret == 4)
- continue;
- pnp_add_dma_resource(dev, ret, 0);
+ for (i = 0; i < ISAPNP_MAX_DMA; i++) {
+ ret = isapnp_read_byte(ISAPNP_CFG_DMA + i);
+ if (ret != 4)
+ pnp_add_dma_resource(dev, ret, 0);
}
}
- return 0;
-}
-
-static int isapnp_get_resources(struct pnp_dev *dev)
-{
- int ret;
-
- pnp_init_resources(dev);
- isapnp_cfg_begin(dev->card->number, dev->number);
- ret = isapnp_read_resources(dev);
isapnp_cfg_end();
- return ret;
+ return 0;
}

static int isapnp_set_resources(struct pnp_dev *dev)