summaryrefslogtreecommitdiffstats
path: root/sys/dev/agp
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-19 23:31:35 +0000
committerpfg <pfg@FreeBSD.org>2016-04-19 23:31:35 +0000
commitea58c6f194dc25f7e2e87f7a36de9b2da5b8b90c (patch)
treea2259b68fbc6b8efd3f39fe16c48b0abcdbd3638 /sys/dev/agp
parent709b38ddd351ffc36e7220351304ff24bbc469e4 (diff)
downloadFreeBSD-src-ea58c6f194dc25f7e2e87f7a36de9b2da5b8b90c.zip
FreeBSD-src-ea58c6f194dc25f7e2e87f7a36de9b2da5b8b90c.tar.gz
dev/agp: use our nitems() macro when it is avaliable through param.h.
Consistently capitalize the macros used in the driver. No functional change.
Diffstat (limited to 'sys/dev/agp')
-rw-r--r--sys/dev/agp/agp.c8
-rw-r--r--sys/dev/agp/agp_ali.c8
-rw-r--r--sys/dev/agp/agp_amd64.c3
3 files changed, 9 insertions, 10 deletions
diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c
index 39caf58..7d024d0 100644
--- a/sys/dev/agp/agp.c
+++ b/sys/dev/agp/agp.c
@@ -185,7 +185,7 @@ static u_int agp_max[][2] = {
{2048, 1920},
{4096, 3932}
};
-#define agp_max_size (sizeof(agp_max) / sizeof(agp_max[0]))
+#define AGP_MAX_SIZE nitems(agp_max)
/**
* Sets the PCI resource which represents the AGP aperture.
@@ -228,12 +228,12 @@ agp_generic_attach(device_t dev)
* uses a heurisitc table from the Linux driver.
*/
memsize = ptoa(realmem) >> 20;
- for (i = 0; i < agp_max_size; i++) {
+ for (i = 0; i < AGP_MAX_SIZE; i++) {
if (memsize <= agp_max[i][0])
break;
}
- if (i == agp_max_size)
- i = agp_max_size - 1;
+ if (i == AGP_MAX_SIZE)
+ i = AGP_MAX_SIZE - 1;
sc->as_maxmem = agp_max[i][1] << 20U;
/*
diff --git a/sys/dev/agp/agp_ali.c b/sys/dev/agp/agp_ali.c
index 8aad840..f44cc89 100644
--- a/sys/dev/agp/agp_ali.c
+++ b/sys/dev/agp/agp_ali.c
@@ -171,7 +171,7 @@ static u_int32_t agp_ali_table[] = {
128*M, /* 9 - invalid */
256*M, /* 10 - invalid */
};
-#define agp_ali_table_size (sizeof(agp_ali_table) / sizeof(agp_ali_table[0]))
+#define AGP_ALI_TABLE_SIZE nitems(agp_ali_table)
static u_int32_t
agp_ali_get_aperture(device_t dev)
@@ -181,7 +181,7 @@ agp_ali_get_aperture(device_t dev)
* I'm not sure this is correct..
*/
int i = pci_read_config(dev, AGP_ALI_ATTBASE, 4) & 0xf;
- if (i >= agp_ali_table_size)
+ if (i >= AGP_ALI_TABLE_SIZE)
return 0;
return agp_ali_table[i];
}
@@ -192,10 +192,10 @@ agp_ali_set_aperture(device_t dev, u_int32_t aperture)
int i;
u_int32_t attbase;
- for (i = 0; i < agp_ali_table_size; i++)
+ for (i = 0; i < AGP_ALI_TABLE_SIZE; i++)
if (agp_ali_table[i] == aperture)
break;
- if (i == agp_ali_table_size)
+ if (i == AGP_ALI_TABLE_SIZE)
return EINVAL;
attbase = pci_read_config(dev, AGP_ALI_ATTBASE, 4);
diff --git a/sys/dev/agp/agp_amd64.c b/sys/dev/agp/agp_amd64.c
index 56784f0..f18a6a5 100644
--- a/sys/dev/agp/agp_amd64.c
+++ b/sys/dev/agp/agp_amd64.c
@@ -274,8 +274,7 @@ static uint32_t agp_amd64_table[] = {
0x80000000, /* 2048 MB */
};
-#define AGP_AMD64_TABLE_SIZE \
- (sizeof(agp_amd64_table) / sizeof(agp_amd64_table[0]))
+#define AGP_AMD64_TABLE_SIZE nitems(agp_amd64_table)
static uint32_t
agp_amd64_get_aperture(device_t dev)
OpenPOWER on IntegriCloud