summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-09-14 12:12:11 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-14 12:12:11 +0100
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 9cb7c98afb9..dedf05dc433 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,
return addr | bridge->driver->masks[type].mask;
}
-static struct aper_size_info_fixed intel_fake_agp_sizes[] =
-{
+static const struct aper_size_info_fixed const intel_fake_agp_sizes[] = {
{128, 32768, 5},
/* The 64M mode still requires a 128k gatt */
{64, 16384, 5},
@@ -833,16 +832,17 @@ static int intel_gtt_init(void)
static int intel_fake_agp_fetch_size(void)
{
+ int num_sizes = ARRAY_SIZE(intel_fake_agp_sizes);
unsigned int aper_size;
int i;
- int num_sizes = ARRAY_SIZE(intel_fake_agp_sizes);
aper_size = (intel_private.base.gtt_mappable_entries << PAGE_SHIFT)
/ MB(1);
for (i = 0; i < num_sizes; i++) {
if (aper_size == intel_fake_agp_sizes[i].size) {
- agp_bridge->current_size = intel_fake_agp_sizes + i;
+ agp_bridge->current_size =
+ (void *) (intel_fake_agp_sizes + i);
return aper_size;
}
}
@@ -1363,9 +1363,9 @@ static const struct agp_bridge_driver intel_810_driver = {
static const struct agp_bridge_driver intel_830_driver = {
.owner = THIS_MODULE,
- .aperture_sizes = intel_fake_agp_sizes,
.size_type = FIXED_APER_SIZE,
- .num_aperture_sizes = 4,
+ .aperture_sizes = intel_fake_agp_sizes,
+ .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
.needs_scratch_page = true,
.configure = intel_i830_configure,
.fetch_size = intel_fake_agp_fetch_size,
@@ -1390,9 +1390,9 @@ static const struct agp_bridge_driver intel_830_driver = {
static const struct agp_bridge_driver intel_915_driver = {
.owner = THIS_MODULE,
- .aperture_sizes = intel_fake_agp_sizes,
.size_type = FIXED_APER_SIZE,
- .num_aperture_sizes = 4,
+ .aperture_sizes = intel_fake_agp_sizes,
+ .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
.needs_scratch_page = true,
.configure = intel_i9xx_configure,
.fetch_size = intel_fake_agp_fetch_size,
@@ -1423,9 +1423,9 @@ static const struct agp_bridge_driver intel_915_driver = {
static const struct agp_bridge_driver intel_i965_driver = {
.owner = THIS_MODULE,
- .aperture_sizes = intel_fake_agp_sizes,
.size_type = FIXED_APER_SIZE,
- .num_aperture_sizes = 4,
+ .aperture_sizes = intel_fake_agp_sizes,
+ .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
.needs_scratch_page = true,
.configure = intel_i9xx_configure,
.fetch_size = intel_fake_agp_fetch_size,
@@ -1456,9 +1456,9 @@ static const struct agp_bridge_driver intel_i965_driver = {
static const struct agp_bridge_driver intel_gen6_driver = {
.owner = THIS_MODULE,
- .aperture_sizes = intel_fake_agp_sizes,
.size_type = FIXED_APER_SIZE,
- .num_aperture_sizes = 4,
+ .aperture_sizes = intel_fake_agp_sizes,
+ .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
.needs_scratch_page = true,
.configure = intel_i9xx_configure,
.fetch_size = intel_fake_agp_fetch_size,
@@ -1489,9 +1489,9 @@ static const struct agp_bridge_driver intel_gen6_driver = {
static const struct agp_bridge_driver intel_g33_driver = {
.owner = THIS_MODULE,
- .aperture_sizes = intel_fake_agp_sizes,
.size_type = FIXED_APER_SIZE,
- .num_aperture_sizes = 4,
+ .aperture_sizes = intel_fake_agp_sizes,
+ .num_aperture_sizes = ARRAY_SIZE(intel_fake_agp_sizes),
.needs_scratch_page = true,
.configure = intel_i9xx_configure,
.fetch_size = intel_fake_agp_fetch_size,