Commit 67d34724 authored by Andrew Morton's avatar Andrew Morton Committed by Ingo Molnar

kernel/trace/ring_buffer.c: use DIV_ROUND_UP

Instead of open-coding it.
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 34a148bf
...@@ -123,8 +123,7 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts) ...@@ -123,8 +123,7 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts)
EXPORT_SYMBOL_GPL(ring_buffer_normalize_time_stamp); EXPORT_SYMBOL_GPL(ring_buffer_normalize_time_stamp);
#define RB_EVNT_HDR_SIZE (sizeof(struct ring_buffer_event)) #define RB_EVNT_HDR_SIZE (sizeof(struct ring_buffer_event))
#define RB_ALIGNMENT_SHIFT 2 #define RB_ALIGNMENT 4U
#define RB_ALIGNMENT (1 << RB_ALIGNMENT_SHIFT)
#define RB_MAX_SMALL_DATA 28 #define RB_MAX_SMALL_DATA 28
enum { enum {
...@@ -151,7 +150,7 @@ rb_event_length(struct ring_buffer_event *event) ...@@ -151,7 +150,7 @@ rb_event_length(struct ring_buffer_event *event)
case RINGBUF_TYPE_DATA: case RINGBUF_TYPE_DATA:
if (event->len) if (event->len)
length = event->len << RB_ALIGNMENT_SHIFT; length = event->len * RB_ALIGNMENT;
else else
length = event->array[0]; length = event->array[0];
return length + RB_EVNT_HDR_SIZE; return length + RB_EVNT_HDR_SIZE;
...@@ -937,15 +936,11 @@ rb_update_event(struct ring_buffer_event *event, ...@@ -937,15 +936,11 @@ rb_update_event(struct ring_buffer_event *event,
break; break;
case RINGBUF_TYPE_TIME_EXTEND: case RINGBUF_TYPE_TIME_EXTEND:
event->len = event->len = DIV_ROUND_UP(RB_LEN_TIME_EXTEND, RB_ALIGNMENT);
(RB_LEN_TIME_EXTEND + (RB_ALIGNMENT-1))
>> RB_ALIGNMENT_SHIFT;
break; break;
case RINGBUF_TYPE_TIME_STAMP: case RINGBUF_TYPE_TIME_STAMP:
event->len = event->len = DIV_ROUND_UP(RB_LEN_TIME_STAMP, RB_ALIGNMENT);
(RB_LEN_TIME_STAMP + (RB_ALIGNMENT-1))
>> RB_ALIGNMENT_SHIFT;
break; break;
case RINGBUF_TYPE_DATA: case RINGBUF_TYPE_DATA:
...@@ -954,9 +949,7 @@ rb_update_event(struct ring_buffer_event *event, ...@@ -954,9 +949,7 @@ rb_update_event(struct ring_buffer_event *event,
event->len = 0; event->len = 0;
event->array[0] = length; event->array[0] = length;
} else } else
event->len = event->len = DIV_ROUND_UP(length, RB_ALIGNMENT);
(length + (RB_ALIGNMENT-1))
>> RB_ALIGNMENT_SHIFT;
break; break;
default: default:
BUG(); BUG();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment