Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bjorn Helgaas and committed by
Len Brown
01115e7d d6180f36

+41 -49
+41 -49
drivers/pnp/isapnp/core.c
··· 929 929 EXPORT_SYMBOL(isapnp_cfg_end); 930 930 EXPORT_SYMBOL(isapnp_write_byte); 931 931 932 - static int isapnp_read_resources(struct pnp_dev *dev) 933 - { 934 - struct pnp_resource *pnp_res; 935 - int tmp, ret; 936 - 937 - dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); 938 - if (dev->active) { 939 - for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) { 940 - ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); 941 - if (!ret) 942 - continue; 943 - pnp_res = pnp_add_io_resource(dev, ret, ret, 0); 944 - if (pnp_res) 945 - pnp_res->index = tmp; 946 - } 947 - for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { 948 - ret = 949 - isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; 950 - if (!ret) 951 - continue; 952 - pnp_res = pnp_add_mem_resource(dev, ret, ret, 0); 953 - if (pnp_res) 954 - pnp_res->index = tmp; 955 - } 956 - for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { 957 - ret = 958 - (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> 959 - 8); 960 - if (!ret) 961 - continue; 962 - pnp_res = pnp_add_irq_resource(dev, ret, 0); 963 - if (pnp_res) 964 - pnp_res->index = tmp; 965 - } 966 - for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { 967 - ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); 968 - if (ret == 4) 969 - continue; 970 - pnp_res = pnp_add_dma_resource(dev, ret, 0); 971 - if (pnp_res) 972 - pnp_res->index = tmp; 973 - } 974 - } 975 - return 0; 976 - } 977 - 978 932 static int isapnp_get_resources(struct pnp_dev *dev) 979 933 { 980 - int ret; 934 + struct pnp_resource *pnp_res; 935 + int i, ret; 981 936 982 937 dev_dbg(&dev->dev, "get resources\n"); 983 938 pnp_init_resources(dev); 984 939 isapnp_cfg_begin(dev->card->number, dev->number); 985 - ret = isapnp_read_resources(dev); 940 + dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); 941 + if (!dev->active) 942 + goto __end; 943 + 944 + for (i = 0; i < ISAPNP_MAX_PORT; i++) { 945 + ret = isapnp_read_word(ISAPNP_CFG_PORT + (i << 1)); 946 + if (ret) { 947 + pnp_res = pnp_add_io_resource(dev, ret, ret, 0); 948 + if (pnp_res) 949 + pnp_res->index = i; 950 + } 951 + } 952 + for (i = 0; i < ISAPNP_MAX_MEM; i++) { 953 + ret = isapnp_read_word(ISAPNP_CFG_MEM + (i << 3)) << 8; 954 + if (ret) { 955 + pnp_res = pnp_add_mem_resource(dev, ret, ret, 0); 956 + if (pnp_res) 957 + pnp_res->index = i; 958 + } 959 + } 960 + for (i = 0; i < ISAPNP_MAX_IRQ; i++) { 961 + ret = isapnp_read_word(ISAPNP_CFG_IRQ + (i << 1)) >> 8; 962 + if (ret) { 963 + pnp_res = pnp_add_irq_resource(dev, ret, 0); 964 + if (pnp_res) 965 + pnp_res->index = i; 966 + } 967 + } 968 + for (i = 0; i < ISAPNP_MAX_DMA; i++) { 969 + ret = isapnp_read_byte(ISAPNP_CFG_DMA + i); 970 + if (ret != 4) { 971 + pnp_res = pnp_add_dma_resource(dev, ret, 0); 972 + if (pnp_res) 973 + pnp_res->index = i; 974 + } 975 + } 976 + 977 + __end: 986 978 isapnp_cfg_end(); 987 - return ret; 979 + return 0; 988 980 } 989 981 990 982 static int isapnp_set_resources(struct pnp_dev *dev)