Thread (5 messages) 5 messages, 3 authors, 2007-08-02

Re: [PATCH] tdfxfb: mtrr support (2nd revision)

flat view

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2007-08-02 17:56:25

On Tue, 31 Jul 2007, Krzysztof Helt wrote:
quoted hunk ↗ jump to hunk
This patch adds mtrr support to the tdfxfb driver.
It also kills one redundant include and initialization value.

Signed-off-by: Krzysztof Helt <redacted>

---

This patch requires all previous tdfxfb patches sent to this list.
It reduces ifdefs to only removing unused "nomtrr" parameter from the code.
--- linux-2.6.22/drivers/video/tdfxfb.c	2007-07-31 11:49:16.921420742 +0200
+++ linux-2.6.23/drivers/video/tdfxfb.c	2007-07-31 11:49:46.147086218 +0200
@@ -78,6 +77,24 @@
 #define DPRINTK(a,b...)
 #endif
 
+#ifdef CONFIG_MTRR
+#include <asm/mtrr.h>
+#else
+/* duplicate asm/mtrr.h defines to work on archs without mtrr */
+#define MTRR_TYPE_WRCOMB     1
+
+static __inline__ int mtrr_add (unsigned long base, unsigned long size,
+				unsigned int type, char increment)
+{
+    return -ENODEV;
+}
+static __inline__ int mtrr_del (int reg, unsigned long base,
+				unsigned long size)
+{
+    return -ENODEV;
+}
+#endif
While I like your suggestion to move mtrr.h to the include/asm-generic or
include/linux directory, and redefine all functions as dummies in case
CONFIG_MTRR is not defined, the above are not really dummies, as they
return an error code.
quoted hunk ↗ jump to hunk
@@ -1227,6 +1246,12 @@ static int __devinit tdfxfb_probe(struct
 
 	printk("fb: %s memory = %dK\n", tdfx_fix.id, tdfx_fix.smem_len >> 10);
 
+	default_par->mtrr_handle = -1;
+	if (!nomtrr)
+		default_par->mtrr_handle =
+			mtrr_add(tdfx_fix.smem_start, tdfx_fix.smem_len,
+				 MTRR_TYPE_WRCOMB, 1);
+
... but everything works nicely, because no callers of mttr_{add,del}()
check for actual errors ;-)

In this case it's a bit tricky to have dummies _and_ check for
failures...

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help