diff options
author | Robert Richter <robert.richter@amd.com> | 2008-12-16 10:19:54 -0500 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2008-12-29 09:19:19 -0500 |
commit | 9966718daee592fbdc523703b2d8200009642506 (patch) | |
tree | 8f2509353e8e22fbeb52112f4b0bcd9152553a12 /drivers/oprofile/cpu_buffer.h | |
parent | 6d2c53f3cd81e33eec17aa99845d43e599986982 (diff) |
oprofile: remove ring buffer inline functions in cpu_buffer.h
This patch moves ring buffer inline functions to cpu_buffer.c.
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers/oprofile/cpu_buffer.h')
-rw-r--r-- | drivers/oprofile/cpu_buffer.h | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h index 83d491e273fe..cd28abc06960 100644 --- a/drivers/oprofile/cpu_buffer.h +++ b/drivers/oprofile/cpu_buffer.h | |||
@@ -54,8 +54,6 @@ struct oprofile_cpu_buffer { | |||
54 | struct delayed_work work; | 54 | struct delayed_work work; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | extern struct ring_buffer *op_ring_buffer_read; | ||
58 | extern struct ring_buffer *op_ring_buffer_write; | ||
59 | DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer); | 57 | DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer); |
60 | 58 | ||
61 | /* | 59 | /* |
@@ -72,50 +70,10 @@ static inline void op_cpu_buffer_reset(int cpu) | |||
72 | cpu_buf->last_task = NULL; | 70 | cpu_buf->last_task = NULL; |
73 | } | 71 | } |
74 | 72 | ||
75 | static inline int op_cpu_buffer_write_entry(struct op_entry *entry) | 73 | int op_cpu_buffer_write_entry(struct op_entry *entry); |
76 | { | 74 | int op_cpu_buffer_write_commit(struct op_entry *entry); |
77 | entry->event = ring_buffer_lock_reserve(op_ring_buffer_write, | 75 | struct op_sample *op_cpu_buffer_read_entry(int cpu); |
78 | sizeof(struct op_sample), | 76 | unsigned long op_cpu_buffer_entries(int cpu); |
79 | &entry->irq_flags); | ||
80 | if (entry->event) | ||
81 | entry->sample = ring_buffer_event_data(entry->event); | ||
82 | else | ||
83 | entry->sample = NULL; | ||
84 | |||
85 | if (!entry->sample) | ||
86 | return -ENOMEM; | ||
87 | |||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | static inline int op_cpu_buffer_write_commit(struct op_entry *entry) | ||
92 | { | ||
93 | return ring_buffer_unlock_commit(op_ring_buffer_write, entry->event, | ||
94 | entry->irq_flags); | ||
95 | } | ||
96 | |||
97 | static inline struct op_sample *op_cpu_buffer_read_entry(int cpu) | ||
98 | { | ||
99 | struct ring_buffer_event *e; | ||
100 | e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL); | ||
101 | if (e) | ||
102 | return ring_buffer_event_data(e); | ||
103 | if (ring_buffer_swap_cpu(op_ring_buffer_read, | ||
104 | op_ring_buffer_write, | ||
105 | cpu)) | ||
106 | return NULL; | ||
107 | e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL); | ||
108 | if (e) | ||
109 | return ring_buffer_event_data(e); | ||
110 | return NULL; | ||
111 | } | ||
112 | |||
113 | /* "acquire" as many cpu buffer slots as we can */ | ||
114 | static inline unsigned long op_cpu_buffer_entries(int cpu) | ||
115 | { | ||
116 | return ring_buffer_entries_cpu(op_ring_buffer_read, cpu) | ||
117 | + ring_buffer_entries_cpu(op_ring_buffer_write, cpu); | ||
118 | } | ||
119 | 77 | ||
120 | /* transient events for the CPU buffer -> event buffer */ | 78 | /* transient events for the CPU buffer -> event buffer */ |
121 | #define CPU_IS_KERNEL 1 | 79 | #define CPU_IS_KERNEL 1 |