Commit 7aefff51 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Andi Kleen

PNP: introduce pnp_irq_mask_t typedef

This adds a typedef for the IRQ bitmap, which should cause
no functional change, but will make it easier to pass a
pointer to a bitmap to pnp_register_irq_resource().
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarRene Herman <rene.herman@gmail.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent a1802c42
...@@ -30,8 +30,10 @@ struct pnp_port { ...@@ -30,8 +30,10 @@ struct pnp_port {
}; };
#define PNP_IRQ_NR 256 #define PNP_IRQ_NR 256
typedef struct { DECLARE_BITMAP(bits, PNP_IRQ_NR); } pnp_irq_mask_t;
struct pnp_irq { struct pnp_irq {
DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmask for IRQ lines */ pnp_irq_mask_t map; /* bitmap for IRQ lines */
unsigned char flags; /* IRQ flags */ unsigned char flags; /* IRQ flags */
unsigned char pad; /* pad */ unsigned char pad; /* pad */
struct pnp_irq *next; /* next IRQ */ struct pnp_irq *next; /* next IRQ */
......
...@@ -67,7 +67,7 @@ static void pnp_print_irq(pnp_info_buffer_t * buffer, char *space, ...@@ -67,7 +67,7 @@ static void pnp_print_irq(pnp_info_buffer_t * buffer, char *space,
pnp_printf(buffer, "%sirq ", space); pnp_printf(buffer, "%sirq ", space);
for (i = 0; i < PNP_IRQ_NR; i++) for (i = 0; i < PNP_IRQ_NR; i++)
if (test_bit(i, irq->map)) { if (test_bit(i, irq->map.bits)) {
if (!first) { if (!first) {
pnp_printf(buffer, ","); pnp_printf(buffer, ",");
} else { } else {
...@@ -78,7 +78,7 @@ static void pnp_print_irq(pnp_info_buffer_t * buffer, char *space, ...@@ -78,7 +78,7 @@ static void pnp_print_irq(pnp_info_buffer_t * buffer, char *space,
else else
pnp_printf(buffer, "%i", i); pnp_printf(buffer, "%i", i);
} }
if (bitmap_empty(irq->map, PNP_IRQ_NR)) if (bitmap_empty(irq->map.bits, PNP_IRQ_NR))
pnp_printf(buffer, "<none>"); pnp_printf(buffer, "<none>");
if (irq->flags & IORESOURCE_IRQ_HIGHEDGE) if (irq->flags & IORESOURCE_IRQ_HIGHEDGE)
pnp_printf(buffer, " High-Edge"); pnp_printf(buffer, " High-Edge");
......
...@@ -441,7 +441,7 @@ static void __init isapnp_parse_irq_resource(struct pnp_dev *dev, ...@@ -441,7 +441,7 @@ static void __init isapnp_parse_irq_resource(struct pnp_dev *dev,
if (!irq) if (!irq)
return; return;
bits = (tmp[1] << 8) | tmp[0]; bits = (tmp[1] << 8) | tmp[0];
bitmap_copy(irq->map, &bits, 16); bitmap_copy(irq->map.bits, &bits, 16);
if (size > 2) if (size > 2)
irq->flags = tmp[2]; irq->flags = tmp[2];
else else
......
...@@ -128,20 +128,20 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) ...@@ -128,20 +128,20 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
res->start = -1; res->start = -1;
res->end = -1; res->end = -1;
if (bitmap_empty(rule->map, PNP_IRQ_NR)) { if (bitmap_empty(rule->map.bits, PNP_IRQ_NR)) {
res->flags |= IORESOURCE_DISABLED; res->flags |= IORESOURCE_DISABLED;
dev_dbg(&dev->dev, " irq %d disabled\n", idx); dev_dbg(&dev->dev, " irq %d disabled\n", idx);
goto __add; goto __add;
} }
/* TBD: need check for >16 IRQ */ /* TBD: need check for >16 IRQ */
res->start = find_next_bit(rule->map, PNP_IRQ_NR, 16); res->start = find_next_bit(rule->map.bits, PNP_IRQ_NR, 16);
if (res->start < PNP_IRQ_NR) { if (res->start < PNP_IRQ_NR) {
res->end = res->start; res->end = res->start;
goto __add; goto __add;
} }
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (test_bit(xtab[i], rule->map)) { if (test_bit(xtab[i], rule->map.bits)) {
res->start = res->end = xtab[i]; res->start = res->end = xtab[i];
if (pnp_check_irq(dev, res)) if (pnp_check_irq(dev, res))
goto __add; goto __add;
......
...@@ -442,7 +442,7 @@ static __init void pnpacpi_parse_irq_option(struct pnp_dev *dev, ...@@ -442,7 +442,7 @@ static __init void pnpacpi_parse_irq_option(struct pnp_dev *dev,
for (i = 0; i < p->interrupt_count; i++) for (i = 0; i < p->interrupt_count; i++)
if (p->interrupts[i]) if (p->interrupts[i])
__set_bit(p->interrupts[i], irq->map); __set_bit(p->interrupts[i], irq->map.bits);
irq->flags = irq_flags(p->triggering, p->polarity, p->sharable); irq->flags = irq_flags(p->triggering, p->polarity, p->sharable);
pnp_register_irq_resource(dev, option, irq); pnp_register_irq_resource(dev, option, irq);
...@@ -463,7 +463,7 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev, ...@@ -463,7 +463,7 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev,
for (i = 0; i < p->interrupt_count; i++) for (i = 0; i < p->interrupt_count; i++)
if (p->interrupts[i]) if (p->interrupts[i])
__set_bit(p->interrupts[i], irq->map); __set_bit(p->interrupts[i], irq->map.bits);
irq->flags = irq_flags(p->triggering, p->polarity, p->sharable); irq->flags = irq_flags(p->triggering, p->polarity, p->sharable);
pnp_register_irq_resource(dev, option, irq); pnp_register_irq_resource(dev, option, irq);
......
...@@ -275,7 +275,7 @@ static __init void pnpbios_parse_irq_option(struct pnp_dev *dev, ...@@ -275,7 +275,7 @@ static __init void pnpbios_parse_irq_option(struct pnp_dev *dev,
if (!irq) if (!irq)
return; return;
bits = (p[2] << 8) | p[1]; bits = (p[2] << 8) | p[1];
bitmap_copy(irq->map, &bits, 16); bitmap_copy(irq->map.bits, &bits, 16);
if (size > 2) if (size > 2)
irq->flags = p[3]; irq->flags = p[3];
else else
......
...@@ -66,15 +66,18 @@ static void quirk_cmi8330_resources(struct pnp_dev *dev) ...@@ -66,15 +66,18 @@ static void quirk_cmi8330_resources(struct pnp_dev *dev)
struct pnp_irq *irq; struct pnp_irq *irq;
struct pnp_dma *dma; struct pnp_dma *dma;
for (irq = res->irq; irq; irq = irq->next) { // Valid irqs are 5, 7, 10 for (irq = res->irq; irq; irq = irq->next) {
/* Valid irqs are 5, 7, 10 */
tmp = 0x04A0; tmp = 0x04A0;
bitmap_copy(irq->map, &tmp, 16); // 0000 0100 1010 0000 bitmap_copy(irq->map.bits, &tmp, 16);
} }
for (dma = res->dma; dma; dma = dma->next) // Valid 8bit dma channels are 1,3 for (dma = res->dma; dma; dma = dma->next) {
/* Valid 8bit dma channels are 1,3 */
if ((dma->flags & IORESOURCE_DMA_TYPE_MASK) == if ((dma->flags & IORESOURCE_DMA_TYPE_MASK) ==
IORESOURCE_DMA_8BIT) IORESOURCE_DMA_8BIT)
dma->map = 0x000A; dma->map = 0x000A;
}
} }
dev_info(&dev->dev, "CMI8330 quirk - forced possible IRQs to 5, 7, 10 " dev_info(&dev->dev, "CMI8330 quirk - forced possible IRQs to 5, 7, 10 "
"and DMA channels to 1, 3\n"); "and DMA channels to 1, 3\n");
...@@ -187,7 +190,7 @@ static void quirk_ad1815_mpu_resources(struct pnp_dev *dev) ...@@ -187,7 +190,7 @@ static void quirk_ad1815_mpu_resources(struct pnp_dev *dev)
if (!copy) if (!copy)
break; break;
memcpy(copy->map, irq->map, sizeof copy->map); bitmap_copy(copy->map.bits, irq->map.bits, PNP_IRQ_NR);
copy->flags = irq->flags; copy->flags = irq->flags;
copy->next = res->irq; /* Yes, this is NULL */ copy->next = res->irq; /* Yes, this is NULL */
......
...@@ -98,13 +98,13 @@ int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option, ...@@ -98,13 +98,13 @@ int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option,
int i; int i;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (test_bit(i, data->map)) if (test_bit(i, data->map.bits))
pcibios_penalize_isa_irq(i, 0); pcibios_penalize_isa_irq(i, 0);
} }
#endif #endif
#ifdef DEBUG #ifdef DEBUG
bitmap_scnprintf(buf, sizeof(buf), data->map, PNP_IRQ_NR); bitmap_scnprintf(buf, sizeof(buf), data->map.bits, PNP_IRQ_NR);
dev_dbg(&dev->dev, " irq bitmask %s flags %#x\n", buf, dev_dbg(&dev->dev, " irq bitmask %s flags %#x\n", buf,
data->flags); data->flags);
#endif #endif
...@@ -653,7 +653,7 @@ static int pnp_possible_option(struct pnp_option *option, int type, ...@@ -653,7 +653,7 @@ static int pnp_possible_option(struct pnp_option *option, int type,
case IORESOURCE_IRQ: case IORESOURCE_IRQ:
for (irq = tmp->irq; irq; irq = irq->next) { for (irq = tmp->irq; irq; irq = irq->next) {
if (start < PNP_IRQ_NR && if (start < PNP_IRQ_NR &&
test_bit(start, irq->map)) test_bit(start, irq->map.bits))
return 1; return 1;
} }
break; break;
......
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