aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi
diff options
context:
space:
mode:
authorWitold Szczeponik <Witold.Szczeponik@gmx.net>2011-10-27 14:56:47 -0400
committerLen Brown <len.brown@intel.com>2011-11-06 20:13:55 -0500
commit18fd470a48396c8795ba7256c5973e92ffa25cb3 (patch)
tree68cb3b94c29a75039040d83531b132b6cfdbcdf4 /drivers/pnp/pnpacpi
parentc3b92c8787367a8bb53d57d9789b558f1295cc96 (diff)
PNPACPI: Simplify disabled resource registration
The attached patch simplifies 29df8d8f8702f0f53c1375015f09f04bc8d023c1. As the "pnp_xxx" structs are not designed to cope with IORESOURCE_DISABLED, and hence no code can test for this value, setting this value is actually a "no op" and can be skipped altogether. It is sufficient to remove the checks for "empty" resources and continue processing. The patch is applied against 3.1. Signed-off-by: Witold Szczeponik <Witold.Szczeponik@gmx.net> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c62
1 files changed, 15 insertions, 47 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index bbf3edd85beb..5be4a392a3ae 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -509,15 +509,12 @@ static __init void pnpacpi_parse_dma_option(struct pnp_dev *dev,
509 struct acpi_resource_dma *p) 509 struct acpi_resource_dma *p)
510{ 510{
511 int i; 511 int i;
512 unsigned char map = 0, flags = 0; 512 unsigned char map = 0, flags;
513
514 if (p->channel_count == 0)
515 flags |= IORESOURCE_DISABLED;
516 513
517 for (i = 0; i < p->channel_count; i++) 514 for (i = 0; i < p->channel_count; i++)
518 map |= 1 << p->channels[i]; 515 map |= 1 << p->channels[i];
519 516
520 flags |= dma_flags(dev, p->type, p->bus_master, p->transfer); 517 flags = dma_flags(dev, p->type, p->bus_master, p->transfer);
521 pnp_register_dma_resource(dev, option_flags, map, flags); 518 pnp_register_dma_resource(dev, option_flags, map, flags);
522} 519}
523 520
@@ -527,17 +524,14 @@ static __init void pnpacpi_parse_irq_option(struct pnp_dev *dev,
527{ 524{
528 int i; 525 int i;
529 pnp_irq_mask_t map; 526 pnp_irq_mask_t map;
530 unsigned char flags = 0; 527 unsigned char flags;
531
532 if (p->interrupt_count == 0)
533 flags |= IORESOURCE_DISABLED;
534 528
535 bitmap_zero(map.bits, PNP_IRQ_NR); 529 bitmap_zero(map.bits, PNP_IRQ_NR);
536 for (i = 0; i < p->interrupt_count; i++) 530 for (i = 0; i < p->interrupt_count; i++)
537 if (p->interrupts[i]) 531 if (p->interrupts[i])
538 __set_bit(p->interrupts[i], map.bits); 532 __set_bit(p->interrupts[i], map.bits);
539 533
540 flags |= irq_flags(p->triggering, p->polarity, p->sharable); 534 flags = irq_flags(p->triggering, p->polarity, p->sharable);
541 pnp_register_irq_resource(dev, option_flags, &map, flags); 535 pnp_register_irq_resource(dev, option_flags, &map, flags);
542} 536}
543 537
@@ -547,10 +541,7 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev,
547{ 541{
548 int i; 542 int i;
549 pnp_irq_mask_t map; 543 pnp_irq_mask_t map;
550 unsigned char flags = 0; 544 unsigned char flags;
551
552 if (p->interrupt_count == 0)
553 flags |= IORESOURCE_DISABLED;
554 545
555 bitmap_zero(map.bits, PNP_IRQ_NR); 546 bitmap_zero(map.bits, PNP_IRQ_NR);
556 for (i = 0; i < p->interrupt_count; i++) { 547 for (i = 0; i < p->interrupt_count; i++) {
@@ -564,7 +555,7 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev,
564 } 555 }
565 } 556 }
566 557
567 flags |= irq_flags(p->triggering, p->polarity, p->sharable); 558 flags = irq_flags(p->triggering, p->polarity, p->sharable);
568 pnp_register_irq_resource(dev, option_flags, &map, flags); 559 pnp_register_irq_resource(dev, option_flags, &map, flags);
569} 560}
570 561
@@ -574,11 +565,8 @@ static __init void pnpacpi_parse_port_option(struct pnp_dev *dev,
574{ 565{
575 unsigned char flags = 0; 566 unsigned char flags = 0;
576 567
577 if (io->address_length == 0)
578 flags |= IORESOURCE_DISABLED;
579
580 if (io->io_decode == ACPI_DECODE_16) 568 if (io->io_decode == ACPI_DECODE_16)
581 flags |= IORESOURCE_IO_16BIT_ADDR; 569 flags = IORESOURCE_IO_16BIT_ADDR;
582 pnp_register_port_resource(dev, option_flags, io->minimum, io->maximum, 570 pnp_register_port_resource(dev, option_flags, io->minimum, io->maximum,
583 io->alignment, io->address_length, flags); 571 io->alignment, io->address_length, flags);
584} 572}
@@ -587,13 +575,8 @@ static __init void pnpacpi_parse_fixed_port_option(struct pnp_dev *dev,
587 unsigned int option_flags, 575 unsigned int option_flags,
588 struct acpi_resource_fixed_io *io) 576 struct acpi_resource_fixed_io *io)
589{ 577{
590 unsigned char flags = 0;
591
592 if (io->address_length == 0)
593 flags |= IORESOURCE_DISABLED;
594
595 pnp_register_port_resource(dev, option_flags, io->address, io->address, 578 pnp_register_port_resource(dev, option_flags, io->address, io->address,
596 0, io->address_length, flags | IORESOURCE_IO_FIXED); 579 0, io->address_length, IORESOURCE_IO_FIXED);
597} 580}
598 581
599static __init void pnpacpi_parse_mem24_option(struct pnp_dev *dev, 582static __init void pnpacpi_parse_mem24_option(struct pnp_dev *dev,
@@ -602,11 +585,8 @@ static __init void pnpacpi_parse_mem24_option(struct pnp_dev *dev,
602{ 585{
603 unsigned char flags = 0; 586 unsigned char flags = 0;
604 587
605 if (p->address_length == 0)
606 flags |= IORESOURCE_DISABLED;
607
608 if (p->write_protect == ACPI_READ_WRITE_MEMORY) 588 if (p->write_protect == ACPI_READ_WRITE_MEMORY)
609 flags |= IORESOURCE_MEM_WRITEABLE; 589 flags = IORESOURCE_MEM_WRITEABLE;
610 pnp_register_mem_resource(dev, option_flags, p->minimum, p->maximum, 590 pnp_register_mem_resource(dev, option_flags, p->minimum, p->maximum,
611 p->alignment, p->address_length, flags); 591 p->alignment, p->address_length, flags);
612} 592}
@@ -617,11 +597,8 @@ static __init void pnpacpi_parse_mem32_option(struct pnp_dev *dev,
617{ 597{
618 unsigned char flags = 0; 598 unsigned char flags = 0;
619 599
620 if (p->address_length == 0)
621 flags |= IORESOURCE_DISABLED;
622
623 if (p->write_protect == ACPI_READ_WRITE_MEMORY) 600 if (p->write_protect == ACPI_READ_WRITE_MEMORY)
624 flags |= IORESOURCE_MEM_WRITEABLE; 601 flags = IORESOURCE_MEM_WRITEABLE;
625 pnp_register_mem_resource(dev, option_flags, p->minimum, p->maximum, 602 pnp_register_mem_resource(dev, option_flags, p->minimum, p->maximum,
626 p->alignment, p->address_length, flags); 603 p->alignment, p->address_length, flags);
627} 604}
@@ -632,11 +609,8 @@ static __init void pnpacpi_parse_fixed_mem32_option(struct pnp_dev *dev,
632{ 609{
633 unsigned char flags = 0; 610 unsigned char flags = 0;
634 611
635 if (p->address_length == 0)
636 flags |= IORESOURCE_DISABLED;
637
638 if (p->write_protect == ACPI_READ_WRITE_MEMORY) 612 if (p->write_protect == ACPI_READ_WRITE_MEMORY)
639 flags |= IORESOURCE_MEM_WRITEABLE; 613 flags = IORESOURCE_MEM_WRITEABLE;
640 pnp_register_mem_resource(dev, option_flags, p->address, p->address, 614 pnp_register_mem_resource(dev, option_flags, p->address, p->address,
641 0, p->address_length, flags); 615 0, p->address_length, flags);
642} 616}
@@ -656,19 +630,16 @@ static __init void pnpacpi_parse_address_option(struct pnp_dev *dev,
656 return; 630 return;
657 } 631 }
658 632
659 if (p->address_length == 0)
660 flags |= IORESOURCE_DISABLED;
661
662 if (p->resource_type == ACPI_MEMORY_RANGE) { 633 if (p->resource_type == ACPI_MEMORY_RANGE) {
663 if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY) 634 if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY)
664 flags |= IORESOURCE_MEM_WRITEABLE; 635 flags = IORESOURCE_MEM_WRITEABLE;
665 pnp_register_mem_resource(dev, option_flags, p->minimum, 636 pnp_register_mem_resource(dev, option_flags, p->minimum,
666 p->minimum, 0, p->address_length, 637 p->minimum, 0, p->address_length,
667 flags); 638 flags);
668 } else if (p->resource_type == ACPI_IO_RANGE) 639 } else if (p->resource_type == ACPI_IO_RANGE)
669 pnp_register_port_resource(dev, option_flags, p->minimum, 640 pnp_register_port_resource(dev, option_flags, p->minimum,
670 p->minimum, 0, p->address_length, 641 p->minimum, 0, p->address_length,
671 flags | IORESOURCE_IO_FIXED); 642 IORESOURCE_IO_FIXED);
672} 643}
673 644
674static __init void pnpacpi_parse_ext_address_option(struct pnp_dev *dev, 645static __init void pnpacpi_parse_ext_address_option(struct pnp_dev *dev,
@@ -678,19 +649,16 @@ static __init void pnpacpi_parse_ext_address_option(struct pnp_dev *dev,
678 struct acpi_resource_extended_address64 *p = &r->data.ext_address64; 649 struct acpi_resource_extended_address64 *p = &r->data.ext_address64;
679 unsigned char flags = 0; 650 unsigned char flags = 0;
680 651
681 if (p->address_length == 0)
682 flags |= IORESOURCE_DISABLED;
683
684 if (p->resource_type == ACPI_MEMORY_RANGE) { 652 if (p->resource_type == ACPI_MEMORY_RANGE) {
685 if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY) 653 if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY)
686 flags |= IORESOURCE_MEM_WRITEABLE; 654 flags = IORESOURCE_MEM_WRITEABLE;
687 pnp_register_mem_resource(dev, option_flags, p->minimum, 655 pnp_register_mem_resource(dev, option_flags, p->minimum,
688 p->minimum, 0, p->address_length, 656 p->minimum, 0, p->address_length,
689 flags); 657 flags);
690 } else if (p->resource_type == ACPI_IO_RANGE) 658 } else if (p->resource_type == ACPI_IO_RANGE)
691 pnp_register_port_resource(dev, option_flags, p->minimum, 659 pnp_register_port_resource(dev, option_flags, p->minimum,
692 p->minimum, 0, p->address_length, 660 p->minimum, 0, p->address_length,
693 flags | IORESOURCE_IO_FIXED); 661 IORESOURCE_IO_FIXED);
694} 662}
695 663
696struct acpipnp_parse_option_s { 664struct acpipnp_parse_option_s {