aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:38 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:29 -0400
commit01115e7d41c4eaeffa064d818b4abbd3efa94f80 (patch)
treeed55914e1fe6c12435ecbb18650e29327268dcd8
parentd6180f36617953990bf90d4c1ff85b77e9995cd1 (diff)
ISAPNP: fold isapnp_read_resources() back into isapnp_get_resources()
isapnp_get_resources() does very little besides call isapnp_read_resources(), so just fold them back together. Based on a patch by Rene Herman <rene.herman@gmail.com> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/pnp/isapnp/core.c66
1 files changed, 29 insertions, 37 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index f08399497e4c..a3f1566ccea5 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -929,62 +929,54 @@ EXPORT_SYMBOL(isapnp_cfg_begin);
929EXPORT_SYMBOL(isapnp_cfg_end); 929EXPORT_SYMBOL(isapnp_cfg_end);
930EXPORT_SYMBOL(isapnp_write_byte); 930EXPORT_SYMBOL(isapnp_write_byte);
931 931
932static int isapnp_read_resources(struct pnp_dev *dev) 932static int isapnp_get_resources(struct pnp_dev *dev)
933{ 933{
934 struct pnp_resource *pnp_res; 934 struct pnp_resource *pnp_res;
935 int tmp, ret; 935 int i, ret;
936 936
937 dev_dbg(&dev->dev, "get resources\n");
938 pnp_init_resources(dev);
939 isapnp_cfg_begin(dev->card->number, dev->number);
937 dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); 940 dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE);
938 if (dev->active) { 941 if (!dev->active)
939 for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) { 942 goto __end;
940 ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); 943
941 if (!ret) 944 for (i = 0; i < ISAPNP_MAX_PORT; i++) {
942 continue; 945 ret = isapnp_read_word(ISAPNP_CFG_PORT + (i << 1));
946 if (ret) {
943 pnp_res = pnp_add_io_resource(dev, ret, ret, 0); 947 pnp_res = pnp_add_io_resource(dev, ret, ret, 0);
944 if (pnp_res) 948 if (pnp_res)
945 pnp_res->index = tmp; 949 pnp_res->index = i;
946 } 950 }
947 for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { 951 }
948 ret = 952 for (i = 0; i < ISAPNP_MAX_MEM; i++) {
949 isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; 953 ret = isapnp_read_word(ISAPNP_CFG_MEM + (i << 3)) << 8;
950 if (!ret) 954 if (ret) {
951 continue;
952 pnp_res = pnp_add_mem_resource(dev, ret, ret, 0); 955 pnp_res = pnp_add_mem_resource(dev, ret, ret, 0);
953 if (pnp_res) 956 if (pnp_res)
954 pnp_res->index = tmp; 957 pnp_res->index = i;
955 } 958 }
956 for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { 959 }
957 ret = 960 for (i = 0; i < ISAPNP_MAX_IRQ; i++) {
958 (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> 961 ret = isapnp_read_word(ISAPNP_CFG_IRQ + (i << 1)) >> 8;
959 8); 962 if (ret) {
960 if (!ret)
961 continue;
962 pnp_res = pnp_add_irq_resource(dev, ret, 0); 963 pnp_res = pnp_add_irq_resource(dev, ret, 0);
963 if (pnp_res) 964 if (pnp_res)
964 pnp_res->index = tmp; 965 pnp_res->index = i;
965 } 966 }
966 for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { 967 }
967 ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); 968 for (i = 0; i < ISAPNP_MAX_DMA; i++) {
968 if (ret == 4) 969 ret = isapnp_read_byte(ISAPNP_CFG_DMA + i);
969 continue; 970 if (ret != 4) {
970 pnp_res = pnp_add_dma_resource(dev, ret, 0); 971 pnp_res = pnp_add_dma_resource(dev, ret, 0);
971 if (pnp_res) 972 if (pnp_res)
972 pnp_res->index = tmp; 973 pnp_res->index = i;
973 } 974 }
974 } 975 }
975 return 0;
976}
977 976
978static int isapnp_get_resources(struct pnp_dev *dev) 977__end:
979{
980 int ret;
981
982 dev_dbg(&dev->dev, "get resources\n");
983 pnp_init_resources(dev);
984 isapnp_cfg_begin(dev->card->number, dev->number);
985 ret = isapnp_read_resources(dev);
986 isapnp_cfg_end(); 978 isapnp_cfg_end();
987 return ret; 979 return 0;
988} 980}
989 981
990static int isapnp_set_resources(struct pnp_dev *dev) 982static int isapnp_set_resources(struct pnp_dev *dev)