Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102035
b: refs/heads/master
c: 87e4acf
h: refs/heads/master
i:
  102033: fde441d
  102031: 9849e9a
v: v3
  • Loading branch information
Bjorn Helgaas authored and Andi Kleen committed Jul 16, 2008
1 parent 15c3082 commit af24bd8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 77 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b897f46cf7941fff8130ccdaf85f39528bff6a51
refs/heads/master: 87e4acf3ebc02c9d0a2f7a37b655c49176c4d765
1 change: 0 additions & 1 deletion trunk/drivers/pnp/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct pnp_resource *pnp_get_pnp_resource(struct pnp_dev *dev,

struct pnp_resource {
struct resource res;
unsigned int index; /* ISAPNP config register index */
};

struct pnp_resource_table {
Expand Down
20 changes: 4 additions & 16 deletions trunk/drivers/pnp/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
const char *ubuf, size_t count)
{
struct pnp_dev *dev = to_pnp_dev(dmdev);
struct pnp_resource *pnp_res;
char *buf = (void *)ubuf;
int retval = 0;
resource_size_t start, end;
Expand Down Expand Up @@ -368,7 +367,6 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
goto done;
}
if (!strnicmp(buf, "set", 3)) {
int nport = 0, nmem = 0, nirq = 0, ndma = 0;
if (dev->active)
goto done;
buf += 3;
Expand All @@ -391,10 +389,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
end = simple_strtoul(buf, &buf, 0);
} else
end = start;
pnp_res = pnp_add_io_resource(dev, start, end,
0);
if (pnp_res)
pnp_res->index = nport++;
pnp_add_io_resource(dev, start, end, 0);
continue;
}
if (!strnicmp(buf, "mem", 3)) {
Expand All @@ -411,30 +406,23 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
end = simple_strtoul(buf, &buf, 0);
} else
end = start;
pnp_res = pnp_add_mem_resource(dev, start, end,
0);
if (pnp_res)
pnp_res->index = nmem++;
pnp_add_mem_resource(dev, start, end, 0);
continue;
}
if (!strnicmp(buf, "irq", 3)) {
buf += 3;
while (isspace(*buf))
++buf;
start = simple_strtoul(buf, &buf, 0);
pnp_res = pnp_add_irq_resource(dev, start, 0);
if (pnp_res)
pnp_res->index = nirq++;
pnp_add_irq_resource(dev, start, 0);
continue;
}
if (!strnicmp(buf, "dma", 3)) {
buf += 3;
while (isspace(*buf))
++buf;
start = simple_strtoul(buf, &buf, 0);
pnp_res = pnp_add_dma_resource(dev, start, 0);
if (pnp_res)
pnp_res->index = ndma++;
pnp_add_dma_resource(dev, start, 0);
continue;
}
break;
Expand Down
84 changes: 29 additions & 55 deletions trunk/drivers/pnp/isapnp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,6 @@ EXPORT_SYMBOL(isapnp_write_byte);

