]> git.pld-linux.org Git - packages/kernel.git/blame - 2.6.x-pnp-lkml.patch
- obsolete
[packages/kernel.git] / 2.6.x-pnp-lkml.patch
CommitLineData
20e72cfa 1diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/drivers/pnp/card.c linux-2.6.2-rc3/drivers/pnp/card.c
2--- linux-2.6.2-rc3.org/drivers/pnp/card.c 2004-01-31 03:13:14.000000000 +0100
3+++ linux-2.6.2-rc3/drivers/pnp/card.c 2004-01-31 09:51:32.000000000 +0100
4@@ -26,8 +26,25 @@
5 {
6 const struct pnp_card_device_id * drv_id = drv->id_table;
7 while (*drv_id->id){
8- if (compare_pnp_id(card->id,drv_id->id))
9- return drv_id;
10+ if (compare_pnp_id(card->id,drv_id->id)) {
11+ int i = 0;
12+ for (;;) {
13+ int found;
14+ struct pnp_dev *dev;
15+ if (i == PNP_MAX_DEVICES || ! *drv_id->devs[i].id)
16+ return drv_id;
17+ found = 0;
18+ card_for_each_dev(card, dev) {
19+ if (compare_pnp_id(dev->id, drv_id->devs[i].id)) {
20+ found = 1;
21+ break;
22+ }
23+ }
24+ if (! found)
25+ break;
26+ i++;
27+ }
28+ }
29 drv_id++;
30 }
31 return NULL;
32@@ -122,6 +139,39 @@
33 kfree(card);
34 }
35
36+
37+static ssize_t pnp_show_card_name(struct device *dmdev, char *buf)
38+{
39+ char *str = buf;
40+ struct pnp_card *card = to_pnp_card(dmdev);
41+ str += sprintf(str,"%s\n", card->name);
42+ return (str - buf);
43+}
44+
45+static DEVICE_ATTR(name,S_IRUGO,pnp_show_card_name,NULL);
46+
47+static ssize_t pnp_show_card_ids(struct device *dmdev, char *buf)
48+{
49+ char *str = buf;
50+ struct pnp_card *card = to_pnp_card(dmdev);
51+ struct pnp_id * pos = card->id;
52+
53+ while (pos) {
54+ str += sprintf(str,"%s\n", pos->id);
55+ pos = pos->next;
56+ }
57+ return (str - buf);
58+}
59+
60+static DEVICE_ATTR(card_id,S_IRUGO,pnp_show_card_ids,NULL);
61+
62+static int pnp_interface_attach_card(struct pnp_card *card)
63+{
64+ device_create_file(&card->dev,&dev_attr_name);
65+ device_create_file(&card->dev,&dev_attr_card_id);
66+ return 0;
67+}
68+
69 /**
70 * pnp_add_card - adds a PnP card to the PnP Layer
71 * @card: pointer to the card to add
72@@ -141,6 +191,7 @@
73 error = device_register(&card->dev);
74
75 if (error == 0) {
76+ pnp_interface_attach_card(card);
77 spin_lock(&pnp_lock);
78 list_add_tail(&card->global_list, &pnp_cards);
79 list_add_tail(&card->protocol_list, &card->protocol->cards);
80diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/drivers/pnp/isapnp/core.c linux-2.6.2-rc3/drivers/pnp/isapnp/core.c
81--- linux-2.6.2-rc3.org/drivers/pnp/isapnp/core.c 2004-01-31 09:43:19.000000000 +0100
82+++ linux-2.6.2-rc3/drivers/pnp/isapnp/core.c 2004-01-31 09:51:25.000000000 +0100
83@@ -1037,17 +1037,17 @@
84
85 isapnp_cfg_begin(dev->card->number, dev->number);
86 dev->active = 1;
87- for (tmp = 0; tmp < PNP_MAX_PORT && res->port_resource[tmp].flags & IORESOURCE_IO; tmp++)
88+ for (tmp = 0; tmp < PNP_MAX_PORT && (res->port_resource[tmp].flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; tmp++)
89 isapnp_write_word(ISAPNP_CFG_PORT+(tmp<<1), res->port_resource[tmp].start);
90- for (tmp = 0; tmp < PNP_MAX_IRQ && res->irq_resource[tmp].flags & IORESOURCE_IRQ; tmp++) {
91+ for (tmp = 0; tmp < PNP_MAX_IRQ && (res->irq_resource[tmp].flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; tmp++) {
92 int irq = res->irq_resource[tmp].start;
93 if (irq == 2)
94 irq = 9;
95 isapnp_write_byte(ISAPNP_CFG_IRQ+(tmp<<1), irq);
96 }
97- for (tmp = 0; tmp < PNP_MAX_DMA && res->dma_resource[tmp].flags & IORESOURCE_DMA; tmp++)
98+ for (tmp = 0; tmp < PNP_MAX_DMA && (res->dma_resource[tmp].flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; tmp++)
99 isapnp_write_byte(ISAPNP_CFG_DMA+tmp, res->dma_resource[tmp].start);
100- for (tmp = 0; tmp < PNP_MAX_MEM && res->mem_resource[tmp].flags & IORESOURCE_MEM; tmp++)
101+ for (tmp = 0; tmp < PNP_MAX_MEM && (res->mem_resource[tmp].flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; tmp++)
102 isapnp_write_word(ISAPNP_CFG_MEM+(tmp<<2), (res->mem_resource[tmp].start >> 8) & 0xffff);
103 /* FIXME: We aren't handling 32bit mems properly here */
104 isapnp_activate(dev->number);
105diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/drivers/pnp/manager.c linux-2.6.2-rc3/drivers/pnp/manager.c
106--- linux-2.6.2-rc3.org/drivers/pnp/manager.c 2004-01-31 03:13:23.000000000 +0100
107+++ linux-2.6.2-rc3/drivers/pnp/manager.c 2004-01-31 09:51:25.000000000 +0100
108@@ -223,25 +223,25 @@
109 table->irq_resource[idx].name = NULL;
110 table->irq_resource[idx].start = -1;
111 table->irq_resource[idx].end = -1;
112- table->irq_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
113+ table->irq_resource[idx].flags = IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET;
114 }
115 for (idx = 0; idx < PNP_MAX_DMA; idx++) {
116 table->dma_resource[idx].name = NULL;
117 table->dma_resource[idx].start = -1;
118 table->dma_resource[idx].end = -1;
119- table->dma_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
120+ table->dma_resource[idx].flags = IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET;
121 }
122 for (idx = 0; idx < PNP_MAX_PORT; idx++) {
123 table->port_resource[idx].name = NULL;
124 table->port_resource[idx].start = 0;
125 table->port_resource[idx].end = 0;
126- table->port_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
127+ table->port_resource[idx].flags = IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET;
128 }
129 for (idx = 0; idx < PNP_MAX_MEM; idx++) {
130 table->mem_resource[idx].name = NULL;
131 table->mem_resource[idx].start = 0;
132 table->mem_resource[idx].end = 0;
133- table->mem_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
134+ table->mem_resource[idx].flags = IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET;
135 }
136 }
137
138@@ -258,28 +258,28 @@
139 continue;
140 res->irq_resource[idx].start = -1;
141 res->irq_resource[idx].end = -1;
142- res->irq_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
143+ res->irq_resource[idx].flags = IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET;
144 }
145 for (idx = 0; idx < PNP_MAX_DMA; idx++) {
146 if (!(res->dma_resource[idx].flags & IORESOURCE_AUTO))
147 continue;
148 res->dma_resource[idx].start = -1;
149 res->dma_resource[idx].end = -1;
150- res->dma_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
151+ res->dma_resource[idx].flags = IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET;
152 }
153 for (idx = 0; idx < PNP_MAX_PORT; idx++) {
154 if (!(res->port_resource[idx].flags & IORESOURCE_AUTO))
155 continue;
156 res->port_resource[idx].start = 0;
157 res->port_resource[idx].end = 0;
158- res->port_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
159+ res->port_resource[idx].flags = IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET;
160 }
161 for (idx = 0; idx < PNP_MAX_MEM; idx++) {
162 if (!(res->mem_resource[idx].flags & IORESOURCE_AUTO))
163 continue;
164 res->mem_resource[idx].start = 0;
165 res->mem_resource[idx].end = 0;
166- res->mem_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
167+ res->mem_resource[idx].flags = IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET;
168 }
169 }
170
171@@ -550,7 +550,7 @@
172 {
173 if (resource == NULL)
174 return;
175- resource->flags &= ~IORESOURCE_AUTO;
176+ resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET);
177 resource->start = start;
178 resource->end = start + size - 1;
179 }
180diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/drivers/pnp/pnpbios/core.c linux-2.6.2-rc3/drivers/pnp/pnpbios/core.c
181--- linux-2.6.2-rc3.org/drivers/pnp/pnpbios/core.c 2004-01-31 03:11:05.000000000 +0100
182+++ linux-2.6.2-rc3/drivers/pnp/pnpbios/core.c 2004-01-31 09:51:27.000000000 +0100
183@@ -251,7 +251,7 @@
184 node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL);
185 if (!node)
186 return -1;
187- if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_STATIC, node))
188+ if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node))
189 return -ENODEV;
190 if(pnpbios_write_resources_to_node(res, node)<0) {
191 kfree(node);
192@@ -264,19 +264,49 @@
193 return ret;
194 }
195
196+static void pnpbios_zero_data_stream(struct pnp_bios_node * node)
197+{
198+ unsigned char * p = (char *)node->data;
199+ unsigned char * end = (char *)(node->data + node->size);
200+ unsigned int len;
201+ int i;
202+ while ((char *)p < (char *)end) {
203+ if(p[0] & 0x80) { /* large tag */
204+ len = (p[2] << 8) | p[1];
205+ p += 3;
206+ } else {
207+ if (((p[0]>>3) & 0x0f) == 0x0f)
208+ return;
209+ len = p[0] & 0x07;
210+ p += 1;
211+ }
212+ for (i = 0; i < len; i++)
213+ p[i] = 0;
214+ p += len;
215+ }
216+ printk(KERN_ERR "PnPBIOS: Resource structure did not contain an end tag.\n");
217+}
218+
219 static int pnpbios_disable_resources(struct pnp_dev *dev)
220 {
221 struct pnp_bios_node * node;
222+ u8 nodenum = dev->number;
223 int ret;
224
225 /* just in case */
226 if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev))
227 return -EPERM;
228
229- /* the value of this will be zero */
230 node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL);
231 if (!node)
232 return -ENOMEM;
233+
234+ if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) {
235+ kfree(node);
236+ return -ENODEV;
237+ }
238+ pnpbios_zero_data_stream(node);
239+
240 ret = pnp_bios_set_dev_node(dev->number, (char)PNPMODE_DYNAMIC, node);
241 kfree(node);
242 if (ret > 0)
243diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/drivers/pnp/pnpbios/rsparser.c linux-2.6.2-rc3/drivers/pnp/pnpbios/rsparser.c
244--- linux-2.6.2-rc3.org/drivers/pnp/pnpbios/rsparser.c 2004-01-31 03:11:54.000000000 +0100
245+++ linux-2.6.2-rc3/drivers/pnp/pnpbios/rsparser.c 2004-01-31 09:51:25.000000000 +0100
246@@ -49,7 +49,7 @@
247 pnpbios_parse_allocated_irqresource(struct pnp_resource_table * res, int irq)
248 {
249 int i = 0;
250- while ((res->irq_resource[i].flags & IORESOURCE_IRQ) && i < PNP_MAX_IRQ) i++;
251+ while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_IRQ) i++;
252 if (i < PNP_MAX_IRQ) {
253 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
254 if (irq == -1) {
255@@ -65,7 +65,7 @@
256 pnpbios_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
257 {
258 int i = 0;
259- while ((res->dma_resource[i].flags & IORESOURCE_DMA) && i < PNP_MAX_DMA) i++;
260+ while (!(res->dma_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_DMA) i++;
261 if (i < PNP_MAX_DMA) {
262 res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag
263 if (dma == -1) {
264@@ -81,7 +81,7 @@
265 pnpbios_parse_allocated_ioresource(struct pnp_resource_table * res, int io, int len)
266 {
267 int i = 0;
268- while ((res->port_resource[i].flags & IORESOURCE_IO) && i < PNP_MAX_PORT) i++;
269+ while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_PORT) i++;
270 if (i < PNP_MAX_PORT) {
271 res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag
272 if (len <= 0 || (io + len -1) >= 0x10003) {
273@@ -97,7 +97,7 @@
274 pnpbios_parse_allocated_memresource(struct pnp_resource_table * res, int mem, int len)
275 {
276 int i = 0;
277- while ((res->mem_resource[i].flags & IORESOURCE_MEM) && i < PNP_MAX_MEM) i++;
278+ while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_MEM) i++;
279 if (i < PNP_MAX_MEM) {
280 res->mem_resource[i].flags = IORESOURCE_MEM; // Also clears _UNSET flag
281 if (len <= 0) {
282diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/drivers/pnp/resource.c linux-2.6.2-rc3/drivers/pnp/resource.c
283--- linux-2.6.2-rc3.org/drivers/pnp/resource.c 2004-01-31 03:12:30.000000000 +0100
284+++ linux-2.6.2-rc3/drivers/pnp/resource.c 2004-01-31 09:51:25.000000000 +0100
285@@ -241,6 +241,9 @@
286 (*(enda) >= *(startb) && *(enda) <= *(endb)) || \
287 (*(starta) < *(startb) && *(enda) > *(endb)))
288
289+#define cannot_compare(flags) \
290+((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED))
291+
292 int pnp_check_port(struct pnp_dev * dev, int idx)
293 {
294 int tmp;
295@@ -250,7 +253,7 @@
296 end = &dev->res.port_resource[idx].end;
297
298 /* if the resource doesn't exist, don't complain about it */
299- if (dev->res.port_resource[idx].flags & IORESOURCE_UNSET)
300+ if (cannot_compare(dev->res.port_resource[idx].flags))
301 return 1;
302
303 /* check if the resource is already in use, skip if the
304@@ -284,7 +287,7 @@
305 continue;
306 for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) {
307 if (tdev->res.port_resource[tmp].flags & IORESOURCE_IO) {
308- if (pnp_port_flags(dev, tmp) & IORESOURCE_DISABLED)
309+ if (cannot_compare(tdev->res.port_resource[tmp].flags))
310 continue;
311 tport = &tdev->res.port_resource[tmp].start;
312 tend = &tdev->res.port_resource[tmp].end;
313@@ -306,7 +309,7 @@
314 end = &dev->res.mem_resource[idx].end;
315
316 /* if the resource doesn't exist, don't complain about it */
317- if (dev->res.mem_resource[idx].flags & IORESOURCE_UNSET)
318+ if (cannot_compare(dev->res.mem_resource[idx].flags))
319 return 1;
320
321 /* check if the resource is already in use, skip if the
322@@ -340,7 +343,7 @@
323 continue;
324 for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) {
325 if (tdev->res.mem_resource[tmp].flags & IORESOURCE_MEM) {
326- if (pnp_mem_flags(dev, tmp) & IORESOURCE_DISABLED)
327+ if (cannot_compare(tdev->res.mem_resource[tmp].flags))
328 continue;
329 taddr = &tdev->res.mem_resource[tmp].start;
330 tend = &tdev->res.mem_resource[tmp].end;
331@@ -365,7 +368,7 @@
332 unsigned long * irq = &dev->res.irq_resource[idx].start;
333
334 /* if the resource doesn't exist, don't complain about it */
335- if (dev->res.irq_resource[idx].flags & IORESOURCE_UNSET)
336+ if (cannot_compare(dev->res.irq_resource[idx].flags))
337 return 1;
338
339 /* check if the resource is valid */
340@@ -411,7 +414,7 @@
341 continue;
342 for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) {
343 if (tdev->res.irq_resource[tmp].flags & IORESOURCE_IRQ) {
344- if (pnp_irq_flags(dev, tmp) & IORESOURCE_DISABLED)
345+ if (cannot_compare(tdev->res.irq_resource[tmp].flags))
346 continue;
347 if ((tdev->res.irq_resource[tmp].start == *irq))
348 return 0;
349@@ -429,7 +432,7 @@
350 unsigned long * dma = &dev->res.dma_resource[idx].start;
351
352 /* if the resource doesn't exist, don't complain about it */
353- if (dev->res.dma_resource[idx].flags & IORESOURCE_UNSET)
354+ if (cannot_compare(dev->res.dma_resource[idx].flags))
355 return 1;
356
357 /* check if the resource is valid */
358@@ -464,7 +467,7 @@
359 continue;
360 for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) {
361 if (tdev->res.dma_resource[tmp].flags & IORESOURCE_DMA) {
362- if (pnp_dma_flags(dev, tmp) & IORESOURCE_DISABLED)
363+ if (cannot_compare(tdev->res.dma_resource[tmp].flags))
364 continue;
365 if ((tdev->res.dma_resource[tmp].start == *dma))
366 return 0;
367diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/drivers/serial/8250_pnp.c linux-2.6.2-rc3/drivers/serial/8250_pnp.c
368--- linux-2.6.2-rc3.org/drivers/serial/8250_pnp.c 2004-01-31 03:11:05.000000000 +0100
369+++ linux-2.6.2-rc3/drivers/serial/8250_pnp.c 2004-01-31 09:51:23.000000000 +0100
370@@ -420,7 +420,9 @@
371
372 static void serial_pnp_remove(struct pnp_dev * dev)
373 {
374- return;
375+ int line = (int)pnp_get_drvdata(dev);
376+ if (line)
377+ unregister_serial(line - 1);
378 }
379
380 static struct pnp_driver serial_pnp_driver = {
381@@ -437,7 +439,7 @@
382
383 static void __exit serial8250_pnp_exit(void)
384 {
385- /* FIXME */
386+ pnp_unregister_driver(&serial_pnp_driver);
387 }
388
389 module_init(serial8250_pnp_init);
390diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/include/linux/mod_devicetable.h linux-2.6.2-rc3/include/linux/mod_devicetable.h
391--- linux-2.6.2-rc3.org/include/linux/mod_devicetable.h 2004-01-31 03:13:26.000000000 +0100
392+++ linux-2.6.2-rc3/include/linux/mod_devicetable.h 2004-01-31 09:51:31.000000000 +0100
393@@ -148,4 +148,21 @@
394 #define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
395
396
397+#define PNP_ID_LEN 8
398+#define PNP_MAX_DEVICES 8
399+
400+struct pnp_device_id {
401+ __u8 id[PNP_ID_LEN];
402+ kernel_ulong_t driver_data;
403+};
404+
405+struct pnp_card_device_id {
406+ __u8 id[PNP_ID_LEN];
407+ kernel_ulong_t driver_data;
408+ struct {
409+ __u8 id[PNP_ID_LEN];
410+ } devs[PNP_MAX_DEVICES];
411+};
412+
413+
414 #endif /* LINUX_MOD_DEVICETABLE_H */
415diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/include/linux/pnp.h linux-2.6.2-rc3/include/linux/pnp.h
416--- linux-2.6.2-rc3.org/include/linux/pnp.h 2004-01-31 03:13:27.000000000 +0100
417+++ linux-2.6.2-rc3/include/linux/pnp.h 2004-01-31 09:51:31.000000000 +0100
418@@ -12,13 +12,12 @@
419 #include <linux/device.h>
420 #include <linux/list.h>
421 #include <linux/errno.h>
422+#include <linux/mod_devicetable.h>
423
424 #define PNP_MAX_PORT 8
425 #define PNP_MAX_MEM 4
426 #define PNP_MAX_IRQ 2
427 #define PNP_MAX_DMA 2
428-#define PNP_MAX_DEVICES 8
429-#define PNP_ID_LEN 8
430 #define PNP_NAME_LEN 50
431
432 struct pnp_protocol;
433@@ -33,7 +32,9 @@
434 #define pnp_port_start(dev,bar) ((dev)->res.port_resource[(bar)].start)
435 #define pnp_port_end(dev,bar) ((dev)->res.port_resource[(bar)].end)
436 #define pnp_port_flags(dev,bar) ((dev)->res.port_resource[(bar)].flags)
437-#define pnp_port_valid(dev,bar) (pnp_port_flags((dev),(bar)) & IORESOURCE_IO)
438+#define pnp_port_valid(dev,bar) \
439+ ((pnp_port_flags((dev),(bar)) & (IORESOURCE_IO | IORESOURCE_UNSET)) \
440+ == IORESOURCE_IO)
441 #define pnp_port_len(dev,bar) \
442 ((pnp_port_start((dev),(bar)) == 0 && \
443 pnp_port_end((dev),(bar)) == \
444@@ -45,7 +46,9 @@
445 #define pnp_mem_start(dev,bar) ((dev)->res.mem_resource[(bar)].start)
446 #define pnp_mem_end(dev,bar) ((dev)->res.mem_resource[(bar)].end)
447 #define pnp_mem_flags(dev,bar) ((dev)->res.mem_resource[(bar)].flags)
448-#define pnp_mem_valid(dev,bar) (pnp_mem_flags((dev),(bar)) & IORESOURCE_MEM)
449+#define pnp_mem_valid(dev,bar) \
450+ ((pnp_mem_flags((dev),(bar)) & (IORESOURCE_MEM | IORESOURCE_UNSET)) \
451+ == IORESOURCE_MEM)
452 #define pnp_mem_len(dev,bar) \
453 ((pnp_mem_start((dev),(bar)) == 0 && \
454 pnp_mem_end((dev),(bar)) == \
455@@ -56,11 +59,15 @@
456
457 #define pnp_irq(dev,bar) ((dev)->res.irq_resource[(bar)].start)
458 #define pnp_irq_flags(dev,bar) ((dev)->res.irq_resource[(bar)].flags)
459-#define pnp_irq_valid(dev,bar) (pnp_irq_flags((dev),(bar)) & IORESOURCE_IRQ)
460+#define pnp_irq_valid(dev,bar) \
461+ ((pnp_irq_flags((dev),(bar)) & (IORESOURCE_IRQ | IORESOURCE_UNSET)) \
462+ == IORESOURCE_IRQ)
463
464 #define pnp_dma(dev,bar) ((dev)->res.dma_resource[(bar)].start)
465 #define pnp_dma_flags(dev,bar) ((dev)->res.dma_resource[(bar)].flags)
466-#define pnp_dma_valid(dev,bar) (pnp_dma_flags((dev),(bar)) & IORESOURCE_DMA)
467+#define pnp_dma_valid(dev,bar) \
468+ ((pnp_dma_flags((dev),(bar)) & (IORESOURCE_DMA | IORESOURCE_UNSET)) \
469+ == IORESOURCE_DMA)
470
471 #define PNP_PORT_FLAG_16BITADDR (1<<0)
472 #define PNP_PORT_FLAG_FIXED (1<<1)
473@@ -279,19 +286,6 @@
474 struct pnp_id * next;
475 };
476
477-struct pnp_device_id {
478- char id[PNP_ID_LEN];
479- unsigned long driver_data; /* data private to the driver */
480-};
481-
482-struct pnp_card_device_id {
483- char id[PNP_ID_LEN];
484- unsigned long driver_data; /* data private to the driver */
485- struct {
486- char id[PNP_ID_LEN];
487- } devs[PNP_MAX_DEVICES]; /* logical devices */
488-};
489-
490 struct pnp_driver {
491 char * name;
492 const struct pnp_device_id *id_table;
493diff -Nur --exclude '*.orig' linux-2.6.2-rc3.org/scripts/file2alias.c linux-2.6.2-rc3/scripts/file2alias.c
494--- linux-2.6.2-rc3.org/scripts/file2alias.c 2004-01-31 03:11:58.000000000 +0100
495+++ linux-2.6.2-rc3/scripts/file2alias.c 2004-01-31 09:51:29.000000000 +0100
496@@ -176,6 +176,29 @@
497 return 1;
498 }
499
500+/* looks like: "pnp:dD" */
501+static int do_pnp_entry(const char *filename,
502+ struct pnp_device_id *id, char *alias)
503+{
504+ sprintf(alias, "pnp:d%s", id->id);
505+ return 1;
506+}
507+
508+/* looks like: "pnp:cCdD..." */
509+static int do_pnp_card_entry(const char *filename,
510+ struct pnp_card_device_id *id, char *alias)
511+{
512+ int i;
513+
514+ sprintf(alias, "pnp:c%s", id->id);
515+ for (i = 0; i < PNP_MAX_DEVICES; i++) {
516+ if (! *id->devs[i].id)
517+ break;
518+ sprintf(alias + strlen(alias), "d%s", id->devs[i].id);
519+ }
520+ return 1;
521+}
522+
523 /* Ignore any prefix, eg. v850 prepends _ */
524 static inline int sym_is(const char *symbol, const char *name)
525 {
526@@ -242,6 +265,12 @@
527 else if (sym_is(symname, "__mod_ccw_device_table"))
528 do_table(symval, sym->st_size, sizeof(struct ccw_device_id),
529 do_ccw_entry, mod);
530+ else if (sym_is(symname, "__mod_pnp_device_table"))
531+ do_table(symval, sym->st_size, sizeof(struct pnp_device_id),
532+ do_pnp_entry, mod);
533+ else if (sym_is(symname, "__mod_pnp_card_device_table"))
534+ do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id),
535+ do_pnp_card_entry, mod);
536 }
537
538 /* Now add out buffered information to the generated C source */
This page took 0.620948 seconds and 4 git commands to generate.