lkml.org 
[lkml]   [2008]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch 00/37] PNP resource_table cleanups, v2
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.
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)
\
 
 \ /
  Last update: 2008-04-03 21:29    [W:0.063 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site