diff options
Diffstat (limited to 'drivers/acpi/pci_irq.c')
-rw-r--r-- | drivers/acpi/pci_irq.c | 71 |
1 files changed, 31 insertions, 40 deletions
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index f24a610008a0..fb96e3bf969b 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -55,10 +55,9 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, | |||
55 | struct list_head *node = NULL; | 55 | struct list_head *node = NULL; |
56 | struct acpi_prt_entry *entry = NULL; | 56 | struct acpi_prt_entry *entry = NULL; |
57 | 57 | ||
58 | ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry"); | ||
59 | 58 | ||
60 | if (!acpi_prt.count) | 59 | if (!acpi_prt.count) |
61 | return_PTR(NULL); | 60 | return NULL; |
62 | 61 | ||
63 | /* | 62 | /* |
64 | * Parse through all PRT entries looking for a match on the specified | 63 | * Parse through all PRT entries looking for a match on the specified |
@@ -73,12 +72,12 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, | |||
73 | && (device == entry->id.device) | 72 | && (device == entry->id.device) |
74 | && (pin == entry->pin)) { | 73 | && (pin == entry->pin)) { |
75 | spin_unlock(&acpi_prt_lock); | 74 | spin_unlock(&acpi_prt_lock); |
76 | return_PTR(entry); | 75 | return entry; |
77 | } | 76 | } |
78 | } | 77 | } |
79 | 78 | ||
80 | spin_unlock(&acpi_prt_lock); | 79 | spin_unlock(&acpi_prt_lock); |
81 | return_PTR(NULL); | 80 | return NULL; |
82 | } | 81 | } |
83 | 82 | ||
84 | static int | 83 | static int |
@@ -87,14 +86,13 @@ acpi_pci_irq_add_entry(acpi_handle handle, | |||
87 | { | 86 | { |
88 | struct acpi_prt_entry *entry = NULL; | 87 | struct acpi_prt_entry *entry = NULL; |
89 | 88 | ||
90 | ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry"); | ||
91 | 89 | ||
92 | if (!prt) | 90 | if (!prt) |
93 | return_VALUE(-EINVAL); | 91 | return -EINVAL; |
94 | 92 | ||
95 | entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); | 93 | entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); |
96 | if (!entry) | 94 | if (!entry) |
97 | return_VALUE(-ENOMEM); | 95 | return -ENOMEM; |
98 | memset(entry, 0, sizeof(struct acpi_prt_entry)); | 96 | memset(entry, 0, sizeof(struct acpi_prt_entry)); |
99 | 97 | ||
100 | entry->id.segment = segment; | 98 | entry->id.segment = segment; |
@@ -141,7 +139,7 @@ acpi_pci_irq_add_entry(acpi_handle handle, | |||
141 | acpi_prt.count++; | 139 | acpi_prt.count++; |
142 | spin_unlock(&acpi_prt_lock); | 140 | spin_unlock(&acpi_prt_lock); |
143 | 141 | ||
144 | return_VALUE(0); | 142 | return 0; |
145 | } | 143 | } |
146 | 144 | ||
147 | static void | 145 | static void |
@@ -163,11 +161,10 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) | |||
163 | struct acpi_pci_routing_table *entry = NULL; | 161 | struct acpi_pci_routing_table *entry = NULL; |
164 | static int first_time = 1; | 162 | static int first_time = 1; |
165 | 163 | ||
166 | ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt"); | ||
167 | 164 | ||
168 | pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); | 165 | pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); |
169 | if (!pathname) | 166 | if (!pathname) |
170 | return_VALUE(-ENOMEM); | 167 | return -ENOMEM; |
171 | memset(pathname, 0, ACPI_PATHNAME_MAX); | 168 | memset(pathname, 0, ACPI_PATHNAME_MAX); |
172 | 169 | ||
173 | if (first_time) { | 170 | if (first_time) { |
@@ -199,12 +196,12 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) | |||
199 | if (status != AE_BUFFER_OVERFLOW) { | 196 | if (status != AE_BUFFER_OVERFLOW) { |
200 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", | 197 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", |
201 | acpi_format_exception(status))); | 198 | acpi_format_exception(status))); |
202 | return_VALUE(-ENODEV); | 199 | return -ENODEV; |
203 | } | 200 | } |
204 | 201 | ||
205 | prt = kmalloc(buffer.length, GFP_KERNEL); | 202 | prt = kmalloc(buffer.length, GFP_KERNEL); |
206 | if (!prt) { | 203 | if (!prt) { |
207 | return_VALUE(-ENOMEM); | 204 | return -ENOMEM; |
208 | } | 205 | } |
209 | memset(prt, 0, buffer.length); | 206 | memset(prt, 0, buffer.length); |
210 | buffer.pointer = prt; | 207 | buffer.pointer = prt; |
@@ -214,7 +211,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) | |||
214 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", | 211 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", |
215 | acpi_format_exception(status))); | 212 | acpi_format_exception(status))); |
216 | kfree(buffer.pointer); | 213 | kfree(buffer.pointer); |
217 | return_VALUE(-ENODEV); | 214 | return -ENODEV; |
218 | } | 215 | } |
219 | 216 | ||
220 | entry = prt; | 217 | entry = prt; |
@@ -227,7 +224,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) | |||
227 | 224 | ||
228 | kfree(prt); | 225 | kfree(prt); |
229 | 226 | ||
230 | return_VALUE(0); | 227 | return 0; |
231 | } | 228 | } |
232 | 229 | ||
233 | void acpi_pci_irq_del_prt(int segment, int bus) | 230 | void acpi_pci_irq_del_prt(int segment, int bus) |
@@ -262,7 +259,6 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | |||
262 | { | 259 | { |
263 | int irq; | 260 | int irq; |
264 | 261 | ||
265 | ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq"); | ||
266 | 262 | ||
267 | if (entry->link.handle) { | 263 | if (entry->link.handle) { |
268 | irq = acpi_pci_link_allocate_irq(entry->link.handle, | 264 | irq = acpi_pci_link_allocate_irq(entry->link.handle, |
@@ -271,7 +267,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | |||
271 | if (irq < 0) { | 267 | if (irq < 0) { |
272 | printk(KERN_WARNING PREFIX | 268 | printk(KERN_WARNING PREFIX |
273 | "Invalid IRQ link routing entry\n"); | 269 | "Invalid IRQ link routing entry\n"); |
274 | return_VALUE(-1); | 270 | return -1; |
275 | } | 271 | } |
276 | } else { | 272 | } else { |
277 | irq = entry->link.index; | 273 | irq = entry->link.index; |
@@ -280,7 +276,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | |||
280 | } | 276 | } |
281 | 277 | ||
282 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); | 278 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); |
283 | return_VALUE(irq); | 279 | return irq; |
284 | } | 280 | } |
285 | 281 | ||
286 | static int | 282 | static int |
@@ -289,13 +285,12 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry, | |||
289 | { | 285 | { |
290 | int irq; | 286 | int irq; |
291 | 287 | ||
292 | ACPI_FUNCTION_TRACE("acpi_pci_free_irq"); | ||
293 | if (entry->link.handle) { | 288 | if (entry->link.handle) { |
294 | irq = acpi_pci_link_free_irq(entry->link.handle); | 289 | irq = acpi_pci_link_free_irq(entry->link.handle); |
295 | } else { | 290 | } else { |
296 | irq = entry->link.index; | 291 | irq = entry->link.index; |
297 | } | 292 | } |
298 | return_VALUE(irq); | 293 | return irq; |
299 | } | 294 | } |
300 | 295 | ||
301 | /* | 296 | /* |
@@ -315,7 +310,6 @@ acpi_pci_irq_lookup(struct pci_bus *bus, | |||
315 | int bus_nr = bus->number; | 310 | int bus_nr = bus->number; |
316 | int ret; | 311 | int ret; |
317 | 312 | ||
318 | ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); | ||
319 | 313 | ||
320 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 314 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
321 | "Searching for PRT entry for %02x:%02x:%02x[%c]\n", | 315 | "Searching for PRT entry for %02x:%02x:%02x[%c]\n", |
@@ -324,11 +318,11 @@ acpi_pci_irq_lookup(struct pci_bus *bus, | |||
324 | entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); | 318 | entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); |
325 | if (!entry) { | 319 | if (!entry) { |
326 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); | 320 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); |
327 | return_VALUE(-1); | 321 | return -1; |
328 | } | 322 | } |
329 | 323 | ||
330 | ret = func(entry, triggering, polarity, link); | 324 | ret = func(entry, triggering, polarity, link); |
331 | return_VALUE(ret); | 325 | return ret; |
332 | } | 326 | } |
333 | 327 | ||
334 | /* | 328 | /* |
@@ -346,10 +340,9 @@ acpi_pci_irq_derive(struct pci_dev *dev, | |||
346 | int irq = -1; | 340 | int irq = -1; |
347 | u8 bridge_pin = 0; | 341 | u8 bridge_pin = 0; |
348 | 342 | ||
349 | ACPI_FUNCTION_TRACE("acpi_pci_irq_derive"); | ||
350 | 343 | ||
351 | if (!dev) | 344 | if (!dev) |
352 | return_VALUE(-EINVAL); | 345 | return -EINVAL; |
353 | 346 | ||
354 | /* | 347 | /* |
355 | * Attempt to derive an IRQ for this device from a parent bridge's | 348 | * Attempt to derive an IRQ for this device from a parent bridge's |
@@ -366,7 +359,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, | |||
366 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 359 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
367 | "No interrupt pin configured for device %s\n", | 360 | "No interrupt pin configured for device %s\n", |
368 | pci_name(bridge))); | 361 | pci_name(bridge))); |
369 | return_VALUE(-1); | 362 | return -1; |
370 | } | 363 | } |
371 | /* Pin is from 0 to 3 */ | 364 | /* Pin is from 0 to 3 */ |
372 | bridge_pin--; | 365 | bridge_pin--; |
@@ -381,13 +374,13 @@ acpi_pci_irq_derive(struct pci_dev *dev, | |||
381 | if (irq < 0) { | 374 | if (irq < 0) { |
382 | printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n", | 375 | printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n", |
383 | pci_name(dev)); | 376 | pci_name(dev)); |
384 | return_VALUE(-1); | 377 | return -1; |
385 | } | 378 | } |
386 | 379 | ||
387 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n", | 380 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n", |
388 | irq, pci_name(dev), pci_name(bridge))); | 381 | irq, pci_name(dev), pci_name(bridge))); |
389 | 382 | ||
390 | return_VALUE(irq); | 383 | return irq; |
391 | } | 384 | } |
392 | 385 | ||
393 | /* | 386 | /* |
@@ -405,23 +398,22 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
405 | char *link = NULL; | 398 | char *link = NULL; |
406 | int rc; | 399 | int rc; |
407 | 400 | ||
408 | ACPI_FUNCTION_TRACE("acpi_pci_irq_enable"); | ||
409 | 401 | ||
410 | if (!dev) | 402 | if (!dev) |
411 | return_VALUE(-EINVAL); | 403 | return -EINVAL; |
412 | 404 | ||
413 | pin = dev->pin; | 405 | pin = dev->pin; |
414 | if (!pin) { | 406 | if (!pin) { |
415 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 407 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
416 | "No interrupt pin configured for device %s\n", | 408 | "No interrupt pin configured for device %s\n", |
417 | pci_name(dev))); | 409 | pci_name(dev))); |
418 | return_VALUE(0); | 410 | return 0; |
419 | } | 411 | } |
420 | pin--; | 412 | pin--; |
421 | 413 | ||
422 | if (!dev->bus) { | 414 | if (!dev->bus) { |
423 | printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n"); | 415 | printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n"); |
424 | return_VALUE(-ENODEV); | 416 | return -ENODEV; |
425 | } | 417 | } |
426 | 418 | ||
427 | /* | 419 | /* |
@@ -453,10 +445,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
453 | printk(" - using IRQ %d\n", dev->irq); | 445 | printk(" - using IRQ %d\n", dev->irq); |
454 | acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, | 446 | acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, |
455 | ACPI_ACTIVE_LOW); | 447 | ACPI_ACTIVE_LOW); |
456 | return_VALUE(0); | 448 | return 0; |
457 | } else { | 449 | } else { |
458 | printk("\n"); | 450 | printk("\n"); |
459 | return_VALUE(0); | 451 | return 0; |
460 | } | 452 | } |
461 | } | 453 | } |
462 | 454 | ||
@@ -464,7 +456,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
464 | if (rc < 0) { | 456 | if (rc < 0) { |
465 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " | 457 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " |
466 | "to register GSI\n", pci_name(dev), ('A' + pin)); | 458 | "to register GSI\n", pci_name(dev), ('A' + pin)); |
467 | return_VALUE(rc); | 459 | return rc; |
468 | } | 460 | } |
469 | dev->irq = rc; | 461 | dev->irq = rc; |
470 | 462 | ||
@@ -478,7 +470,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
478 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", | 470 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", |
479 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); | 471 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); |
480 | 472 | ||
481 | return_VALUE(0); | 473 | return 0; |
482 | } | 474 | } |
483 | 475 | ||
484 | EXPORT_SYMBOL(acpi_pci_irq_enable); | 476 | EXPORT_SYMBOL(acpi_pci_irq_enable); |
@@ -495,14 +487,13 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
495 | int triggering = ACPI_LEVEL_SENSITIVE; | 487 | int triggering = ACPI_LEVEL_SENSITIVE; |
496 | int polarity = ACPI_ACTIVE_LOW; | 488 | int polarity = ACPI_ACTIVE_LOW; |
497 | 489 | ||
498 | ACPI_FUNCTION_TRACE("acpi_pci_irq_disable"); | ||
499 | 490 | ||
500 | if (!dev || !dev->bus) | 491 | if (!dev || !dev->bus) |
501 | return_VOID; | 492 | return; |
502 | 493 | ||
503 | pin = dev->pin; | 494 | pin = dev->pin; |
504 | if (!pin) | 495 | if (!pin) |
505 | return_VOID; | 496 | return; |
506 | pin--; | 497 | pin--; |
507 | 498 | ||
508 | /* | 499 | /* |
@@ -520,7 +511,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
520 | &triggering, &polarity, NULL, | 511 | &triggering, &polarity, NULL, |
521 | acpi_pci_free_irq); | 512 | acpi_pci_free_irq); |
522 | if (gsi < 0) | 513 | if (gsi < 0) |
523 | return_VOID; | 514 | return; |
524 | 515 | ||
525 | /* | 516 | /* |
526 | * TBD: It might be worth clearing dev->irq by magic constant | 517 | * TBD: It might be worth clearing dev->irq by magic constant |
@@ -532,5 +523,5 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
532 | 523 | ||
533 | acpi_unregister_gsi(gsi); | 524 | acpi_unregister_gsi(gsi); |
534 | 525 | ||
535 | return_VOID; | 526 | return; |
536 | } | 527 | } |