Re: [PATCH] fbmem.c on 2.3.25 (had trouble with the other one)

Mordechai T. Abzug (morty@sanctuary.arbutus.md.us)
Wed, 3 Nov 1999 12:28:35 -0500


On Wed, Nov 03, 1999 at 06:35:09PM +1100, Daniel Stone wrote:
> Here's a patch to fix a compile error for fbmem.c - vm_offset is gone. I
> tried Ian Baird's patch, but it didn't work - all the hunks failed. So I
> wrote my own - and it works. If Ian's doesn't work for you, try mine, and
> vice versa.

I'm not a kernel expert, but that doesn't look right. vm_offset was
in bytes, vm_pgoff is in pages (note the change in name). So, where
vm_offset was an rvalue, you need to now say vm_pgoff << PAGE_SHIFT,
and where vm_offset was an lvalue, you need to verify that the code
was treating the rvalue as page-aligned and then say rvalue >>
PAGE_SHIFT. If the code wasn't treating the old rvalue as
page-aligned, you're in trouble.

Does remap_page_range() still take bytes, or should it now be pages?
Looks like it's still bytes. . .

--- linux/drivers/video/fbmem.c.dist Tue Nov 2 18:35:36 1999
+++ linux/drivers/video/fbmem.c Tue Nov 2 19:50:57 1999
@@ -505,9 +505,9 @@
len = (start & ~PAGE_MASK)+fix.smem_len;
start &= PAGE_MASK;
len = (len+~PAGE_MASK) & PAGE_MASK;
- if (vma->vm_offset >= len) {
+ if (vma->vm_pgoff << PAGE_SHIFT >= len) {
/* memory mapped io */
- vma->vm_offset -= len;
+ vma->vm_pgoff -= len >> PAGE_SHIFT;
fb->fb_get_var(&var, PROC_CONSOLE(info), info);
if (var.accel_flags)
return -EINVAL;
@@ -516,11 +516,9 @@
start &= PAGE_MASK;
len = (len+~PAGE_MASK) & PAGE_MASK;
}
- if ((vma->vm_end - vma->vm_start + vma->vm_offset) > len)
+ if ((vma->vm_end - vma->vm_start + (vma->vm_pgoff << PAGE_SHIFT)) > len)
return -EINVAL;
- vma->vm_offset += start;
- if (vma->vm_offset & ~PAGE_MASK)
- return -ENXIO;
+ vma->vm_pgoff += start >> PAGE_SHIFT;
#if defined(__mc68000__)
if (CPU_IS_020_OR_030)
pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
@@ -549,7 +547,7 @@
#else
#warning What do we have to do here??
#endif
- if (io_remap_page_range(vma->vm_start, vma->vm_offset,
+ if (io_remap_page_range(vma->vm_start, vma->vm_pgoff << PAGE_SHIFT,
vma->vm_end - vma->vm_start, vma->vm_page_prot))
return -EAGAIN;
return 0;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/