aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:24 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:26 -0400
commit7e2cf31f1c97ac14b6d9dc5f1ce9e1e01aef9c18 (patch)
treea69361060c5bd7a2d4ca6f8d91ff09248d7dee7b /drivers
parentbe81b4a4838ce329b9f3978c7fc007b047c23722 (diff)
PNP: convert encoders to use pnp_get_resource(), not pnp_resource_table
This removes more direct references to pnp_resource_table. This path is used when telling a device what resources it should use. This doesn't convert ISAPNP because ISA needs to know the config register index in addition to the resource itself. 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')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c19
-rw-r--r--drivers/pnp/pnpbios/rsparser.c22
2 files changed, 22 insertions, 19 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index bd41e4d4270c..000a1b39f0b6 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -1014,7 +1014,6 @@ static void pnpacpi_encode_fixed_mem32(struct pnp_dev *dev,
1014 1014
1015int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer) 1015int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer)
1016{ 1016{
1017 struct pnp_resource_table *res_table = &dev->res;
1018 int i = 0; 1017 int i = 0;
1019 /* pnpacpi_build_resource_template allocates extra mem */ 1018 /* pnpacpi_build_resource_template allocates extra mem */
1020 int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1; 1019 int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1;
@@ -1026,45 +1025,43 @@ int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer)
1026 switch (resource->type) { 1025 switch (resource->type) {
1027 case ACPI_RESOURCE_TYPE_IRQ: 1026 case ACPI_RESOURCE_TYPE_IRQ:
1028 pnpacpi_encode_irq(dev, resource, 1027 pnpacpi_encode_irq(dev, resource,
1029 &res_table->irq_resource[irq]); 1028 pnp_get_resource(dev, IORESOURCE_IRQ, irq));
1030 irq++; 1029 irq++;
1031 break; 1030 break;
1032 1031
1033 case ACPI_RESOURCE_TYPE_DMA: 1032 case ACPI_RESOURCE_TYPE_DMA:
1034 pnpacpi_encode_dma(dev, resource, 1033 pnpacpi_encode_dma(dev, resource,
1035 &res_table->dma_resource[dma]); 1034 pnp_get_resource(dev, IORESOURCE_DMA, dma));
1036 dma++; 1035 dma++;
1037 break; 1036 break;
1038 case ACPI_RESOURCE_TYPE_IO: 1037 case ACPI_RESOURCE_TYPE_IO:
1039 pnpacpi_encode_io(dev, resource, 1038 pnpacpi_encode_io(dev, resource,
1040 &res_table->port_resource[port]); 1039 pnp_get_resource(dev, IORESOURCE_IO, port));
1041 port++; 1040 port++;
1042 break; 1041 break;
1043 case ACPI_RESOURCE_TYPE_FIXED_IO: 1042 case ACPI_RESOURCE_TYPE_FIXED_IO:
1044 pnpacpi_encode_fixed_io(dev, resource, 1043 pnpacpi_encode_fixed_io(dev, resource,
1045 &res_table-> 1044 pnp_get_resource(dev, IORESOURCE_IO, port));
1046 port_resource[port]);
1047 port++; 1045 port++;
1048 break; 1046 break;
1049 case ACPI_RESOURCE_TYPE_MEMORY24: 1047 case ACPI_RESOURCE_TYPE_MEMORY24:
1050 pnpacpi_encode_mem24(dev, resource, 1048 pnpacpi_encode_mem24(dev, resource,
1051 &res_table->mem_resource[mem]); 1049 pnp_get_resource(dev, IORESOURCE_MEM, mem));
1052 mem++; 1050 mem++;
1053 break; 1051 break;
1054 case ACPI_RESOURCE_TYPE_MEMORY32: 1052 case ACPI_RESOURCE_TYPE_MEMORY32:
1055 pnpacpi_encode_mem32(dev, resource, 1053 pnpacpi_encode_mem32(dev, resource,
1056 &res_table->mem_resource[mem]); 1054 pnp_get_resource(dev, IORESOURCE_MEM, mem));
1057 mem++; 1055 mem++;
1058 break; 1056 break;
1059 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: 1057 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
1060 pnpacpi_encode_fixed_mem32(dev, resource, 1058 pnpacpi_encode_fixed_mem32(dev, resource,
1061 &res_table-> 1059 pnp_get_resource(dev, IORESOURCE_MEM, mem));
1062 mem_resource[mem]);
1063 mem++; 1060 mem++;
1064 break; 1061 break;
1065 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: 1062 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
1066 pnpacpi_encode_ext_irq(dev, resource, 1063 pnpacpi_encode_ext_irq(dev, resource,
1067 &res_table->irq_resource[irq]); 1064 pnp_get_resource(dev, IORESOURCE_IRQ, irq));
1068 irq++; 1065 irq++;
1069 break; 1066 break;
1070 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 1067 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index 4390e3b41df0..c1f9e162d2c5 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -688,7 +688,6 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev
688 unsigned char *p, 688 unsigned char *p,
689 unsigned char *end) 689 unsigned char *end)
690{ 690{
691 struct pnp_resource_table *res = &dev->res;
692 unsigned int len, tag; 691 unsigned int len, tag;
693 int port = 0, irq = 0, dma = 0, mem = 0; 692 int port = 0, irq = 0, dma = 0, mem = 0;
694 693
@@ -711,42 +710,48 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev
711 case LARGE_TAG_MEM: 710 case LARGE_TAG_MEM:
712 if (len != 9) 711 if (len != 9)
713 goto len_err; 712 goto len_err;
714 pnpbios_encode_mem(dev, p, &res->mem_resource[mem]); 713 pnpbios_encode_mem(dev, p,
714 pnp_get_resource(dev, IORESOURCE_MEM, mem));
715 mem++; 715 mem++;
716 break; 716 break;
717 717
718 case LARGE_TAG_MEM32: 718 case LARGE_TAG_MEM32:
719 if (len != 17) 719 if (len != 17)
720 goto len_err; 720 goto len_err;
721 pnpbios_encode_mem32(dev, p, &res->mem_resource[mem]); 721 pnpbios_encode_mem32(dev, p,
722 pnp_get_resource(dev, IORESOURCE_MEM, mem));
722 mem++; 723 mem++;
723 break; 724 break;
724 725
725 case LARGE_TAG_FIXEDMEM32: 726 case LARGE_TAG_FIXEDMEM32:
726 if (len != 9) 727 if (len != 9)
727 goto len_err; 728 goto len_err;
728 pnpbios_encode_fixed_mem32(dev, p, &res->mem_resource[mem]); 729 pnpbios_encode_fixed_mem32(dev, p,
730 pnp_get_resource(dev, IORESOURCE_MEM, mem));
729 mem++; 731 mem++;
730 break; 732 break;
731 733
732 case SMALL_TAG_IRQ: 734 case SMALL_TAG_IRQ:
733 if (len < 2 || len > 3) 735 if (len < 2 || len > 3)
734 goto len_err; 736 goto len_err;
735 pnpbios_encode_irq(dev, p, &res->irq_resource[irq]); 737 pnpbios_encode_irq(dev, p,
738 pnp_get_resource(dev, IORESOURCE_IRQ, irq));
736 irq++; 739 irq++;
737 break; 740 break;
738 741
739 case SMALL_TAG_DMA: 742 case SMALL_TAG_DMA:
740 if (len != 2) 743 if (len != 2)
741 goto len_err; 744 goto len_err;
742 pnpbios_encode_dma(dev, p, &res->dma_resource[dma]); 745 pnpbios_encode_dma(dev, p,
746 pnp_get_resource(dev, IORESOURCE_DMA, dma));
743 dma++; 747 dma++;
744 break; 748 break;
745 749
746 case SMALL_TAG_PORT: 750 case SMALL_TAG_PORT:
747 if (len != 7) 751 if (len != 7)
748 goto len_err; 752 goto len_err;
749 pnpbios_encode_port(dev, p, &res->port_resource[port]); 753 pnpbios_encode_port(dev, p,
754 pnp_get_resource(dev, IORESOURCE_IO, port));
750 port++; 755 port++;
751 break; 756 break;
752 757
@@ -757,7 +762,8 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev
757 case SMALL_TAG_FIXEDPORT: 762 case SMALL_TAG_FIXEDPORT:
758 if (len != 3) 763 if (len != 3)
759 goto len_err; 764 goto len_err;
760 pnpbios_encode_fixed_port(dev, p, &res->port_resource[port]); 765 pnpbios_encode_fixed_port(dev, p,
766 pnp_get_resource(dev, IORESOURCE_IO, port));
761 port++; 767 port++;
762 break; 768 break;
763 769