Re: [PATCH] tdfxfb: mtrr support
From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2007-07-29 23:16:52
On Sun, 2007-07-29 at 23:06 +0200, Krzysztof Helt wrote:
quoted hunk ↗ jump to hunk
From: Krzysztof Helt <redacted> 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.--- linux-2.6.22.old/drivers/video/tdfxfb.c 2007-07-28 23:37:00.000000000 +0200 +++ linux-2.6.22/drivers/video/tdfxfb.c 2007-07-28 23:35:49.000000000 +0200@@ -67,7 +67,9 @@ #include <linux/init.h> #include <linux/pci.h> #include <asm/io.h> -#include <linux/spinlock.h> +#ifdef CONFIG_MTRR +#include <asm/mtrr.h> +#endif #include <video/tdfx.h>@@ -150,7 +152,11 @@ MODULE_DEVICE_TABLE(pci, tdfxfb_id_table static int nopan; static int nowrap = 1; /* not implemented (yet) */ static int hwcursor = 1; -static char *mode_option __devinitdata = NULL; +static char *mode_option __devinitdata; +/* mtrr option */ +#ifdef CONFIG_MTRR +static int nomtrr __devinitdata; +#endif /* ------------------------------------------------------------------------- * Hardware-specific funcions@@ -1227,6 +1233,14 @@ static int __devinit tdfxfb_probe(struct printk("fb: %s memory = %dK\n", tdfx_fix.id, tdfx_fix.smem_len >> 10); +#ifdef CONFIG_MTRR + 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); +#endif +
Since akpm already commented against using #ifdef's within functions,
might as well modify the patch to something like this:
#ifdef CONFIG_MTRR
static inline void tdfxfb_mtrr_add(struct fb_info *info)
{
struct tdfxfb_par *par = info->par;
par->mtrr_handle = mtrr_add(info->fix.smem_start,
info->fix.smem_len,
MTRR_TYPE_WRCOMB, 1);
}
#else
#define tdfxfb_mtrr_add(...) do {} while (0)
#endif
...tdfxfb_probe(...)
{
...
tdfxfb_mtrr_add();
...
}
Tony
-------------------------------------------------------------------------
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/