diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2009-01-09 15:27:09 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-10 21:44:32 -0500 |
commit | 67d347245f76a149c45bffb1a10145d31d61d1da (patch) | |
tree | dfae6abddf0090eabfcdbc4799914dfadf78c902 /kernel | |
parent | 34a148bf0911a4a1cae85f8ecba57affb4d76aee (diff) |
kernel/trace/ring_buffer.c: use DIV_ROUND_UP
Instead of open-coding it.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ring_buffer.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 9542990f515b..4832ffa5d937 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -123,8 +123,7 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts) | |||
123 | EXPORT_SYMBOL_GPL(ring_buffer_normalize_time_stamp); | 123 | EXPORT_SYMBOL_GPL(ring_buffer_normalize_time_stamp); |
124 | 124 | ||
125 | #define RB_EVNT_HDR_SIZE (sizeof(struct ring_buffer_event)) | 125 | #define RB_EVNT_HDR_SIZE (sizeof(struct ring_buffer_event)) |
126 | #define RB_ALIGNMENT_SHIFT 2 | 126 | #define RB_ALIGNMENT 4U |
127 | #define RB_ALIGNMENT (1 << RB_ALIGNMENT_SHIFT) | ||
128 | #define RB_MAX_SMALL_DATA 28 | 127 | #define RB_MAX_SMALL_DATA 28 |
129 | 128 | ||
130 | enum { | 129 | enum { |
@@ -151,7 +150,7 @@ rb_event_length(struct ring_buffer_event *event) | |||
151 | 150 | ||
152 | case RINGBUF_TYPE_DATA: | 151 | case RINGBUF_TYPE_DATA: |
153 | if (event->len) | 152 | if (event->len) |
154 | length = event->len << RB_ALIGNMENT_SHIFT; | 153 | length = event->len * RB_ALIGNMENT; |
155 | else | 154 | else |
156 | length = event->array[0]; | 155 | length = event->array[0]; |
157 | return length + RB_EVNT_HDR_SIZE; | 156 | return length + RB_EVNT_HDR_SIZE; |
@@ -937,15 +936,11 @@ rb_update_event(struct ring_buffer_event *event, | |||
937 | break; | 936 | break; |
938 | 937 | ||
939 | case RINGBUF_TYPE_TIME_EXTEND: | 938 | case RINGBUF_TYPE_TIME_EXTEND: |
940 | event->len = | 939 | event->len = DIV_ROUND_UP(RB_LEN_TIME_EXTEND, RB_ALIGNMENT); |
941 | (RB_LEN_TIME_EXTEND + (RB_ALIGNMENT-1)) | ||
942 | >> RB_ALIGNMENT_SHIFT; | ||
943 | break; | 940 | break; |
944 | 941 | ||
945 | case RINGBUF_TYPE_TIME_STAMP: | 942 | case RINGBUF_TYPE_TIME_STAMP: |
946 | event->len = | 943 | event->len = DIV_ROUND_UP(RB_LEN_TIME_STAMP, RB_ALIGNMENT); |
947 | (RB_LEN_TIME_STAMP + (RB_ALIGNMENT-1)) | ||
948 | >> RB_ALIGNMENT_SHIFT; | ||
949 | break; | 944 | break; |
950 | 945 | ||
951 | case RINGBUF_TYPE_DATA: | 946 | case RINGBUF_TYPE_DATA: |
@@ -954,9 +949,7 @@ rb_update_event(struct ring_buffer_event *event, | |||
954 | event->len = 0; | 949 | event->len = 0; |
955 | event->array[0] = length; | 950 | event->array[0] = length; |
956 | } else | 951 | } else |
957 | event->len = | 952 | event->len = DIV_ROUND_UP(length, RB_ALIGNMENT); |
958 | (length + (RB_ALIGNMENT-1)) | ||
959 | >> RB_ALIGNMENT_SHIFT; | ||
960 | break; | 953 | break; |
961 | default: | 954 | default: |
962 | BUG(); | 955 | BUG(); |