summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_util.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-11-03 10:45:48 +1000
committerBen Skeggs <bskeggs@redhat.com>2010-12-03 15:11:36 +1000
commit8cbe71a6e70b5439ae60bd542231c4b8878a8f1c (patch)
tree3539dd410ffaf0040735d96a1b4ae50ae0f1e70d /drivers/gpu/drm/nouveau/nouveau_util.c
parent19b7fc7bf59f4bf02ee738a79baaccae31220df3 (diff)
downloadlinux-stable-8cbe71a6e70b5439ae60bd542231c4b8878a8f1c.tar.gz
linux-stable-8cbe71a6e70b5439ae60bd542231c4b8878a8f1c.tar.bz2
linux-stable-8cbe71a6e70b5439ae60bd542231c4b8878a8f1c.zip
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.c33
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 @@
#include <linux/ratelimit.h>
+#include "nouveau_util.h"
+
static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20);
+void
+nouveau_bitfield_print(const struct nouveau_bitfield *bf, u32 value)
+{
+ while (bf->name) {
+ if (value & bf->mask) {
+ printk(" %s", bf->name);
+ value &= ~bf->mask;
+ }
+
+ bf++;
+ }
+
+ if (value)
+ printk(" (unknown bits 0x%08x)", value);
+}
+
+void
+nouveau_enum_print(const struct nouveau_enum *en, u32 value)
+{
+ while (en->name) {
+ if (value == en->value) {
+ printk("%s", en->name);
+ return;
+ }
+
+ en++;
+ }
+
+ printk("(unknown enum 0x%08x)", value);
+}
+
int
nouveau_ratelimit(void)
{