diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:06 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:21 -0400 |
commit | 4ab55d8d4f7b910c4c60e0f8ff70d0dfdd484f02 (patch) | |
tree | 7ae1fd11249b844b7ae53faff5ee2906a6a796c2 /drivers/pnp/pnpbios/rsparser.c | |
parent | 59284cb4099411bc6f4915a5a4cb76414440c447 (diff) |
PNP: remove more pnp_resource_table arguments
Stop passing around struct pnp_resource_table pointers. In most cases,
the caller doesn't need to know how the resources are stored inside
the struct pnp_dev.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-By: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpbios/rsparser.c')
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 70aa559b3f8c..1b8f30ff192a 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -54,9 +54,9 @@ inline void pcibios_penalize_isa_irq(int irq, int active) | |||
54 | * Allocated Resources | 54 | * Allocated Resources |
55 | */ | 55 | */ |
56 | 56 | ||
57 | static void pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res, | 57 | static void pnpbios_parse_allocated_irqresource(struct pnp_dev *dev, int irq) |
58 | int irq) | ||
59 | { | 58 | { |
59 | struct pnp_resource_table *res = &dev->res; | ||
60 | int i = 0; | 60 | int i = 0; |
61 | 61 | ||
62 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) | 62 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) |
@@ -74,9 +74,9 @@ static void pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | static void pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res, | 77 | static void pnpbios_parse_allocated_dmaresource(struct pnp_dev *dev, int dma) |
78 | int dma) | ||
79 | { | 78 | { |
79 | struct pnp_resource_table *res = &dev->res; | ||
80 | int i = 0; | 80 | int i = 0; |
81 | 81 | ||
82 | while (i < PNP_MAX_DMA && | 82 | while (i < PNP_MAX_DMA && |
@@ -93,9 +93,10 @@ static void pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res, | |||
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | static void pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res, | 96 | static void pnpbios_parse_allocated_ioresource(struct pnp_dev *dev, |
97 | int io, int len) | 97 | int io, int len) |
98 | { | 98 | { |
99 | struct pnp_resource_table *res = &dev->res; | ||
99 | int i = 0; | 100 | int i = 0; |
100 | 101 | ||
101 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) | 102 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) |
@@ -112,9 +113,10 @@ static void pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
112 | } | 113 | } |
113 | } | 114 | } |
114 | 115 | ||
115 | static void pnpbios_parse_allocated_memresource(struct pnp_resource_table *res, | 116 | static void pnpbios_parse_allocated_memresource(struct pnp_dev *dev, |
116 | int mem, int len) | 117 | int mem, int len) |
117 | { | 118 | { |
119 | struct pnp_resource_table *res = &dev->res; | ||
118 | int i = 0; | 120 | int i = 0; |
119 | 121 | ||
120 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) | 122 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) |
@@ -131,11 +133,9 @@ static void pnpbios_parse_allocated_memresource(struct pnp_resource_table *res, | |||
131 | } | 133 | } |
132 | } | 134 | } |
133 | 135 | ||
134 | static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | 136 | static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev, |
135 | unsigned char *end, | 137 | unsigned char *p, |
136 | struct | 138 | unsigned char *end) |
137 | pnp_resource_table | ||
138 | *res) | ||
139 | { | 139 | { |
140 | unsigned int len, tag; | 140 | unsigned int len, tag; |
141 | int io, size, mask, i; | 141 | int io, size, mask, i; |
@@ -144,7 +144,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
144 | return NULL; | 144 | return NULL; |
145 | 145 | ||
146 | /* Blank the resource table values */ | 146 | /* Blank the resource table values */ |
147 | pnp_init_resource_table(res); | 147 | pnp_init_resource_table(&dev->res); |
148 | 148 | ||
149 | while ((char *)p < (char *)end) { | 149 | while ((char *)p < (char *)end) { |
150 | 150 | ||
@@ -164,7 +164,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
164 | goto len_err; | 164 | goto len_err; |
165 | io = *(short *)&p[4]; | 165 | io = *(short *)&p[4]; |
166 | size = *(short *)&p[10]; | 166 | size = *(short *)&p[10]; |
167 | pnpbios_parse_allocated_memresource(res, io, size); | 167 | pnpbios_parse_allocated_memresource(dev, io, size); |
168 | break; | 168 | break; |
169 | 169 | ||
170 | case LARGE_TAG_ANSISTR: | 170 | case LARGE_TAG_ANSISTR: |
@@ -180,7 +180,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
180 | goto len_err; | 180 | goto len_err; |
181 | io = *(int *)&p[4]; | 181 | io = *(int *)&p[4]; |
182 | size = *(int *)&p[16]; | 182 | size = *(int *)&p[16]; |
183 | pnpbios_parse_allocated_memresource(res, io, size); | 183 | pnpbios_parse_allocated_memresource(dev, io, size); |
184 | break; | 184 | break; |
185 | 185 | ||
186 | case LARGE_TAG_FIXEDMEM32: | 186 | case LARGE_TAG_FIXEDMEM32: |
@@ -188,7 +188,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
188 | goto len_err; | 188 | goto len_err; |
189 | io = *(int *)&p[4]; | 189 | io = *(int *)&p[4]; |
190 | size = *(int *)&p[8]; | 190 | size = *(int *)&p[8]; |
191 | pnpbios_parse_allocated_memresource(res, io, size); | 191 | pnpbios_parse_allocated_memresource(dev, io, size); |
192 | break; | 192 | break; |
193 | 193 | ||
194 | case SMALL_TAG_IRQ: | 194 | case SMALL_TAG_IRQ: |
@@ -199,7 +199,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
199 | for (i = 0; i < 16; i++, mask = mask >> 1) | 199 | for (i = 0; i < 16; i++, mask = mask >> 1) |
200 | if (mask & 0x01) | 200 | if (mask & 0x01) |
201 | io = i; | 201 | io = i; |
202 | pnpbios_parse_allocated_irqresource(res, io); | 202 | pnpbios_parse_allocated_irqresource(dev, io); |
203 | break; | 203 | break; |
204 | 204 | ||
205 | case SMALL_TAG_DMA: | 205 | case SMALL_TAG_DMA: |
@@ -210,7 +210,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
210 | for (i = 0; i < 8; i++, mask = mask >> 1) | 210 | for (i = 0; i < 8; i++, mask = mask >> 1) |
211 | if (mask & 0x01) | 211 | if (mask & 0x01) |
212 | io = i; | 212 | io = i; |
213 | pnpbios_parse_allocated_dmaresource(res, io); | 213 | pnpbios_parse_allocated_dmaresource(dev, io); |
214 | break; | 214 | break; |
215 | 215 | ||
216 | case SMALL_TAG_PORT: | 216 | case SMALL_TAG_PORT: |
@@ -218,7 +218,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
218 | goto len_err; | 218 | goto len_err; |
219 | io = p[2] + p[3] * 256; | 219 | io = p[2] + p[3] * 256; |
220 | size = p[7]; | 220 | size = p[7]; |
221 | pnpbios_parse_allocated_ioresource(res, io, size); | 221 | pnpbios_parse_allocated_ioresource(dev, io, size); |
222 | break; | 222 | break; |
223 | 223 | ||
224 | case SMALL_TAG_VENDOR: | 224 | case SMALL_TAG_VENDOR: |
@@ -230,7 +230,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
230 | goto len_err; | 230 | goto len_err; |
231 | io = p[1] + p[2] * 256; | 231 | io = p[1] + p[2] * 256; |
232 | size = p[3]; | 232 | size = p[3]; |
233 | pnpbios_parse_allocated_ioresource(res, io, size); | 233 | pnpbios_parse_allocated_ioresource(dev, io, size); |
234 | break; | 234 | break; |
235 | 235 | ||
236 | case SMALL_TAG_END: | 236 | case SMALL_TAG_END: |
@@ -660,12 +660,12 @@ static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res) | |||
660 | p[3] = len & 0xff; | 660 | p[3] = len & 0xff; |
661 | } | 661 | } |
662 | 662 | ||
663 | static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p, | 663 | static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev |
664 | unsigned char *end, | 664 | *dev, |
665 | struct | 665 | unsigned char *p, |
666 | pnp_resource_table | 666 | unsigned char *end) |
667 | *res) | ||
668 | { | 667 | { |
668 | struct pnp_resource_table *res = &dev->res; | ||
669 | unsigned int len, tag; | 669 | unsigned int len, tag; |
670 | int port = 0, irq = 0, dma = 0, mem = 0; | 670 | int port = 0, irq = 0, dma = 0, mem = 0; |
671 | 671 | ||
@@ -774,7 +774,7 @@ int __init pnpbios_parse_data_stream(struct pnp_dev *dev, | |||
774 | unsigned char *p = (char *)node->data; | 774 | unsigned char *p = (char *)node->data; |
775 | unsigned char *end = (char *)(node->data + node->size); | 775 | unsigned char *end = (char *)(node->data + node->size); |
776 | 776 | ||
777 | p = pnpbios_parse_allocated_resource_data(p, end, &dev->res); | 777 | p = pnpbios_parse_allocated_resource_data(dev, p, end); |
778 | if (!p) | 778 | if (!p) |
779 | return -EIO; | 779 | return -EIO; |
780 | p = pnpbios_parse_resource_option_data(p, end, dev); | 780 | p = pnpbios_parse_resource_option_data(p, end, dev); |
@@ -786,25 +786,25 @@ int __init pnpbios_parse_data_stream(struct pnp_dev *dev, | |||
786 | return 0; | 786 | return 0; |
787 | } | 787 | } |
788 | 788 | ||
789 | int pnpbios_read_resources_from_node(struct pnp_resource_table *res, | 789 | int pnpbios_read_resources_from_node(struct pnp_dev *dev, |
790 | struct pnp_bios_node *node) | 790 | struct pnp_bios_node *node) |
791 | { | 791 | { |
792 | unsigned char *p = (char *)node->data; | 792 | unsigned char *p = (char *)node->data; |
793 | unsigned char *end = (char *)(node->data + node->size); | 793 | unsigned char *end = (char *)(node->data + node->size); |
794 | 794 | ||
795 | p = pnpbios_parse_allocated_resource_data(p, end, res); | 795 | p = pnpbios_parse_allocated_resource_data(dev, p, end); |
796 | if (!p) | 796 | if (!p) |
797 | return -EIO; | 797 | return -EIO; |
798 | return 0; | 798 | return 0; |
799 | } | 799 | } |
800 | 800 | ||
801 | int pnpbios_write_resources_to_node(struct pnp_resource_table *res, | 801 | int pnpbios_write_resources_to_node(struct pnp_dev *dev, |
802 | struct pnp_bios_node *node) | 802 | struct pnp_bios_node *node) |
803 | { | 803 | { |
804 | unsigned char *p = (char *)node->data; | 804 | unsigned char *p = (char *)node->data; |
805 | unsigned char *end = (char *)(node->data + node->size); | 805 | unsigned char *end = (char *)(node->data + node->size); |
806 | 806 | ||
807 | p = pnpbios_encode_allocated_resource_data(p, end, res); | 807 | p = pnpbios_encode_allocated_resource_data(dev, p, end); |
808 | if (!p) | 808 | if (!p) |
809 | return -EIO; | 809 | return -EIO; |
810 | return 0; | 810 | return 0; |