X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fvideo%2Facornfb.c;h=61a8bf159cb0d2eb0464915b3be43ec7381c45fb;hb=refs%2Fheads%2Fvserver;hp=d91a2f8ddb395b02174ef0dba750245ce7362111;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index d91a2f8dd..61a8bf159 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c @@ -17,7 +17,6 @@ * - Blanking 8bpp displays with VIDC */ -#include #include #include #include @@ -26,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -883,7 +882,7 @@ acornfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) * Note that we are entered with the kernel locked. */ static int -acornfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) +acornfb_mmap(struct fb_info *info, struct vm_area_struct *vma) { unsigned long off, start; u32 len; @@ -909,7 +908,7 @@ acornfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma * some updates to the screen occasionally, but process switches * should cause the caches and buffers to be flushed often enough. */ - if (io_remap_page_range(vma, vma->vm_start, off, + if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; @@ -926,7 +925,6 @@ static struct fb_ops acornfb_ops = { .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, .fb_mmap = acornfb_mmap, - .fb_cursor = soft_cursor, }; /* @@ -1010,7 +1008,7 @@ static void __init acornfb_init_fbinfo(void) first = 0; fb_info.fbops = &acornfb_ops; - fb_info.flags = FBINFO_FLAG_DEFAULT; + fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; fb_info.pseudo_palette = current_par.pseudo_palette; strcpy(fb_info.fix.id, "Acorn"); @@ -1246,6 +1244,8 @@ acornfb_detect_monitortype(void) /* * This enables the unused memory to be freed on older Acorn machines. + * We are freeing memory on behalf of the architecture initialisation + * code here. */ static inline void free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) @@ -1268,7 +1268,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) */ page = virt_to_page(virtual_start); ClearPageReserved(page); - atomic_set(&page->count, 1); + init_page_count(page); free_page(virtual_start); virtual_start += PAGE_SIZE; @@ -1278,21 +1278,20 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) printk("acornfb: freed %dK memory\n", mb_freed); } -static struct device acornfb_device = { - .bus_id = "acornfb", - .coherent_dma_mask = 0xffffffff, -}; - -int __init -acornfb_init(void) +static int __init acornfb_probe(struct platform_device *dev) { unsigned long size; u_int h_sync, v_sync; int rc, i; + char *option = NULL; + + if (fb_get_options("acornfb", &option)) + return -ENODEV; + acornfb_setup(option); acornfb_init_fbinfo(); - current_par.dev = &acornfb_device; + current_par.dev = &dev->dev; if (current_par.montype == -1) current_par.montype = acornfb_detect_monitortype(); @@ -1308,7 +1307,7 @@ acornfb_init(void) /* * Try to select a suitable default mode */ - for (i = 0; i < sizeof(modedb) / sizeof(*modedb); i++) { + for (i = 0; i < ARRAY_SIZE(modedb); i++) { unsigned long hs; hs = modedb[i].refresh * @@ -1325,7 +1324,6 @@ acornfb_init(void) } } - fb_info.currcon = -1; fb_info.screen_base = (char *)SCREEN_BASE; fb_info.fix.smem_start = SCREEN_START; current_par.using_vram = 0; @@ -1381,7 +1379,7 @@ acornfb_init(void) */ free_unused_pages(PAGE_OFFSET + size, PAGE_OFFSET + MAX_SIZE); #endif - + fb_info.fix.smem_len = size; current_par.palette_size = VIDC_PALETTE_SIZE; @@ -1392,7 +1390,7 @@ acornfb_init(void) */ do { rc = fb_find_mode(&fb_info.var, &fb_info, NULL, modedb, - sizeof(modedb) / sizeof(*modedb), + ARRAY_SIZE(modedb), &acornfb_default_mode, DEFAULT_BPP); /* * If we found an exact match, all ok. @@ -1409,7 +1407,7 @@ acornfb_init(void) break; rc = fb_find_mode(&fb_info.var, &fb_info, NULL, modedb, - sizeof(modedb) / sizeof(*modedb), + ARRAY_SIZE(modedb), &acornfb_default_mode, DEFAULT_BPP); if (rc) break; @@ -1454,6 +1452,20 @@ acornfb_init(void) return 0; } +static struct platform_driver acornfb_driver = { + .probe = acornfb_probe, + .driver = { + .name = "acornfb", + }, +}; + +static int __init acornfb_init(void) +{ + return platform_driver_register(&acornfb_driver); +} + +module_init(acornfb_init); + MODULE_AUTHOR("Russell King"); MODULE_DESCRIPTION("VIDC 1/1a/20 framebuffer driver"); MODULE_LICENSE("GPL");