static int isapnp_get_resources(struct pnp_dev *dev)
{
struct pnp_resource *pnp_res;
int i, ret;

dev_dbg(&dev->dev, "get resources\n");
Expand All @@ -940,35 +939,23 @@ static int isapnp_get_resources(struct pnp_dev *dev)

for (i = 0; i < ISAPNP_MAX_PORT; i++) {
ret = isapnp_read_word(ISAPNP_CFG_PORT + (i << 1));
if (ret) {
pnp_res = pnp_add_io_resource(dev, ret, ret, 0);
if (pnp_res)
pnp_res->index = i;
}
pnp_add_io_resource(dev, ret, ret,
ret == 0 ? IORESOURCE_DISABLED : 0);
}
for (i = 0; i < ISAPNP_MAX_MEM; i++) {
ret = isapnp_read_word(ISAPNP_CFG_MEM + (i << 3)) << 8;
if (ret) {
pnp_res = pnp_add_mem_resource(dev, ret, ret, 0);
if (pnp_res)
pnp_res->index = i;
}
pnp_add_mem_resource(dev, ret, ret,
ret == 0 ? IORESOURCE_DISABLED : 0);
}
for (i = 0; i < ISAPNP_MAX_IRQ; i++) {
ret = isapnp_read_word(ISAPNP_CFG_IRQ + (i << 1)) >> 8;
if (ret) {
pnp_res = pnp_add_irq_resource(dev, ret, 0);
if (pnp_res)
pnp_res->index = i;
}
pnp_add_irq_resource(dev, ret,
ret == 0 ? IORESOURCE_DISABLED : 0);
}
for (i = 0; i < ISAPNP_MAX_DMA; i++) {
ret = isapnp_read_byte(ISAPNP_CFG_DMA + i);
if (ret != 4) {
pnp_res = pnp_add_dma_resource(dev, ret, 0);
if (pnp_res)
pnp_res->index = i;
}
pnp_add_dma_resource(dev, ret,
ret == 4 ? IORESOURCE_DISABLED : 0);
}

__end:
Expand All @@ -978,62 +965,49 @@ static int isapnp_get_resources(struct pnp_dev *dev)

static int isapnp_set_resources(struct pnp_dev *dev)
{
struct pnp_resource *pnp_res;
struct resource *res;
int tmp, index;
int tmp;

dev_dbg(&dev->dev, "set resources\n");
isapnp_cfg_begin(dev->card->number, dev->number);
dev->active = 1;
for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) {
pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_IO, tmp);
if (!pnp_res)
continue;
res = &pnp_res->res;
if (pnp_resource_valid(res)) {
index = pnp_res->index;
res = pnp_get_resource(dev, IORESOURCE_IO, tmp);
if (res && pnp_resource_valid(res) &&
!(res->flags & IORESOURCE_DISABLED)) {
dev_dbg(&dev->dev, " set io %d to %#llx\n",
index, (unsigned long long) res->start);
isapnp_write_word(ISAPNP_CFG_PORT + (index << 1),
tmp, (unsigned long long) res->start);
isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1),
res->start);
}
}
for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) {
pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_IRQ, tmp);
if (!pnp_res)
continue;
res = &pnp_res->res;
if (pnp_resource_valid(res)) {
res = pnp_get_resource(dev, IORESOURCE_IRQ, tmp);
if (res && pnp_resource_valid(res) &&
!(res->flags & IORESOURCE_DISABLED)) {
int irq = res->start;
if (irq == 2)
irq = 9;
index = pnp_res->index;
dev_dbg(&dev->dev, " set irq %d to %d\n", index, irq);
isapnp_write_byte(ISAPNP_CFG_IRQ + (index << 1), irq);
dev_dbg(&dev->dev, " set irq %d to %d\n", tmp, irq);
isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq);
}
}
for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) {
pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_DMA, tmp);
if (!pnp_res)
continue;
res = &pnp_res->res;
if (pnp_resource_valid(res)) {
index = pnp_res->index;
res = pnp_get_resource(dev, IORESOURCE_DMA, tmp);
if (res && pnp_resource_valid(res) &&
!(res->flags & IORESOURCE_DISABLED)) {
dev_dbg(&dev->dev, " set dma %d to %lld\n",
index, (unsigned long long) res->start);
isapnp_write_byte(ISAPNP_CFG_DMA + index, res->start);
tmp, (unsigned long long) res->start);
isapnp_write_byte(ISAPNP_CFG_DMA + tmp, res->start);
}
}
for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) {
pnp_res = pnp_get_pnp_resource(dev, IORESOURCE_MEM, tmp);
if (!pnp_res)
continue;
res = &pnp_res->res;
if (pnp_resource_valid(res)) {
index = pnp_res->index;
res = pnp_get_resource(dev, IORESOURCE_MEM, tmp);
if (res && pnp_resource_valid(res) &&
!(res->flags & IORESOURCE_DISABLED)) {
dev_dbg(&dev->dev, " set mem %d to %#llx\n",
index, (unsigned long long) res->start);
isapnp_write_word(ISAPNP_CFG_MEM + (index << 3),
tmp, (unsigned long long) res->start);
isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3),
(res->start >> 8) & 0xffff);
}
}
Expand Down
4 changes: 0 additions & 4 deletions trunk/drivers/pnp/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
}

/* set the initial values */
pnp_res->index = idx;
res->flags |= rule->flags | IORESOURCE_IO;
res->flags &= ~IORESOURCE_UNSET;

Expand Down Expand Up @@ -90,7 +89,6 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
}

/* set the initial values */
pnp_res->index = idx;
res->flags |= rule->flags | IORESOURCE_MEM;
res->flags &= ~IORESOURCE_UNSET;

Expand Down Expand Up @@ -155,7 +153,6 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
}

/* set the initial values */
pnp_res->index = idx;
res->flags |= rule->flags | IORESOURCE_IRQ;
res->flags &= ~IORESOURCE_UNSET;

Expand Down Expand Up @@ -214,7 +211,6 @@ static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
}

/* set the initial values */
pnp_res->index = idx;
res->flags |= rule->flags | IORESOURCE_DMA;
res->flags &= ~IORESOURCE_UNSET;

Expand Down

0 comments on commit af24bd8

Please sign in to comment.