Re: [PATCH -mm] uvesafb: Don't access VGA registers directly when running on non-x86

2007-09-12 Thread Paul Mundt
On Wed, Sep 12, 2007 at 09:41:51PM +0200, Michal Januszewski wrote:
> The VGA registers are only available at their legacy IO locations on
> x86. Don't try to access them when running on other arches.
> 
> Note that the code accessing them directly is just an optimization
> (limits slow BIOS function calls).  We don't lose any functionality 
> by using BIOS calls instead of it on non-x86.
> 
> Signed-off-by: Michal Januszewski <[EMAIL PROTECTED]>

Looks fine, thanks Michal.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -mm] uvesafb: Don't access VGA registers directly when running on non-x86

2007-09-12 Thread Michal Januszewski
The VGA registers are only available at their legacy IO locations on
x86. Don't try to access them when running on other arches.

Note that the code accessing them directly is just an optimization
(limits slow BIOS function calls).  We don't lose any functionality 
by using BIOS calls instead of it on non-x86.

Signed-off-by: Michal Januszewski <[EMAIL PROTECTED]>
---
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 853323e..b983d26 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -19,8 +19,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#ifdef CONFIG_X86
+#include 
+#endif
 #ifdef CONFIG_MTRR
 #include 
 #endif
@@ -935,6 +937,7 @@ static int uvesafb_setpalette(struct uvesafb_pal_entry 
*entries, int count,
if (start + count > 256)
return -EINVAL;
 
+#ifdef CONFIG_X86
/* Use VGA registers if mode is VGA-compatible. */
if (i >= 0 && i < par->vbe_modes_cnt &&
par->vbe_modes[i].mode_attr & VBE_MODE_VGACOMPAT) {
@@ -957,8 +960,10 @@ static int uvesafb_setpalette(struct uvesafb_pal_entry 
*entries, int count,
  "D" (entries),/* EDI */
  "S" (&par->pmi_pal)); /* ESI */
}
-#endif
-   else {
+#endif /* CONFIG_X86_32 */
+   else
+#endif /* CONFIG_X86 */
+   {
task = uvesafb_prep();
if (!task)
return -ENOMEM;
@@ -1102,6 +1107,7 @@ static int uvesafb_blank(int blank, struct fb_info *info)
struct uvesafb_ktask *task;
int err = 1;
 
+#ifdef CONFIG_X86
if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) {
int loop = 1;
u8 seq = 0, crtc17 = 0;
@@ -1124,7 +1130,9 @@ static int uvesafb_blank(int blank, struct fb_info *info)
while (loop--);
vga_wcrt(NULL, 0x17, crtc17);
vga_wseq(NULL, 0x00, 0x03);
-   } else {
+   } else
+#endif /* CONFIG_X86 */
+   {
task = uvesafb_prep();
if (!task)
return -ENOMEM;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -mm] uvesafb: Don't access VGA registers directly when running on non-x86

2007-09-11 Thread Paul Mundt
On Wed, Sep 12, 2007 at 01:09:59AM +0200, Michal Januszewski wrote:
> The VGA registers are only available at their legacy IO locations on x86.
> Don't try to access them when running on other arches.
> 
> Note that the code accessing them directly is just an optimization (limits
> slow BIOS function calls).  We don't lose any functionality by using
> BIOS calls instead of it on non-x86.
> 
If you do that, then you also have to #ifdef CONFIG_X86 around
video/vga.h, as that drags in asm/vga.h, which does not exist on all
platforms. I have little interest in adding a stub vga.h on my
architectures to support a driver that in practice works on nothing but
x86.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -mm] uvesafb: Don't access VGA registers directly when running on non-x86

2007-09-11 Thread Michal Januszewski
The VGA registers are only available at their legacy IO locations on x86.
Don't try to access them when running on other arches.

Note that the code accessing them directly is just an optimization (limits
slow BIOS function calls).  We don't lose any functionality by using
BIOS calls instead of it on non-x86.

Signed-off-by: Michal Januszewski <[EMAIL PROTECTED]>
---
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 853323e..74fa7c7 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -935,6 +935,7 @@ static int uvesafb_setpalette(struct uvesafb_pal_entry 
*entries, int count,
if (start + count > 256)
return -EINVAL;
 
+#ifdef CONFIG_X86
/* Use VGA registers if mode is VGA-compatible. */
if (i >= 0 && i < par->vbe_modes_cnt &&
par->vbe_modes[i].mode_attr & VBE_MODE_VGACOMPAT) {
@@ -957,8 +958,10 @@ static int uvesafb_setpalette(struct uvesafb_pal_entry 
*entries, int count,
  "D" (entries),/* EDI */
  "S" (&par->pmi_pal)); /* ESI */
}
-#endif
-   else {
+#endif /* CONFIG_X86_32 */
+   else
+#endif /* CONFIG_X86 */
+   {
task = uvesafb_prep();
if (!task)
return -ENOMEM;
@@ -1102,6 +1105,7 @@ static int uvesafb_blank(int blank, struct fb_info *info)
struct uvesafb_ktask *task;
int err = 1;
 
+#ifdef CONFIG_X86
if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) {
int loop = 1;
u8 seq = 0, crtc17 = 0;
@@ -1124,7 +1128,9 @@ static int uvesafb_blank(int blank, struct fb_info *info)
while (loop--);
vga_wcrt(NULL, 0x17, crtc17);
vga_wseq(NULL, 0x00, 0x03);
-   } else {
+   } else
+#endif /* CONFIG_X86 */
+   {
task = uvesafb_prep();
if (!task)
return -ENOMEM;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/