X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fvideo%2Fvfb.c;h=a9b99b01bd8e377f2656058bd29b09accb7ef6ea;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=8b01918a540c95022700c3f8198a2909ded6d958;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index 8b01918a5..a9b99b01b 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c @@ -15,11 +15,12 @@ #include #include #include -#include #include #include #include #include +#include + #include #include #include @@ -35,7 +36,7 @@ static void *videomemory; static u_long videomemorysize = VIDEOMEMSIZE; -MODULE_PARM(videomemorysize, "l"); +module_param(videomemorysize, ulong, 0); static struct fb_var_screeninfo vfb_default __initdata = { .xres = 640, @@ -70,13 +71,7 @@ static struct fb_fix_screeninfo vfb_fix __initdata = { }; static int vfb_enable __initdata = 0; /* disabled by default */ -MODULE_PARM(vfb_enable, "i"); - - /* - * Interface used by the world - */ -int vfb_init(void); -int vfb_setup(char *); +module_param(vfb_enable, bool, 0); static int vfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info); @@ -85,7 +80,7 @@ static int vfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info); static int vfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); -static int vfb_mmap(struct fb_info *info, struct file *file, +static int vfb_mmap(struct fb_info *info, struct vm_area_struct *vma); static struct fb_ops vfb_ops = { @@ -96,7 +91,6 @@ static struct fb_ops vfb_ops = { .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, - .fb_cursor = soft_cursor, .fb_mmap = vfb_mmap, }; @@ -373,13 +367,14 @@ static int vfb_pan_display(struct fb_var_screeninfo *var, * Most drivers don't need their own mmap function */ -static int vfb_mmap(struct fb_info *info, struct file *file, +static int vfb_mmap(struct fb_info *info, struct vm_area_struct *vma) { return -EINVAL; } -int __init vfb_setup(char *options) +#ifndef MODULE +static int __init vfb_setup(char *options) { char *this_opt; @@ -396,19 +391,14 @@ int __init vfb_setup(char *options) } return 1; } +#endif /* MODULE */ /* * Initialisation */ -static void vfb_platform_release(struct device *device) +static int __init vfb_probe(struct platform_device *dev) { - // This is called when the reference count goes to zero. -} - -static int __init vfb_probe(struct device *device) -{ - struct platform_device *dev = to_platform_device(device); struct fb_info *info; int retval = -ENOMEM; @@ -430,7 +420,7 @@ static int __init vfb_probe(struct device *device) if (!info) goto err; - info->screen_base = videomemory; + info->screen_base = (char __iomem *)videomemory; info->fbops = &vfb_ops; retval = fb_find_mode(&info->var, info, NULL, @@ -450,7 +440,7 @@ static int __init vfb_probe(struct device *device) retval = register_framebuffer(info); if (retval < 0) goto err2; - dev_set_drvdata(&dev->dev, info); + platform_set_drvdata(dev, info); printk(KERN_INFO "fb%d: Virtual frame buffer device, using %ldK of video memory\n", @@ -465,9 +455,9 @@ err: return retval; } -static int vfb_remove(struct device *device) +static int vfb_remove(struct platform_device *dev) { - struct fb_info *info = dev_get_drvdata(device); + struct fb_info *info = platform_get_drvdata(dev); if (info) { unregister_framebuffer(info); @@ -477,46 +467,59 @@ static int vfb_remove(struct device *device) return 0; } -static struct device_driver vfb_driver = { - .name = "vfb", - .bus = &platform_bus_type, +static struct platform_driver vfb_driver = { .probe = vfb_probe, .remove = vfb_remove, + .driver = { + .name = "vfb", + }, }; -static struct platform_device vfb_device = { - .name = "vfb", - .id = 0, - .dev = { - .release = vfb_platform_release, - } -}; +static struct platform_device *vfb_device; -int __init vfb_init(void) +static int __init vfb_init(void) { int ret = 0; +#ifndef MODULE + char *option = NULL; + + if (fb_get_options("vfb", &option)) + return -ENODEV; + vfb_setup(option); +#endif + if (!vfb_enable) return -ENXIO; - ret = driver_register(&vfb_driver); + ret = platform_driver_register(&vfb_driver); if (!ret) { - ret = platform_device_register(&vfb_device); - if (ret) - driver_unregister(&vfb_driver); + vfb_device = platform_device_alloc("vfb", 0); + + if (vfb_device) + ret = platform_device_add(vfb_device); + else + ret = -ENOMEM; + + if (ret) { + platform_device_put(vfb_device); + platform_driver_unregister(&vfb_driver); + } } + return ret; } +module_init(vfb_init); + #ifdef MODULE static void __exit vfb_exit(void) { - platform_device_unregister(&vfb_device); - driver_unregister(&vfb_driver); + platform_device_unregister(vfb_device); + platform_driver_unregister(&vfb_driver); } -module_init(vfb_init); module_exit(vfb_exit); MODULE_LICENSE("GPL");