diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-11-02 20:45:48 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-12-03 00:11:36 -0500 |
commit | 8cbe71a6e70b5439ae60bd542231c4b8878a8f1c (patch) | |
tree | 3539dd410ffaf0040735d96a1b4ae50ae0f1e70d /drivers/gpu/drm/nouveau/nouveau_util.c | |
parent | 19b7fc7bf59f4bf02ee738a79baaccae31220df3 (diff) |
drm/nouveau: move bitfield/enum helpers to nouveau_util.c
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_util.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_util.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_util.c b/drivers/gpu/drm/nouveau/nouveau_util.c index e8b1eaaa212b..fbe0fb13bc1e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_util.c +++ b/drivers/gpu/drm/nouveau/nouveau_util.c | |||
@@ -27,8 +27,41 @@ | |||
27 | 27 | ||
28 | #include <linux/ratelimit.h> | 28 | #include <linux/ratelimit.h> |
29 | 29 | ||
30 | #include "nouveau_util.h" | ||
31 | |||
30 | static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20); | 32 | static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20); |
31 | 33 | ||
34 | void | ||
35 | nouveau_bitfield_print(const struct nouveau_bitfield *bf, u32 value) | ||
36 | { | ||
37 | while (bf->name) { | ||
38 | if (value & bf->mask) { | ||
39 | printk(" %s", bf->name); | ||
40 | value &= ~bf->mask; | ||
41 | } | ||
42 | |||
43 | bf++; | ||
44 | } | ||
45 | |||
46 | if (value) | ||
47 | printk(" (unknown bits 0x%08x)", value); | ||
48 | } | ||
49 | |||
50 | void | ||
51 | nouveau_enum_print(const struct nouveau_enum *en, u32 value) | ||
52 | { | ||
53 | while (en->name) { | ||
54 | if (value == en->value) { | ||
55 | printk("%s", en->name); | ||
56 | return; | ||
57 | } | ||
58 | |||
59 | en++; | ||
60 | } | ||
61 | |||
62 | printk("(unknown enum 0x%08x)", value); | ||
63 | } | ||
64 | |||
32 | int | 65 | int |
33 | nouveau_ratelimit(void) | 66 | nouveau_ratelimit(void) |
34 | { | 67 | { |