lkml.org 
[lkml]   [2007]   [Apr]   [4]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    FromBenjamin Herrenschmidt <>
    DateWed, 04 Apr 2007 14:02:21 +1000
    Subject[PATCH 12/14] get_unmapped_area handles MAP_FIXED in /dev/mem (nommu)
    This also fixes a bug, I think, it used to return a pgoff (pfn)
    instead of an address. (To split ?)
    
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    ---
     drivers/char/mem.c |    5 ++++-
     1 file changed, 4 insertions(+), 1 deletion(-)
    Index: linux-cell/drivers/char/mem.c
    ===================================================================
    --- linux-cell.orig/drivers/char/mem.c	2007-03-22 16:24:04.000000000 +1100
    +++ linux-cell/drivers/char/mem.c	2007-03-22 16:26:30.000000000 +1100
    @@ -246,9 +246,12 @@ static unsigned long get_unmapped_area_m
     					   unsigned long pgoff,
     					   unsigned long flags)
     {
    +	if (flags & MAP_FIXED)
    +		if ((addr >> PAGE_SHIFT) != pgoff)
    +			return (unsigned long) -EINVAL;
     	if (!valid_mmap_phys_addr_range(pgoff, len))
     		return (unsigned long) -EINVAL;
    -	return pgoff;
    +	return pgoff << PAGE_SHIFT;
     }
     
     /* can't do an in-place private mapping if there's no MMU */
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    
    \
     
     \ /
      Last update: 2007-04-04 06:07    [from the cache]
    ©2003-2008