8 Feb 03:21
[PATCH 1/5] logger: Change logger_offset() from macro to function
Tim Bird <tim.bird <at> am.sony.com>
2012-02-08 02:21:37 GMT
2012-02-08 02:21:37 GMT
Convert to function and add log as a parameter, rather than relying
on log in the context of the macro.
Signed-off-by: Tim Bird <tim.bird <at> am.sony.com>
---
drivers/staging/android/logger.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index ffc2d04..92456d7 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -60,7 +60,11 @@ struct logger_reader {
};
/* logger_offset - returns index 'n' into the log via (optimized) modulus */
-#define logger_offset(n) ((n) & (log->size - 1))
+size_t logger_offset(struct logger_log *log, size_t n)
+{
+ return n & (log->size-1);
+}
+
/*
* file_get_log - Given a file structure, return the associated log
@@ -137,7 +141,7 @@ static ssize_t do_read_log_to_user(struct logger_log *log,
if (copy_to_user(buf + len, log->buffer, count - len))
return -EFAULT;
- reader->r_off = logger_offset(reader->r_off + count);
(Continue reading)
RSS Feed