mmc: bcm2835: Fix DMA channel leak on probe error
[linux/fpc-iii.git] / tools / perf / util / block-range.h
bloba5ba719d69fb1f1440a911dfc182ff46cb69aa6b
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_BLOCK_RANGE_H
3 #define __PERF_BLOCK_RANGE_H
5 #include "symbol.h"
7 /*
8 * struct block_range - non-overlapping parts of basic blocks
9 * @node: treenode
10 * @start: inclusive start of range
11 * @end: inclusive end of range
12 * @is_target: @start is a jump target
13 * @is_branch: @end is a branch instruction
14 * @coverage: number of blocks that cover this range
15 * @taken: number of times the branch is taken (requires @is_branch)
16 * @pred: number of times the taken branch was predicted
18 struct block_range {
19 struct rb_node node;
21 struct symbol *sym;
23 u64 start;
24 u64 end;
26 int is_target, is_branch;
28 u64 coverage;
29 u64 entry;
30 u64 taken;
31 u64 pred;
34 static inline struct block_range *block_range__next(struct block_range *br)
36 struct rb_node *n = rb_next(&br->node);
37 if (!n)
38 return NULL;
39 return rb_entry(n, struct block_range, node);
42 struct block_range_iter {
43 struct block_range *start;
44 struct block_range *end;
47 static inline struct block_range *block_range_iter(struct block_range_iter *iter)
49 return iter->start;
52 static inline bool block_range_iter__next(struct block_range_iter *iter)
54 if (iter->start == iter->end)
55 return false;
57 iter->start = block_range__next(iter->start);
58 return true;
61 static inline bool block_range_iter__valid(struct block_range_iter *iter)
63 if (!iter->start || !iter->end)
64 return false;
65 return true;
68 extern struct block_range *block_range__find(u64 addr);
69 extern struct block_range_iter block_range__create(u64 start, u64 end);
70 extern double block_range__coverage(struct block_range *br);
72 #endif /* __PERF_BLOCK_RANGE_H */