summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2013-06-23 11:56:13 +0100
committerRussell King <rmk@arm.linux.org.uk>2013-06-23 12:06:30 +0100
commitab1e6647aa7e4a2f2da5196e52ac86884ffde284 (patch)
tree4960b2d8b8cb119a767838fec3d8af0dfa05cad6
parent2f9be2b33130e780a72826598c5bb0a927bc867f (diff)
Turn on compiler warnings and fix them
Fix the "warning: function declaration isn't a prototype" warnings in the bmm_lib code, printf formats in the test code, and make test functions static.
-rw-r--r--Makefile.am2
-rw-r--r--bmm_lib.c12
-rw-r--r--bmm_lib.h12
-rw-r--r--bmm_test.c17
4 files changed, 21 insertions, 22 deletions
diff --git a/Makefile.am b/Makefile.am
index 02ab833..fe67d9c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes $(WARN_CFLAGS)
libbmm_la_LTLIBRARIES = libbmm.la
libbmm_ladir = $(libdir)
diff --git a/bmm_lib.c b/bmm_lib.c
index 6e6f5b5..4bc1e35 100644
--- a/bmm_lib.c
+++ b/bmm_lib.c
@@ -169,7 +169,7 @@ static int bmm_get_api_version(void)
return 0;
}
-int bmm_init()
+int bmm_init(void)
{
if (bmm_fd < 0) {
virt_rb = make_rb();
@@ -202,7 +202,7 @@ int bmm_init()
return bmm_fd;
}
-void bmm_exit()
+void bmm_exit(void)
{
if (bmm_fd >= 0) {
close(bmm_fd);
@@ -460,7 +460,7 @@ int bmm_set_mem_attr(void *vaddr, int attr)
return attr;
}
-unsigned long bmm_get_total_space()
+unsigned long bmm_get_total_space(void)
{
int ret;
ioctl_arg_t io;
@@ -478,7 +478,7 @@ unsigned long bmm_get_total_space()
return io.output;
}
-unsigned long bmm_get_free_space()
+unsigned long bmm_get_free_space(void)
{
int ret;
ioctl_arg_t io;
@@ -496,7 +496,7 @@ unsigned long bmm_get_free_space()
return io.output;
}
-unsigned long bmm_get_allocated_space()
+unsigned long bmm_get_allocated_space(void)
{
int ret;
ioctl_arg_t io;
@@ -557,7 +557,7 @@ void bmm_flush_user(void *start, long size, int direction)
ioctl(bmm_fd, BMM_SYNC_USER, &io);
}
-void bmm_dump()
+void bmm_dump(void)
{
ioctl_arg_t io;
diff --git a/bmm_lib.h b/bmm_lib.h
index 56d9d50..b6fa853 100644
--- a/bmm_lib.h
+++ b/bmm_lib.h
@@ -38,8 +38,8 @@
extern "C" {
#endif
-int bmm_init();
-void bmm_exit();
+int bmm_init(void);
+void bmm_exit(void);
void *bmm_malloc(unsigned long size, int attr);
void *bmm_malloc_aligned(unsigned long size, int attr, unsigned align);
void *bmm_malloc_aligned_phys(unsigned long size, int attr, unsigned align,
@@ -53,13 +53,13 @@ int bmm_get_dmabuf_fd(void *vaddr);
int bmm_get_mem_attr(void *vaddr);
int bmm_set_mem_attr(void *vaddr, int attr); /* Not supported yet */
unsigned long bmm_get_mem_size(void *vaddr);
-unsigned long bmm_get_total_space();
-unsigned long bmm_get_free_space();
-unsigned long bmm_get_allocated_space();
+unsigned long bmm_get_total_space(void);
+unsigned long bmm_get_free_space(void);
+unsigned long bmm_get_allocated_space(void);
void bmm_flush_cache(void *vaddr, int dir);
void bmm_flush_cache_range(void *start, size_t size, int direction);
void bmm_flush_user(void *start, long size, int direction);
-void bmm_dump(); /* for debugging */
+void bmm_dump(void); /* for debugging */
#if defined (__cplusplus)
}
diff --git a/bmm_test.c b/bmm_test.c
index d897aaa..ceadf9c 100644
--- a/bmm_test.c
+++ b/bmm_test.c
@@ -37,7 +37,7 @@ int fail_count = 0;
} while(0)
#define PRINT_TEST_RESULTS() printf("Passed/Failed = %d/%d\n", pass_count, fail_count)
-int test_bmm_init()
+static int test_bmm_init(void)
{
int ret;
@@ -49,7 +49,7 @@ int test_bmm_init()
return (ret <= 0);
}
-int test_bmm_get_space()
+static int test_bmm_get_space(void)
{
unsigned long total_size;
unsigned long free_size;
@@ -65,7 +65,7 @@ int test_bmm_get_space()
return (total_size <= 0 || total_size != free_size);
}
-int test_bmm_malloc(unsigned long size, int attr)
+static int test_bmm_malloc(unsigned long size, int attr)
{
void *vaddr;
unsigned long allocated_size1, free_size1;
@@ -110,7 +110,7 @@ int test_bmm_malloc(unsigned long size, int attr)
free_size1 != free_size3);
}
-long gettickcount(void)
+static long gettickcount(void)
{
struct timeval g_tv;
struct timezone g_tz;
@@ -120,10 +120,9 @@ long gettickcount(void)
return g_tv.tv_sec * 1000000 + g_tv.tv_usec;
}
-int test_bmm_flush_user(long size)
+static int test_bmm_flush_user(unsigned long size)
{
char *src;
- unsigned long offset;
long t1 = 0, t2 = 0;
PRINT_TEST_NAME;
@@ -136,7 +135,7 @@ int test_bmm_flush_user(long size)
t1 = gettickcount();
bmm_flush_user(src, size, BMM_DMA_TO_DEVICE);
t2 = gettickcount();
- printf("bmm_flush_user 0x%x memory cost %dusec\n", size, t2-t1);
+ printf("bmm_flush_user 0x%lx memory cost %ldusec\n", size, t2-t1);
free(src);
src = bmm_malloc(size, BMM_ATTR_DEFAULT);
@@ -147,13 +146,13 @@ int test_bmm_flush_user(long size)
t1 = gettickcount();
bmm_flush_cache_range(src, size, BMM_DMA_TO_DEVICE);
t2 = gettickcount();
- printf("bmm_flush_cache_range 0x%x memory cost %dusec\n", size, t2-t1);
+ printf("bmm_flush_cache_range 0x%lx memory cost %ldusec\n", size, t2-t1);
bmm_free(src);
return 0;
}
-int test_bmm_share(unsigned long size)
+static int test_bmm_share(unsigned long size)
{
char *src;
char *dst;