Commit 01115e7d authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Len Brown

ISAPNP: fold isapnp_read_resources() back into isapnp_get_resources()

isapnp_get_resources() does very little besides call
isapnp_read_resources(), so just fold them back together.

Based on a patch by Rene Herman <rene.herman@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent d6180f36
...@@ -929,62 +929,54 @@ EXPORT_SYMBOL(isapnp_cfg_begin); ...@@ -929,62 +929,54 @@ EXPORT_SYMBOL(isapnp_cfg_begin);
EXPORT_SYMBOL(isapnp_cfg_end); EXPORT_SYMBOL(isapnp_cfg_end);
EXPORT_SYMBOL(isapnp_write_byte); EXPORT_SYMBOL(isapnp_write_byte);
static int isapnp_read_resources(struct pnp_dev *dev) static int isapnp_get_resources(struct pnp_dev *dev)
{ {
struct pnp_resource *pnp_res; struct pnp_resource *pnp_res;
int tmp, ret; int i, ret;
dev_dbg(&dev->dev, "get resources\n");
pnp_init_resources(dev);
isapnp_cfg_begin(dev->card->number, dev->number);
dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE);
if (dev->active) { if (!dev->active)
for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) { goto __end;
ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1));
if (!ret) for (i = 0; i < ISAPNP_MAX_PORT; i++) {
continue; ret = isapnp_read_word(ISAPNP_CFG_PORT + (i << 1));
if (ret) {
pnp_res = pnp_add_io_resource(dev, ret, ret, 0); pnp_res = pnp_add_io_resource(dev, ret, ret, 0);
if (pnp_res) if (pnp_res)
pnp_res->index = tmp; pnp_res->index = i;
} }
for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { }
ret = for (i = 0; i < ISAPNP_MAX_MEM; i++) {
isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; ret = isapnp_read_word(ISAPNP_CFG_MEM + (i << 3)) << 8;
if (!ret) if (ret) {
continue;
pnp_res = pnp_add_mem_resource(dev, ret, ret, 0); pnp_res = pnp_add_mem_resource(dev, ret, ret, 0);
if (pnp_res) if (pnp_res)
pnp_res->index = tmp; pnp_res->index = i;
} }
for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { }
ret = for (i = 0; i < ISAPNP_MAX_IRQ; i++) {
(isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> ret = isapnp_read_word(ISAPNP_CFG_IRQ + (i << 1)) >> 8;
8); if (ret) {
if (!ret)
continue;
pnp_res = pnp_add_irq_resource(dev, ret, 0); pnp_res = pnp_add_irq_resource(dev, ret, 0);
if (pnp_res) if (pnp_res)
pnp_res->index = tmp; pnp_res->index = i;
} }
for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { }
ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); for (i = 0; i < ISAPNP_MAX_DMA; i++) {
if (ret == 4) ret = isapnp_read_byte(ISAPNP_CFG_DMA + i);
continue; if (ret != 4) {
pnp_res = pnp_add_dma_resource(dev, ret, 0); pnp_res = pnp_add_dma_resource(dev, ret, 0);
if (pnp_res) if (pnp_res)
pnp_res->index = tmp; pnp_res->index = i;
} }
} }
return 0;
}
static int isapnp_get_resources(struct pnp_dev *dev) __end:
{
int ret;
dev_dbg(&dev->dev, "get resources\n");
pnp_init_resources(dev);
isapnp_cfg_begin(dev->card->number, dev->number);
ret = isapnp_read_resources(dev);
isapnp_cfg_end(); isapnp_cfg_end();
return ret; return 0;
} }
static int isapnp_set_resources(struct pnp_dev *dev) static int isapnp_set_resources(struct pnp_dev *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment