aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-09-14 07:12:11 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-14 07:12:11 -0400
commit9e76e7b8bd716413cfd722a807aa22723f3a895f (patch)
tree3564c55631ee10644aae41783322da09cc2b0711
parent0bc23aad3b67ca0cd7480dec0b7652d9b8686432 (diff)
agp/intel: Use macro to set the count of the size array
It's a fixed size array so let the compiler do the hard work of updating all the call sites. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--drivers/char/agp/intel-gtt.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 9cb7c98afb9c..dedf05dc433d 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -539,8 +539,7 @@ static unsigned long intel_i810_mask_memory(struct agp_bridge_data *bridge,
539 return addr | bridge->driver->masks[type].mask; 539 return addr | bridge->driver->masks[type].mask;
540} 540}
541 541
542static struct aper_size_info_fixed intel_fake_agp_sizes[] = 542static const struct aper_size_info_fixed const intel_fake_agp_sizes[] = {
543{
544 {128, 32768, 5}, 543 {128, 32768, 5},
545 /* The 64M mode still requires a 128k gatt */ 544 /* The 64M mode still requires a 128k gatt */
546 {64, 16384, 5}, 545 {64, 16384, 5},
@@ -833,16 +832,17 @@ static int intel_gtt_init(void)
833 832
834static int intel_fake_agp_fetch_size(void) 833static int intel_fake_agp_fetch_size(void)
835{ 834{
835 int num_sizes = ARRAY_SIZE(intel_fake_agp_sizes);
836 unsigned int aper_size; 836 unsigned int aper_size;
837 int i; 837 int i;
838 int num_sizes = ARRAY_SIZE(intel_fake_agp_sizes);
839 838
840 aper_size = (intel_private.base.gtt_mappable_entries << PAGE_SHIFT) 839 aper_size = (intel_private.base.gtt_mappable_entries << PAGE_SHIFT)
841 / MB(1); 840 / MB(1);
842 841
843 for (i = 0; i < num_sizes; i++) { 842 for (i = 0; i < num_sizes; i++) {
844 if (aper_size == intel_fake_agp_sizes[i].size) { 843 if (aper_size == intel_fake_agp_sizes[i].size) {
845 agp_bridge->current_size = intel_fake_agp_sizes + i; 844 agp_bridge->current_size =
845 (void *) (intel_fake_agp_sizes + i);
846 return aper_size; 846 return aper_size;
847 } 847 }
848 } 848 }
@@ -1363,9 +1363,9 @@ static const struct agp_bridge_driver intel_810_driver = {
1363 1363
1364static const struct agp_bridge_driver intel_830_driver = { 1364static const struct agp_bridge_driver intel_830_driver = {
1365 .owner = THIS_MODULE, 1365 .owner = THIS_MODULE,
1366 .aperture_sizes = intel_fake_agp_sizes,
1367 .size_type = FIXED_APER_SIZE, 1366 .size_type = FIXED_APER_SIZE,
1368 .num_aperture_sizes = 4, 1367 .aperture_sizes = intel_fake_agp_sizes,
1368 .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
1369 .needs_scratch_page = true, 1369 .needs_scratch_page = true,
1370 .configure = intel_i830_configure, 1370 .configure = intel_i830_configure,
1371 .fetch_size = intel_fake_agp_fetch_size, 1371 .fetch_size = intel_fake_agp_fetch_size,
@@ -1390,9 +1390,9 @@ static const struct agp_bridge_driver intel_830_driver = {
1390 1390
1391static const struct agp_bridge_driver intel_915_driver = { 1391static const struct agp_bridge_driver intel_915_driver = {
1392 .owner = THIS_MODULE, 1392 .owner = THIS_MODULE,
1393 .aperture_sizes = intel_fake_agp_sizes,
1394 .size_type = FIXED_APER_SIZE, 1393 .size_type = FIXED_APER_SIZE,
1395 .num_aperture_sizes = 4, 1394 .aperture_sizes = intel_fake_agp_sizes,
1395 .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
1396 .needs_scratch_page = true, 1396 .needs_scratch_page = true,
1397 .configure = intel_i9xx_configure, 1397 .configure = intel_i9xx_configure,
1398 .fetch_size = intel_fake_agp_fetch_size, 1398 .fetch_size = intel_fake_agp_fetch_size,
@@ -1423,9 +1423,9 @@ static const struct agp_bridge_driver intel_915_driver = {
1423 1423
1424static const struct agp_bridge_driver intel_i965_driver = { 1424static const struct agp_bridge_driver intel_i965_driver = {
1425 .owner = THIS_MODULE, 1425 .owner = THIS_MODULE,
1426 .aperture_sizes = intel_fake_agp_sizes,
1427 .size_type = FIXED_APER_SIZE, 1426 .size_type = FIXED_APER_SIZE,
1428 .num_aperture_sizes = 4, 1427 .aperture_sizes = intel_fake_agp_sizes,
1428 .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
1429 .needs_scratch_page = true, 1429 .needs_scratch_page = true,
1430 .configure = intel_i9xx_configure, 1430 .configure = intel_i9xx_configure,
1431 .fetch_size = intel_fake_agp_fetch_size, 1431 .fetch_size = intel_fake_agp_fetch_size,
@@ -1456,9 +1456,9 @@ static const struct agp_bridge_driver intel_i965_driver = {
1456 1456
1457static const struct agp_bridge_driver intel_gen6_driver = { 1457static const struct agp_bridge_driver intel_gen6_driver = {
1458 .owner = THIS_MODULE, 1458 .owner = THIS_MODULE,
1459 .aperture_sizes = intel_fake_agp_sizes,
1460 .size_type = FIXED_APER_SIZE, 1459 .size_type = FIXED_APER_SIZE,
1461 .num_aperture_sizes = 4, 1460 .aperture_sizes = intel_fake_agp_sizes,
1461 .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
1462 .needs_scratch_page = true, 1462 .needs_scratch_page = true,
1463 .configure = intel_i9xx_configure, 1463 .configure = intel_i9xx_configure,
1464 .fetch_size = intel_fake_agp_fetch_size, 1464 .fetch_size = intel_fake_agp_fetch_size,
@@ -1489,9 +1489,9 @@ static const struct agp_bridge_driver intel_gen6_driver = {
1489 1489
1490static const struct agp_bridge_driver intel_g33_driver = { 1490static const struct agp_bridge_driver intel_g33_driver = {
1491 .owner = THIS_MODULE, 1491 .owner = THIS_MODULE,
1492 .aperture_sizes = intel_fake_agp_sizes,
1493 .size_type = FIXED_APER_SIZE, 1492 .size_type = FIXED_APER_SIZE,
1494 .num_aperture_sizes = 4, 1493 .aperture_sizes = intel_fake_agp_sizes,
1494 .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
1495 .needs_scratch_page = true, 1495 .needs_scratch_page = true,
1496 .configure = intel_i9xx_configure, 1496 .configure = intel_i9xx_configure,
1497 .fetch_size = intel_fake_agp_fetch_size, 1497 .fetch_size = intel_fake_agp_fetch_size,