aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 1a6937d9118..bbf3edd85be 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -509,15 +509,15 @@ 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; 512 unsigned char map = 0, flags = 0;
513 513
514 if (p->channel_count == 0) 514 if (p->channel_count == 0)
515 return; 515 flags |= IORESOURCE_DISABLED;
516 516
517 for (i = 0; i < p->channel_count; i++) 517 for (i = 0; i < p->channel_count; i++)
518 map |= 1 << p->channels[i]; 518 map |= 1 << p->channels[i];
519 519
520 flags = dma_flags(dev, p->type, p->bus_master, p->transfer); 520 flags |= dma_flags(dev, p->type, p->bus_master, p->transfer);
521 pnp_register_dma_resource(dev, option_flags, map, flags); 521 pnp_register_dma_resource(dev, option_flags, map, flags);
522} 522}
523 523
@@ -527,17 +527,17 @@ static __init void pnpacpi_parse_irq_option(struct pnp_dev *dev,
527{ 527{
528 int i; 528 int i;
529 pnp_irq_mask_t map; 529 pnp_irq_mask_t map;
530 unsigned char flags; 530 unsigned char flags = 0;
531 531
532 if (p->interrupt_count == 0) 532 if (p->interrupt_count == 0)
533 return; 533 flags |= IORESOURCE_DISABLED;
534 534
535 bitmap_zero(map.bits, PNP_IRQ_NR); 535 bitmap_zero(map.bits, PNP_IRQ_NR);
536 for (i = 0; i < p->interrupt_count; i++) 536 for (i = 0; i < p->interrupt_count; i++)
537 if (p->interrupts[i]) 537 if (p->interrupts[i])
538 __set_bit(p->interrupts[i], map.bits); 538 __set_bit(p->interrupts[i], map.bits);
539 539
540 flags = irq_flags(p->triggering, p->polarity, p->sharable); 540 flags |= irq_flags(p->triggering, p->polarity, p->sharable);
541 pnp_register_irq_resource(dev, option_flags, &map, flags); 541 pnp_register_irq_resource(dev, option_flags, &map, flags);
542} 542}
543 543
@@ -547,10 +547,10 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev,
547{ 547{
548 int i; 548 int i;
549 pnp_irq_mask_t map; 549 pnp_irq_mask_t map;
550 unsigned char flags; 550 unsigned char flags = 0;
551 551
552 if (p->interrupt_count == 0) 552 if (p->interrupt_count == 0)
553 return; 553 flags |= IORESOURCE_DISABLED;
554 554
555 bitmap_zero(map.bits, PNP_IRQ_NR); 555 bitmap_zero(map.bits, PNP_IRQ_NR);
556 for (i = 0; i < p->interrupt_count; i++) { 556 for (i = 0; i < p->interrupt_count; i++) {
@@ -564,7 +564,7 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev,
564 } 564 }
565 } 565 }
566 566
567 flags = irq_flags(p->triggering, p->polarity, p->sharable); 567 flags |= irq_flags(p->triggering, p->polarity, p->sharable);
568 pnp_register_irq_resource(dev, option_flags, &map, flags); 568 pnp_register_irq_resource(dev, option_flags, &map, flags);
569} 569}
570 570
@@ -575,10 +575,10 @@ static __init void pnpacpi_parse_port_option(struct pnp_dev *dev,
575 unsigned char flags = 0; 575 unsigned char flags = 0;
576 576
577 if (io->address_length == 0) 577 if (io->address_length == 0)
578 return; 578 flags |= IORESOURCE_DISABLED;
579 579
580 if (io->io_decode == ACPI_DECODE_16) 580 if (io->io_decode == ACPI_DECODE_16)
581 flags = IORESOURCE_IO_16BIT_ADDR; 581 flags |= IORESOURCE_IO_16BIT_ADDR;
582 pnp_register_port_resource(dev, option_flags, io->minimum, io->maximum, 582 pnp_register_port_resource(dev, option_flags, io->minimum, io->maximum,
583 io->alignment, io->address_length, flags); 583 io->alignment, io->address_length, flags);
584} 584}
@@ -587,11 +587,13 @@ static __init void pnpacpi_parse_fixed_port_option(struct pnp_dev *dev,
587 unsigned int option_flags, 587 unsigned int option_flags,
588 struct acpi_resource_fixed_io *io) 588 struct acpi_resource_fixed_io *io)
589{ 589{
590 unsigned char flags = 0;
591
590 if (io->address_length == 0) 592 if (io->address_length == 0)
591 return; 593 flags |= IORESOURCE_DISABLED;
592 594
593 pnp_register_port_resource(dev, option_flags, io->address, io->address, 595 pnp_register_port_resource(dev, option_flags, io->address, io->address,
594 0, io->address_length, IORESOURCE_IO_FIXED); 596 0, io->address_length, flags | IORESOURCE_IO_FIXED);
595} 597}
596 598
597static __init void pnpacpi_parse_mem24_option(struct pnp_dev *dev, 599static __init void pnpacpi_parse_mem24_option(struct pnp_dev *dev,
@@ -601,10 +603,10 @@ static __init void pnpacpi_parse_mem24_option(struct pnp_dev *dev,
601 unsigned char flags = 0; 603 unsigned char flags = 0;
602 604
603 if (p->address_length == 0) 605 if (p->address_length == 0)
604 return; 606 flags |= IORESOURCE_DISABLED;
605 607
606 if (p->write_protect == ACPI_READ_WRITE_MEMORY) 608 if (p->write_protect == ACPI_READ_WRITE_MEMORY)
607 flags = IORESOURCE_MEM_WRITEABLE; 609 flags |= IORESOURCE_MEM_WRITEABLE;
608 pnp_register_mem_resource(dev, option_flags, p->minimum, p->maximum, 610 pnp_register_mem_resource(dev, option_flags, p->minimum, p->maximum,
609 p->alignment, p->address_length, flags); 611 p->alignment, p->address_length, flags);
610} 612}
@@ -616,10 +618,10 @@ static __init void pnpacpi_parse_mem32_option(struct pnp_dev *dev,
616 unsigned char flags = 0; 618 unsigned char flags = 0;
617 619
618 if (p->address_length == 0) 620 if (p->address_length == 0)
619 return; 621 flags |= IORESOURCE_DISABLED;
620 622
621 if (p->write_protect == ACPI_READ_WRITE_MEMORY) 623 if (p->write_protect == ACPI_READ_WRITE_MEMORY)
622 flags = IORESOURCE_MEM_WRITEABLE; 624 flags |= IORESOURCE_MEM_WRITEABLE;
623 pnp_register_mem_resource(dev, option_flags, p->minimum, p->maximum, 625 pnp_register_mem_resource(dev, option_flags, p->minimum, p->maximum,
624 p->alignment, p->address_length, flags); 626 p->alignment, p->address_length, flags);
625} 627}
@@ -631,10 +633,10 @@ static __init void pnpacpi_parse_fixed_mem32_option(struct pnp_dev *dev,
631 unsigned char flags = 0; 633 unsigned char flags = 0;
632 634
633 if (p->address_length == 0) 635 if (p->address_length == 0)
634 return; 636 flags |= IORESOURCE_DISABLED;
635 637
636 if (p->write_protect == ACPI_READ_WRITE_MEMORY) 638 if (p->write_protect == ACPI_READ_WRITE_MEMORY)
637 flags = IORESOURCE_MEM_WRITEABLE; 639 flags |= IORESOURCE_MEM_WRITEABLE;
638 pnp_register_mem_resource(dev, option_flags, p->address, p->address, 640 pnp_register_mem_resource(dev, option_flags, p->address, p->address,
639 0, p->address_length, flags); 641 0, p->address_length, flags);
640} 642}
@@ -655,18 +657,18 @@ static __init void pnpacpi_parse_address_option(struct pnp_dev *dev,
655 } 657 }
656 658
657 if (p->address_length == 0) 659 if (p->address_length == 0)
658 return; 660 flags |= IORESOURCE_DISABLED;
659 661
660 if (p->resource_type == ACPI_MEMORY_RANGE) { 662 if (p->resource_type == ACPI_MEMORY_RANGE) {
661 if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY) 663 if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY)
662 flags = IORESOURCE_MEM_WRITEABLE; 664 flags |= IORESOURCE_MEM_WRITEABLE;
663 pnp_register_mem_resource(dev, option_flags, p->minimum, 665 pnp_register_mem_resource(dev, option_flags, p->minimum,
664 p->minimum, 0, p->address_length, 666 p->minimum, 0, p->address_length,
665 flags); 667 flags);
666 } else if (p->resource_type == ACPI_IO_RANGE) 668 } else if (p->resource_type == ACPI_IO_RANGE)
667 pnp_register_port_resource(dev, option_flags, p->minimum, 669 pnp_register_port_resource(dev, option_flags, p->minimum,
668 p->minimum, 0, p->address_length, 670 p->minimum, 0, p->address_length,
669 IORESOURCE_IO_FIXED); 671 flags | IORESOURCE_IO_FIXED);
670} 672}
671 673
672static __init void pnpacpi_parse_ext_address_option(struct pnp_dev *dev, 674static __init void pnpacpi_parse_ext_address_option(struct pnp_dev *dev,
@@ -677,18 +679,18 @@ static __init void pnpacpi_parse_ext_address_option(struct pnp_dev *dev,
677 unsigned char flags = 0; 679 unsigned char flags = 0;
678 680
679 if (p->address_length == 0) 681 if (p->address_length == 0)
680 return; 682 flags |= IORESOURCE_DISABLED;
681 683
682 if (p->resource_type == ACPI_MEMORY_RANGE) { 684 if (p->resource_type == ACPI_MEMORY_RANGE) {
683 if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY) 685 if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY)
684 flags = IORESOURCE_MEM_WRITEABLE; 686 flags |= IORESOURCE_MEM_WRITEABLE;
685 pnp_register_mem_resource(dev, option_flags, p->minimum, 687 pnp_register_mem_resource(dev, option_flags, p->minimum,
686 p->minimum, 0, p->address_length, 688 p->minimum, 0, p->address_length,
687 flags); 689 flags);
688 } else if (p->resource_type == ACPI_IO_RANGE) 690 } else if (p->resource_type == ACPI_IO_RANGE)
689 pnp_register_port_resource(dev, option_flags, p->minimum, 691 pnp_register_port_resource(dev, option_flags, p->minimum,
690 p->minimum, 0, p->address_length, 692 p->minimum, 0, p->address_length,
691 IORESOURCE_IO_FIXED); 693 flags | IORESOURCE_IO_FIXED);
692} 694}
693 695
694struct acpipnp_parse_option_s { 696struct acpipnp_parse_option_s {