diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:29 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:27 -0400 |
commit | 06cb58a6eb0b689f95a6c055cfc400fd30c500c6 (patch) | |
tree | b2b2cc2ac421091be7949315b6ffde6426466700 /drivers/pnp/isapnp | |
parent | 02d83b5da3efa3c278ce87db2637f3dd6837166d (diff) |
PNP: remove pnp_resource_table references from resource decoders
This removes a few more references to the pnp_resource_table.
No functional change.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/isapnp')
-rw-r--r-- | drivers/pnp/isapnp/core.c | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 4407e844b5ea..a62ecc6f13bd 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -931,7 +931,7 @@ EXPORT_SYMBOL(isapnp_write_byte); | |||
931 | 931 | ||
932 | static int isapnp_read_resources(struct pnp_dev *dev) | 932 | static int isapnp_read_resources(struct pnp_dev *dev) |
933 | { | 933 | { |
934 | struct pnp_resource_table *res = dev->res; | 934 | struct resource *res; |
935 | int tmp, ret; | 935 | int tmp, ret; |
936 | 936 | ||
937 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); | 937 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); |
@@ -940,16 +940,18 @@ static int isapnp_read_resources(struct pnp_dev *dev) | |||
940 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); | 940 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); |
941 | if (!ret) | 941 | if (!ret) |
942 | continue; | 942 | continue; |
943 | res->port_resource[tmp].start = ret; | 943 | res = pnp_get_resource(dev, IORESOURCE_IO, tmp); |
944 | res->port_resource[tmp].flags = IORESOURCE_IO; | 944 | res->start = ret; |
945 | res->flags = IORESOURCE_IO; | ||
945 | } | 946 | } |
946 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { | 947 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { |
947 | ret = | 948 | ret = |
948 | isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; | 949 | isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; |
949 | if (!ret) | 950 | if (!ret) |
950 | continue; | 951 | continue; |
951 | res->mem_resource[tmp].start = ret; | 952 | res = pnp_get_resource(dev, IORESOURCE_MEM, tmp); |
952 | res->mem_resource[tmp].flags = IORESOURCE_MEM; | 953 | res->start = ret; |
954 | res->flags = IORESOURCE_MEM; | ||
953 | } | 955 | } |
954 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { | 956 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { |
955 | ret = | 957 | ret = |
@@ -957,17 +959,17 @@ static int isapnp_read_resources(struct pnp_dev *dev) | |||
957 | 8); | 959 | 8); |
958 | if (!ret) | 960 | if (!ret) |
959 | continue; | 961 | continue; |
960 | res->irq_resource[tmp].start = | 962 | res = pnp_get_resource(dev, IORESOURCE_IRQ, tmp); |
961 | res->irq_resource[tmp].end = ret; | 963 | res->start = res->end = ret; |
962 | res->irq_resource[tmp].flags = IORESOURCE_IRQ; | 964 | res->flags = IORESOURCE_IRQ; |
963 | } | 965 | } |
964 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { | 966 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { |
965 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); | 967 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); |
966 | if (ret == 4) | 968 | if (ret == 4) |
967 | continue; | 969 | continue; |
968 | res->dma_resource[tmp].start = | 970 | res = pnp_get_resource(dev, IORESOURCE_DMA, tmp); |
969 | res->dma_resource[tmp].end = ret; | 971 | res->start = res->end = ret; |
970 | res->dma_resource[tmp].flags = IORESOURCE_DMA; | 972 | res->flags = IORESOURCE_DMA; |
971 | } | 973 | } |
972 | } | 974 | } |
973 | return 0; | 975 | return 0; |
@@ -987,52 +989,47 @@ static int isapnp_get_resources(struct pnp_dev *dev) | |||
987 | 989 | ||
988 | static int isapnp_set_resources(struct pnp_dev *dev) | 990 | static int isapnp_set_resources(struct pnp_dev *dev) |
989 | { | 991 | { |
990 | struct pnp_resource_table *res = dev->res; | 992 | struct resource *res; |
991 | int tmp; | 993 | int tmp; |
992 | 994 | ||
993 | dev_dbg(&dev->dev, "set resources\n"); | 995 | dev_dbg(&dev->dev, "set resources\n"); |
994 | isapnp_cfg_begin(dev->card->number, dev->number); | 996 | isapnp_cfg_begin(dev->card->number, dev->number); |
995 | dev->active = 1; | 997 | dev->active = 1; |
996 | for (tmp = 0; | 998 | for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) { |
997 | tmp < ISAPNP_MAX_PORT | 999 | res = pnp_get_resource(dev, IORESOURCE_IO, tmp); |
998 | && (res->port_resource[tmp]. | 1000 | if (pnp_resource_valid(res)) { |
999 | flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; | 1001 | dev_dbg(&dev->dev, " set io %d to %#llx\n", |
1000 | tmp++) { | 1002 | tmp, (unsigned long long) res->start); |
1001 | dev_dbg(&dev->dev, " set io %d to %#llx\n", | 1003 | isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), |
1002 | tmp, (unsigned long long) res->port_resource[tmp].start); | 1004 | res->start); |
1003 | isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), | 1005 | } |
1004 | res->port_resource[tmp].start); | ||
1005 | } | 1006 | } |
1006 | for (tmp = 0; | 1007 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { |
1007 | tmp < ISAPNP_MAX_IRQ | 1008 | res = pnp_get_resource(dev, IORESOURCE_IRQ, tmp); |
1008 | && (res->irq_resource[tmp]. | 1009 | if (pnp_resource_valid(res)) { |
1009 | flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; | 1010 | int irq = res->start; |
1010 | tmp++) { | 1011 | if (irq == 2) |
1011 | int irq = res->irq_resource[tmp].start; | 1012 | irq = 9; |
1012 | if (irq == 2) | 1013 | dev_dbg(&dev->dev, " set irq %d to %d\n", tmp, irq); |
1013 | irq = 9; | 1014 | isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); |
1014 | dev_dbg(&dev->dev, " set irq %d to %d\n", tmp, irq); | 1015 | } |
1015 | isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); | ||
1016 | } | 1016 | } |
1017 | for (tmp = 0; | 1017 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { |
1018 | tmp < ISAPNP_MAX_DMA | 1018 | res = pnp_get_resource(dev, IORESOURCE_DMA, tmp); |
1019 | && (res->dma_resource[tmp]. | 1019 | if (pnp_resource_valid(res)) { |
1020 | flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; | 1020 | dev_dbg(&dev->dev, " set dma %d to %lld\n", |
1021 | tmp++) { | 1021 | tmp, (unsigned long long) res->start); |
1022 | dev_dbg(&dev->dev, " set dma %d to %lld\n", | 1022 | isapnp_write_byte(ISAPNP_CFG_DMA + tmp, res->start); |
1023 | tmp, (unsigned long long) res->dma_resource[tmp].start); | 1023 | } |
1024 | isapnp_write_byte(ISAPNP_CFG_DMA + tmp, | ||
1025 | res->dma_resource[tmp].start); | ||
1026 | } | 1024 | } |
1027 | for (tmp = 0; | 1025 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { |
1028 | tmp < ISAPNP_MAX_MEM | 1026 | res = pnp_get_resource(dev, IORESOURCE_MEM, tmp); |
1029 | && (res->mem_resource[tmp]. | 1027 | if (pnp_resource_valid(res)) { |
1030 | flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; | 1028 | dev_dbg(&dev->dev, " set mem %d to %#llx\n", |
1031 | tmp++) { | 1029 | tmp, (unsigned long long) res->start); |
1032 | dev_dbg(&dev->dev, " set mem %d to %#llx\n", | 1030 | isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3), |
1033 | tmp, (unsigned long long) res->mem_resource[tmp].start); | 1031 | (res->start >> 8) & 0xffff); |
1034 | isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3), | 1032 | } |
1035 | (res->mem_resource[tmp].start >> 8) & 0xffff); | ||
1036 | } | 1033 | } |
1037 | /* FIXME: We aren't handling 32bit mems properly here */ | 1034 | /* FIXME: We aren't handling 32bit mems properly here */ |
1038 | isapnp_activate(dev->number); | 1035 | isapnp_activate(dev->number); |