aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-06-27 18:57:05 -0400
committerAndi Kleen <andi@basil.nowhere.org>2008-07-16 17:27:06 -0400
commit7aefff51854ccd33599c40b4e360d94cb2b7622f (patch)
tree10cc269be1f9b581028dd6540a6e15a1b9d02e9a /drivers/pnp
parenta1802c42950403657d07e64558eff612d550ce16 (diff)
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: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Rene Herman <rene.herman@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/base.h4
-rw-r--r--drivers/pnp/interface.c4
-rw-r--r--drivers/pnp/isapnp/core.c2
-rw-r--r--drivers/pnp/manager.c6
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c4
-rw-r--r--drivers/pnp/pnpbios/rsparser.c2
-rw-r--r--drivers/pnp/quirks.c11
-rw-r--r--drivers/pnp/resource.c6
8 files changed, 22 insertions, 17 deletions
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index 3126e4582008..a9ee0a9fec77 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -30,8 +30,10 @@ struct pnp_port {
30}; 30};
31 31
32#define PNP_IRQ_NR 256 32#define PNP_IRQ_NR 256
33typedef struct { DECLARE_BITMAP(bits, PNP_IRQ_NR); } pnp_irq_mask_t;
34
33struct pnp_irq { 35struct pnp_irq {
34 DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmask for IRQ lines */ 36 pnp_irq_mask_t map; /* bitmap for IRQ lines */
35 unsigned char flags; /* IRQ flags */ 37 unsigned char flags; /* IRQ flags */
36 unsigned char pad; /* pad */ 38 unsigned char pad; /* pad */
37 struct pnp_irq *next; /* next IRQ */ 39 struct pnp_irq *next; /* next IRQ */
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index c172b6de6b71..249b4078d1ec 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -67,7 +67,7 @@ static void pnp_print_irq(pnp_info_buffer_t * buffer, char *space,
67 67
68 pnp_printf(buffer, "%sirq ", space); 68 pnp_printf(buffer, "%sirq ", space);
69 for (i = 0; i < PNP_IRQ_NR; i++) 69 for (i = 0; i < PNP_IRQ_NR; i++)
70 if (test_bit(i, irq->map)) { 70 if (test_bit(i, irq->map.bits)) {
71 if (!first) { 71 if (!first) {
72 pnp_printf(buffer, ","); 72 pnp_printf(buffer, ",");
73 } else { 73 } else {
@@ -78,7 +78,7 @@ static void pnp_print_irq(pnp_info_buffer_t * buffer, char *space,
78 else 78 else
79 pnp_printf(buffer, "%i", i); 79 pnp_printf(buffer, "%i", i);
80 } 80 }
81 if (bitmap_empty(irq->map, PNP_IRQ_NR)) 81 if (bitmap_empty(irq->map.bits, PNP_IRQ_NR))
82 pnp_printf(buffer, "<none>"); 82 pnp_printf(buffer, "<none>");
83 if (irq->flags & IORESOURCE_IRQ_HIGHEDGE) 83 if (irq->flags & IORESOURCE_IRQ_HIGHEDGE)
84 pnp_printf(buffer, " High-Edge"); 84 pnp_printf(buffer, " High-Edge");
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index c5b92526963b..e0caa71b16c0 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -441,7 +441,7 @@ static void __init isapnp_parse_irq_resource(struct pnp_dev *dev,
441 if (!irq) 441 if (!irq)
442 return; 442 return;
443 bits = (tmp[1] << 8) | tmp[0]; 443 bits = (tmp[1] << 8) | tmp[0];
444 bitmap_copy(irq->map, &bits, 16); 444 bitmap_copy(irq->map.bits, &bits, 16);
445 if (size > 2) 445 if (size > 2)
446 irq->flags = tmp[2]; 446 irq->flags = tmp[2];
447 else 447 else
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index 165b624081ad..e758dd225576 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -128,20 +128,20 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
128 res->start = -1; 128 res->start = -1;
129 res->end = -1; 129 res->end = -1;
130 130
131 if (bitmap_empty(rule->map, PNP_IRQ_NR)) { 131 if (bitmap_empty(rule->map.bits, PNP_IRQ_NR)) {
132 res->flags |= IORESOURCE_DISABLED; 132 res->flags |= IORESOURCE_DISABLED;
133 dev_dbg(&dev->dev, " irq %d disabled\n", idx); 133 dev_dbg(&dev->dev, " irq %d disabled\n", idx);
134 goto __add; 134 goto __add;
135 } 135 }
136 136
137 /* TBD: need check for >16 IRQ */ 137 /* TBD: need check for >16 IRQ */
138 res->start = find_next_bit(rule->map, PNP_IRQ_NR, 16); 138 res->start = find_next_bit(rule->map.bits, PNP_IRQ_NR, 16);
139 if (res->start < PNP_IRQ_NR) { 139 if (res->start < PNP_IRQ_NR) {
140 res->end = res->start; 140 res->end = res->start;
141 goto __add; 141 goto __add;
142 } 142 }
143 for (i = 0; i < 16; i++) { 143 for (i = 0; i < 16; i++) {
144 if (test_bit(xtab[i], rule->map)) { 144 if (test_bit(xtab[i], rule->map.bits)) {
145 res->start = res->end = xtab[i]; 145 res->start = res->end = xtab[i];
146 if (pnp_check_irq(dev, res)) 146 if (pnp_check_irq(dev, res))
147 goto __add; 147 goto __add;
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 46069e64a6b2..ae65454a23bb 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -442,7 +442,7 @@ static __init void pnpacpi_parse_irq_option(struct pnp_dev *dev,
442 442
443 for (i = 0; i < p->interrupt_count; i++) 443 for (i = 0; i < p->interrupt_count; i++)
444 if (p->interrupts[i]) 444 if (p->interrupts[i])
445 __set_bit(p->interrupts[i], irq->map); 445 __set_bit(p->interrupts[i], irq->map.bits);
446 irq->flags = irq_flags(p->triggering, p->polarity, p->sharable); 446 irq->flags = irq_flags(p->triggering, p->polarity, p->sharable);
447 447
448 pnp_register_irq_resource(dev, option, irq); 448 pnp_register_irq_resource(dev, option, irq);
@@ -463,7 +463,7 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev,
463 463
464 for (i = 0; i < p->interrupt_count; i++) 464 for (i = 0; i < p->interrupt_count; i++)
465 if (p->interrupts[i]) 465 if (p->interrupts[i])
466 __set_bit(p->interrupts[i], irq->map); 466 __set_bit(p->interrupts[i], irq->map.bits);
467 irq->flags = irq_flags(p->triggering, p->polarity, p->sharable); 467 irq->flags = irq_flags(p->triggering, p->polarity, p->sharable);
468 468
469 pnp_register_irq_resource(dev, option, irq); 469 pnp_register_irq_resource(dev, option, irq);
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index 489fec3b7974..dd2ea7b03605 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -275,7 +275,7 @@ static __init void pnpbios_parse_irq_option(struct pnp_dev *dev,
275 if (!irq) 275 if (!irq)
276 return; 276 return;
277 bits = (p[2] << 8) | p[1]; 277 bits = (p[2] << 8) | p[1];
278 bitmap_copy(irq->map, &bits, 16); 278 bitmap_copy(irq->map.bits, &bits, 16);
279 if (size > 2) 279 if (size > 2)
280 irq->flags = p[3]; 280 irq->flags = p[3];
281 else 281 else
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 21acb54eff6d..48e60171b3ba 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -66,15 +66,18 @@ static void quirk_cmi8330_resources(struct pnp_dev *dev)
66 struct pnp_irq *irq; 66 struct pnp_irq *irq;
67 struct pnp_dma *dma; 67 struct pnp_dma *dma;
68 68
69 for (irq = res->irq; irq; irq = irq->next) { // Valid irqs are 5, 7, 10 69 for (irq = res->irq; irq; irq = irq->next) {
70 /* Valid irqs are 5, 7, 10 */
70 tmp = 0x04A0; 71 tmp = 0x04A0;
71 bitmap_copy(irq->map, &tmp, 16); // 0000 0100 1010 0000 72 bitmap_copy(irq->map.bits, &tmp, 16);
72 } 73 }
73 74
74 for (dma = res->dma; dma; dma = dma->next) // Valid 8bit dma channels are 1,3 75 for (dma = res->dma; dma; dma = dma->next) {
76 /* Valid 8bit dma channels are 1,3 */
75 if ((dma->flags & IORESOURCE_DMA_TYPE_MASK) == 77 if ((dma->flags & IORESOURCE_DMA_TYPE_MASK) ==
76 IORESOURCE_DMA_8BIT) 78 IORESOURCE_DMA_8BIT)
77 dma->map = 0x000A; 79 dma->map = 0x000A;
80 }
78 } 81 }
79 dev_info(&dev->dev, "CMI8330 quirk - forced possible IRQs to 5, 7, 10 " 82 dev_info(&dev->dev, "CMI8330 quirk - forced possible IRQs to 5, 7, 10 "
80 "and DMA channels to 1, 3\n"); 83 "and DMA channels to 1, 3\n");
@@ -187,7 +190,7 @@ static void quirk_ad1815_mpu_resources(struct pnp_dev *dev)
187 if (!copy) 190 if (!copy)
188 break; 191 break;
189 192
190 memcpy(copy->map, irq->map, sizeof copy->map); 193 bitmap_copy(copy->map.bits, irq->map.bits, PNP_IRQ_NR);
191 copy->flags = irq->flags; 194 copy->flags = irq->flags;
192 195
193 copy->next = res->irq; /* Yes, this is NULL */ 196 copy->next = res->irq; /* Yes, this is NULL */
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 786fd356916d..55a57cded24a 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -98,13 +98,13 @@ int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option,
98 int i; 98 int i;
99 99
100 for (i = 0; i < 16; i++) 100 for (i = 0; i < 16; i++)
101 if (test_bit(i, data->map)) 101 if (test_bit(i, data->map.bits))
102 pcibios_penalize_isa_irq(i, 0); 102 pcibios_penalize_isa_irq(i, 0);
103 } 103 }
104#endif 104#endif
105 105
106#ifdef DEBUG 106#ifdef DEBUG
107 bitmap_scnprintf(buf, sizeof(buf), data->map, PNP_IRQ_NR); 107 bitmap_scnprintf(buf, sizeof(buf), data->map.bits, PNP_IRQ_NR);
108 dev_dbg(&dev->dev, " irq bitmask %s flags %#x\n", buf, 108 dev_dbg(&dev->dev, " irq bitmask %s flags %#x\n", buf,
109 data->flags); 109 data->flags);
110#endif 110#endif
@@ -653,7 +653,7 @@ static int pnp_possible_option(struct pnp_option *option, int type,
653 case IORESOURCE_IRQ: 653 case IORESOURCE_IRQ:
654 for (irq = tmp->irq; irq; irq = irq->next) { 654 for (irq = tmp->irq; irq; irq = irq->next) {
655 if (start < PNP_IRQ_NR && 655 if (start < PNP_IRQ_NR &&
656 test_bit(start, irq->map)) 656 test_bit(start, irq->map.bits))
657 return 1; 657 return 1;
658 } 658 }
659 break; 659 break;