diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-05 05:20:33 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-05 05:20:33 -0400 |
commit | d0bd99299bf933ae006d2dc6a31ffcba482ae3f2 (patch) | |
tree | 62615ed8bc6ab68f42b59d412a7fd7ac77c79803 /drivers/char/drm/drm_scatter.c | |
parent | 6f1062330499cee10396bf3fc66a03eb228c5fad (diff) | |
parent | 586a4ac509b041df55f26c2b26cd7cbdaf9b045d (diff) |
/spare/repo/libata-dev branch 'iomap-try3'
Diffstat (limited to 'drivers/char/drm/drm_scatter.c')
-rw-r--r-- | drivers/char/drm/drm_scatter.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/char/drm/drm_scatter.c b/drivers/char/drm/drm_scatter.c index 54fddb6ea2d1..ed267d49bc6a 100644 --- a/drivers/char/drm/drm_scatter.c +++ b/drivers/char/drm/drm_scatter.c @@ -61,6 +61,12 @@ void drm_sg_cleanup( drm_sg_mem_t *entry ) DRM_MEM_SGLISTS ); } +#ifdef _LP64 +# define ScatterHandle(x) (unsigned int)((x >> 32) + (x & ((1L << 32) - 1))) +#else +# define ScatterHandle(x) (unsigned int)(x) +#endif + int drm_sg_alloc( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ) { @@ -133,12 +139,13 @@ int drm_sg_alloc( struct inode *inode, struct file *filp, */ memset( entry->virtual, 0, pages << PAGE_SHIFT ); - entry->handle = (unsigned long)entry->virtual; + entry->handle = ScatterHandle((unsigned long)entry->virtual); DRM_DEBUG( "sg alloc handle = %08lx\n", entry->handle ); DRM_DEBUG( "sg alloc virtual = %p\n", entry->virtual ); - for ( i = entry->handle, j = 0 ; j < pages ; i += PAGE_SIZE, j++ ) { + for (i = (unsigned long)entry->virtual, j = 0; j < pages; + i += PAGE_SIZE, j++) { entry->pagelist[j] = vmalloc_to_page((void *)i); if (!entry->pagelist[j]) goto failed; |