aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-04-06 16:03:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-06 16:03:52 -0400
commit0fdf86754f70e813845af4abaa805165ce57a0bb (patch)
treebafc26ec92dfe2ae430c0219882adb2c50578b1c /drivers/pcmcia
parent94c4fcec0144e032ef7d4ec761ab81d570b0bc2a (diff)
parent147a27460366ecd35f1425f593cb42d52166c7ff (diff)
Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: pcmcia: fix up alignf issues
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 2e47991eccf6..559069a80a3b 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -596,19 +596,17 @@ struct pcmcia_align_data {
596 struct resource_map *map; 596 struct resource_map *map;
597}; 597};
598 598
599static resource_size_t 599static resource_size_t pcmcia_common_align(struct pcmcia_align_data *align_data,
600pcmcia_common_align(void *align_data, const struct resource *res, 600 resource_size_t start)
601 resource_size_t size, resource_size_t align)
602{ 601{
603 struct pcmcia_align_data *data = align_data; 602 resource_size_t ret;
604 resource_size_t start;
605 /* 603 /*
606 * Ensure that we have the correct start address 604 * Ensure that we have the correct start address
607 */ 605 */
608 start = (res->start & ~data->mask) + data->offset; 606 ret = (start & ~align_data->mask) + align_data->offset;
609 if (start < res->start) 607 if (ret < start)
610 start += data->mask + 1; 608 ret += align_data->mask + 1;
611 return start; 609 return ret;
612} 610}
613 611
614static resource_size_t 612static resource_size_t
@@ -619,29 +617,28 @@ pcmcia_align(void *align_data, const struct resource *res,
619 struct resource_map *m; 617 struct resource_map *m;
620 resource_size_t start; 618 resource_size_t start;
621 619
622 start = pcmcia_common_align(data, res, size, align); 620 start = pcmcia_common_align(data, res->start);
623 621
624 for (m = data->map->next; m != data->map; m = m->next) { 622 for (m = data->map->next; m != data->map; m = m->next) {
625 unsigned long start = m->base; 623 unsigned long map_start = m->base;
626 unsigned long end = m->base + m->num - 1; 624 unsigned long map_end = m->base + m->num - 1;
627 625
628 /* 626 /*
629 * If the lower resources are not available, try aligning 627 * If the lower resources are not available, try aligning
630 * to this entry of the resource database to see if it'll 628 * to this entry of the resource database to see if it'll
631 * fit here. 629 * fit here.
632 */ 630 */
633 if (res->start < start) { 631 if (start < map_start)
634 start = pcmcia_common_align(data, res, size, align); 632 start = pcmcia_common_align(data, map_start);
635 }
636 633
637 /* 634 /*
638 * If we're above the area which was passed in, there's 635 * If we're above the area which was passed in, there's
639 * no point proceeding. 636 * no point proceeding.
640 */ 637 */
641 if (res->start >= res->end) 638 if (start >= res->end)
642 break; 639 break;
643 640
644 if ((res->start + size - 1) <= end) 641 if ((start + size - 1) <= map_end)
645 break; 642 break;
646 } 643 }
647 644