···596 struct resource_map *map;597};598599-static resource_size_t600-pcmcia_common_align(void *align_data, const struct resource *res,601- resource_size_t size, resource_size_t align)602{603- struct pcmcia_align_data *data = align_data;604- resource_size_t start;605 /*606 * Ensure that we have the correct start address607 */608- start = (res->start & ~data->mask) + data->offset;609- if (start < res->start)610- start += data->mask + 1;611- return start;612}613614static resource_size_t···617 struct resource_map *m;618 resource_size_t start;619620- start = pcmcia_common_align(data, res, size, align);621622 for (m = data->map->next; m != data->map; m = m->next) {623- unsigned long start = m->base;624- unsigned long end = m->base + m->num - 1;625626 /*627 * If the lower resources are not available, try aligning628 * to this entry of the resource database to see if it'll629 * fit here.630 */631- if (res->start < start) {632- start = pcmcia_common_align(data, res, size, align);633- }634635 /*636 * If we're above the area which was passed in, there's637 * no point proceeding.638 */639- if (res->start >= res->end)640 break;641642- if ((res->start + size - 1) <= end)643 break;644 }645
···596 struct resource_map *map;597};598599+static resource_size_t pcmcia_common_align(struct pcmcia_align_data *align_data,600+ resource_size_t start)0601{602+ resource_size_t ret;0603 /*604 * Ensure that we have the correct start address605 */606+ ret = (start & ~align_data->mask) + align_data->offset;607+ if (ret < start)608+ ret += align_data->mask + 1;609+ return ret;610}611612static resource_size_t···619 struct resource_map *m;620 resource_size_t start;621622+ start = pcmcia_common_align(data, res->start);623624 for (m = data->map->next; m != data->map; m = m->next) {625+ unsigned long map_start = m->base;626+ unsigned long map_end = m->base + m->num - 1;627628 /*629 * If the lower resources are not available, try aligning630 * to this entry of the resource database to see if it'll631 * fit here.632 */633+ if (start < map_start)634+ start = pcmcia_common_align(data, map_start);0635636 /*637 * If we're above the area which was passed in, there's638 * no point proceeding.639 */640+ if (start >= res->end)641 break;642643+ if ((start + size - 1) <= map_end)644 break;645 }646