fbdev: move FBIO_WAITFORVSYNC to linux/fb.h
[safe/jmp/linux-2.6] / drivers / video / intelfb / intelfbdrv.c
index 6f9de04..5ba3999 100644 (file)
@@ -2,9 +2,9 @@
  * intelfb
  *
  * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/
- * 945G/945GM integrated graphics chips.
+ * 945G/945GM/945GME/965G/965GM integrated graphics chips.
  *
- * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org>
+ * Copyright Â© 2002, 2003 David Dawes <dawes@xfree86.org>
  *                   2004 Sylvain Meyer
  *                   2006 David Airlie
  *
  *              Fix intelfbhw_pan_display typo
  *              Add __initdata annotations
  *
- * TODO:
- *
- *
- * Wish List:
- *
+ *    04/2008 - Version 0.9.5
+ *              Add support for 965G/965GM. (Maik Broemme <mbroemme@plusserver.de>)
  *
+ *    08/2008 - Version 0.9.6
+ *              Add support for 945GME. (Phil Endecott <spam_from_intelfb@chezphil.org>)
  */
 
 #include <linux/module.h>
@@ -183,10 +182,14 @@ static struct pci_device_id intelfb_pci_table[] __devinitdata = {
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_845G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_845G },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_85XGM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_85XGM },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_865G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_865G },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_854, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_854 },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915G },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915GM },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945G },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945GM },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945GME, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945GME },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_965G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_965G },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_965GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_965GM },
        { 0, }
 };
 
@@ -222,8 +225,8 @@ static struct pci_driver intelfb_driver = {
 /* Module description/parameters */
 MODULE_AUTHOR("David Dawes <dawes@tungstengraphics.com>, "
              "Sylvain Meyer <sylvain.meyer@worldonline.fr>");
-MODULE_DESCRIPTION(
-       "Framebuffer driver for Intel(R) " SUPPORTED_CHIPSETS " chipsets");
+MODULE_DESCRIPTION("Framebuffer driver for Intel(R) " SUPPORTED_CHIPSETS
+                  " chipsets");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_DEVICE_TABLE(pci, intelfb_pci_table);
 
@@ -271,8 +274,7 @@ MODULE_PARM_DESC(mode,
 #define OPT_INTVAL(opt, name) simple_strtoul(opt + strlen(name) + 1, NULL, 0)
 #define OPT_STRVAL(opt, name) (opt + strlen(name))
 
-static __inline__ char *
-get_opt_string(const char *this_opt, const char *name)
+static __inline__ char * get_opt_string(const char *this_opt, const char *name)
 {
        const char *p;
        int i;
@@ -290,8 +292,8 @@ get_opt_string(const char *this_opt, const char *name)
        return ret;
 }
 
-static __inline__ int
-get_opt_int(const char *this_opt, const char *name, int *ret)
+static __inline__ int get_opt_int(const char *this_opt, const char *name,
+                                 int *ret)
 {
        if (!ret)
                return 0;
@@ -303,8 +305,8 @@ get_opt_int(const char *this_opt, const char *name, int *ret)
        return 1;
 }
 
-static __inline__ int
-get_opt_bool(const char *this_opt, const char *name, int *ret)
+static __inline__ int get_opt_bool(const char *this_opt, const char *name,
+                                  int *ret)
 {
        if (!ret)
                return 0;
@@ -324,8 +326,7 @@ get_opt_bool(const char *this_opt, const char *name, int *ret)
        return 1;
 }
 
-static int __init
-intelfb_setup(char *options)
+static int __init intelfb_setup(char *options)
 {
        char *this_opt;
 
@@ -355,7 +356,7 @@ intelfb_setup(char *options)
                        continue;
                if (get_opt_bool(this_opt, "accel", &accel))
                        ;
-               else if (get_opt_int(this_opt, "vram", &vram))
+               else if (get_opt_int(this_opt, "vram", &vram))
                        ;
                else if (get_opt_bool(this_opt, "hwcursor", &hwcursor))
                        ;
@@ -376,8 +377,7 @@ intelfb_setup(char *options)
 
 #endif
 
-static int __init
-intelfb_init(void)
+static int __init intelfb_init(void)
 {
 #ifndef MODULE
        char *option = NULL;
@@ -401,8 +401,7 @@ intelfb_init(void)
        return pci_register_driver(&intelfb_driver);
 }
 
-static void __exit
-intelfb_exit(void)
+static void __exit intelfb_exit(void)
 {
        DBG_MSG("intelfb_exit\n");
        pci_unregister_driver(&intelfb_driver);
@@ -428,8 +427,8 @@ static inline void __devinit set_mtrr(struct intelfb_info *dinfo)
 }
 static inline void unset_mtrr(struct intelfb_info *dinfo)
 {
-       if (dinfo->has_mtrr)
-               mtrr_del(dinfo->mtrr_reg, dinfo->aperture.physical,
+       if (dinfo->has_mtrr)
+               mtrr_del(dinfo->mtrr_reg, dinfo->aperture.physical,
                         dinfo->aperture.size);
 }
 #else
@@ -442,8 +441,7 @@ static inline void unset_mtrr(struct intelfb_info *dinfo)
  *                        driver init / cleanup                *
  ***************************************************************/
 
-static void
-cleanup(struct intelfb_info *dinfo)
+static void cleanup(struct intelfb_info *dinfo)
 {
        DBG_MSG("cleanup\n");
 
@@ -499,8 +497,8 @@ cleanup(struct intelfb_info *dinfo)
 } while (0)
 
 
-static int __devinit
-intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
+static int __devinit intelfb_pci_register(struct pci_dev *pdev,
+                                         const struct pci_device_id *ent)
 {
        struct fb_info *info;
        struct intelfb_info *dinfo;
@@ -510,8 +508,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
        int agp_memtype;
        const char *s;
        struct agp_bridge_data *bridge;
-       int aperture_bar = 0;
-       int mmio_bar = 1;
+       int aperture_bar = 0;
+       int mmio_bar = 1;
        int offset;
 
        DBG_MSG("intelfb_pci_register\n");
@@ -540,12 +538,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
        dinfo->pdev  = pdev;
 
        /* Reserve pixmap space. */
-       info->pixmap.addr = kmalloc(64 * 1024, GFP_KERNEL);
+       info->pixmap.addr = kzalloc(64 * 1024, GFP_KERNEL);
        if (info->pixmap.addr == NULL) {
                ERR_MSG("Cannot reserve pixmap memory.\n");
                goto err_out_pixmap;
        }
-       memset(info->pixmap.addr, 0, 64 * 1024);
 
        /* set early this option because it could be changed by tv encoder
           driver */
@@ -562,7 +559,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
        if ((ent->device == PCI_DEVICE_ID_INTEL_915G) ||
            (ent->device == PCI_DEVICE_ID_INTEL_915GM) ||
            (ent->device == PCI_DEVICE_ID_INTEL_945G)  ||
-           (ent->device == PCI_DEVICE_ID_INTEL_945GM)) {
+           (ent->device == PCI_DEVICE_ID_INTEL_945GM) ||
+           (ent->device == PCI_DEVICE_ID_INTEL_945GME) ||
+           (ent->device == PCI_DEVICE_ID_INTEL_965G) ||
+           (ent->device == PCI_DEVICE_ID_INTEL_965GM)) {
+
                aperture_bar = 2;
                mmio_bar = 0;
        }
@@ -638,9 +639,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
                dinfo->ring.size = RINGBUFFER_SIZE;
                dinfo->ring_tail_mask = dinfo->ring.size - 1;
        }
-       if (dinfo->hwcursor) {
+       if (dinfo->hwcursor)
                dinfo->cursor.size = HW_CURSOR_SIZE;
-       }
 
        /* Use agpgart to manage the GATT */
        if (!(bridge = agp_backend_acquire(pdev))) {
@@ -663,18 +663,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
                offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
 
        /* set the mem offsets - set them after the already used pages */
-       if (dinfo->accel) {
+       if (dinfo->accel)
                dinfo->ring.offset = offset + gtt_info.current_memory;
-       }
-       if (dinfo->hwcursor) {
+       if (dinfo->hwcursor)
                dinfo->cursor.offset = offset +
                        + gtt_info.current_memory + (dinfo->ring.size >> 12);
-       }
-       if (dinfo->fbmem_gart) {
+       if (dinfo->fbmem_gart)
                dinfo->fb.offset = offset +
                        + gtt_info.current_memory + (dinfo->ring.size >> 12)
                        + (dinfo->cursor.size >> 12);
-       }
 
        /* Allocate memories (which aren't stolen) */
        /* Map the fb and MMIO regions */
@@ -690,7 +687,7 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        dinfo->mmio_base =
                (u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
-                                              INTEL_REG_SIZE);
+                                             INTEL_REG_SIZE);
        if (!dinfo->mmio_base) {
                ERR_MSG("Cannot remap MMIO region.\n");
                cleanup(dinfo);
@@ -821,7 +818,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (bailearly == 1)
                bailout(dinfo);
 
-       if (FIXED_MODE(dinfo) && ORIG_VIDEO_ISVGA != VIDEO_TYPE_VLFB) {
+       if (FIXED_MODE(dinfo) &&
+           screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) {
                ERR_MSG("Video mode must be programmed at boot time.\n");
                cleanup(dinfo);
                return -ENODEV;
@@ -832,16 +830,14 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        /* Initialise dinfo and related data. */
        /* If an initial mode was programmed at boot time, get its details. */
-       if (ORIG_VIDEO_ISVGA == VIDEO_TYPE_VLFB)
+       if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB)
                get_initial_mode(dinfo);
 
        if (bailearly == 3)
                bailout(dinfo);
 
-       if (FIXED_MODE(dinfo)) {
-               /* remap fb address */
+       if (FIXED_MODE(dinfo))  /* remap fb address */
                update_dinfo(dinfo, &dinfo->initial_var);
-       }
 
        if (bailearly == 4)
                bailout(dinfo);
@@ -878,6 +874,9 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (bailearly == 18)
                bailout(dinfo);
 
+       /* read active pipe */
+       dinfo->pipe = intelfbhw_active_pipe(&dinfo->save_state);
+
        /* Cursor initialisation */
        if (dinfo->hwcursor) {
                intelfbhw_cursor_init(dinfo);
@@ -940,8 +939,7 @@ intelfb_pci_unregister(struct pci_dev *pdev)
  *                       helper functions                      *
  ***************************************************************/
 
-int __inline__
-intelfb_var_to_depth(const struct fb_var_screeninfo *var)
+int __inline__ intelfb_var_to_depth(const struct fb_var_screeninfo *var)
 {
        DBG_MSG("intelfb_var_to_depth: bpp: %d, green.length is %d\n",
                var->bits_per_pixel, var->green.length);
@@ -957,8 +955,7 @@ intelfb_var_to_depth(const struct fb_var_screeninfo *var)
 }
 
 
-static __inline__ int
-var_to_refresh(const struct fb_var_screeninfo *var)
+static __inline__ int var_to_refresh(const struct fb_var_screeninfo *var)
 {
        int xtot = var->xres + var->left_margin + var->right_margin +
                   var->hsync_len;
@@ -972,8 +969,7 @@ var_to_refresh(const struct fb_var_screeninfo *var)
  *                Various intialisation functions              *
  ***************************************************************/
 
-static void __devinit
-get_initial_mode(struct intelfb_info *dinfo)
+static void __devinit get_initial_mode(struct intelfb_info *dinfo)
 {
        struct fb_var_screeninfo *var;
        int xtot, ytot;
@@ -1040,8 +1036,7 @@ get_initial_mode(struct intelfb_info *dinfo)
        }
 }
 
-static int __devinit
-intelfb_init_var(struct intelfb_info *dinfo)
+static int __devinit intelfb_init_var(struct intelfb_info *dinfo)
 {
        struct fb_var_screeninfo *var;
        int msrc = 0;
@@ -1058,10 +1053,9 @@ intelfb_init_var(struct intelfb_info *dinfo)
                u8 *edid_d = NULL;
 
                if (edid_s) {
-                       edid_d = kmalloc(EDID_LENGTH, GFP_KERNEL);
+                       edid_d = kmemdup(edid_s, EDID_LENGTH, GFP_KERNEL);
 
                        if (edid_d) {
-                               memcpy(edid_d, edid_s, EDID_LENGTH);
                                fb_edid_to_monspecs(edid_d,
                                                    &dinfo->info->monspecs);
                                kfree(edid_d);
@@ -1089,10 +1083,9 @@ intelfb_init_var(struct intelfb_info *dinfo)
 
                }
 
-               if (!msrc) {
+               if (!msrc)
                        msrc = fb_find_mode(var, dinfo->info, PREFERRED_MODE,
                                            NULL, 0, NULL, 0);
-               }
        }
 
        if (!msrc) {
@@ -1124,8 +1117,7 @@ intelfb_init_var(struct intelfb_info *dinfo)
        return 0;
 }
 
-static int __devinit
-intelfb_set_fbinfo(struct intelfb_info *dinfo)
+static int __devinit intelfb_set_fbinfo(struct intelfb_info *dinfo)
 {
        struct fb_info *info = dinfo->info;
 
@@ -1161,8 +1153,8 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo)
 }
 
 /* Update dinfo to match the active video mode. */
-static void
-update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
+static void update_dinfo(struct intelfb_info *dinfo,
+                        struct fb_var_screeninfo *var)
 {
        DBG_MSG("update_dinfo\n");
 
@@ -1210,36 +1202,32 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
  *                       fbdev interface                       *
  ***************************************************************/
 
-static int
-intelfb_open(struct fb_info *info, int user)
+static int intelfb_open(struct fb_info *info, int user)
 {
        struct intelfb_info *dinfo = GET_DINFO(info);
 
-       if (user) {
+       if (user)
                dinfo->open++;
-       }
 
        return 0;
 }
 
-static int
-intelfb_release(struct fb_info *info, int user)
+static int intelfb_release(struct fb_info *info, int user)
 {
        struct intelfb_info *dinfo = GET_DINFO(info);
 
        if (user) {
                dinfo->open--;
                msleep(1);
-               if (!dinfo->open) {
+               if (!dinfo->open)
                        intelfbhw_disable_irq(dinfo);
-               }
        }
 
        return 0;
 }
 
-static int
-intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
+static int intelfb_check_var(struct fb_var_screeninfo *var,
+                            struct fb_info *info)
 {
        int change_var = 0;
        struct fb_var_screeninfo v;
@@ -1273,15 +1261,15 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        }
 
        /* Check for a supported bpp. */
-       if (v.bits_per_pixel <= 8) {
+       if (v.bits_per_pixel <= 8)
                v.bits_per_pixel = 8;
-       else if (v.bits_per_pixel <= 16) {
+       else if (v.bits_per_pixel <= 16) {
                if (v.bits_per_pixel == 16)
                        v.green.length = 6;
                v.bits_per_pixel = 16;
-       } else if (v.bits_per_pixel <= 32) {
+       } else if (v.bits_per_pixel <= 32)
                v.bits_per_pixel = 32;
-       else
+       else
                return -EINVAL;
 
        change_var = ((info->var.xres != var->xres) ||
@@ -1363,10 +1351,9 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        return 0;
 }
 
-static int
-intelfb_set_par(struct fb_info *info)
+static int intelfb_set_par(struct fb_info *info)
 {
-       struct intelfb_hwstate *hw;
+       struct intelfb_hwstate *hw;
         struct intelfb_info *dinfo = GET_DINFO(info);
 
        if (FIXED_MODE(dinfo)) {
@@ -1374,27 +1361,32 @@ intelfb_set_par(struct fb_info *info)
                return -EINVAL;
        }
 
-       hw = kmalloc(sizeof(*hw), GFP_ATOMIC);
-       if (!hw)
-               return -ENOMEM;
+       hw = kmalloc(sizeof(*hw), GFP_ATOMIC);
+       if (!hw)
+               return -ENOMEM;
 
        DBG_MSG("intelfb_set_par (%dx%d-%d)\n", info->var.xres,
                info->var.yres, info->var.bits_per_pixel);
 
+       /*
+        * Disable VCO prior to timing register change.
+        */
+       OUTREG(DPLL_A, INREG(DPLL_A) & ~DPLL_VCO_ENABLE);
+
        intelfb_blank(FB_BLANK_POWERDOWN, info);
 
        if (ACCEL(dinfo, info))
                intelfbhw_2d_stop(dinfo);
 
-       memcpy(hw, &dinfo->save_state, sizeof(*hw));
-       if (intelfbhw_mode_to_hw(dinfo, hw, &info->var))
-               goto invalid_mode;
-       if (intelfbhw_program_mode(dinfo, hw, 0))
-               goto invalid_mode;
+       memcpy(hw, &dinfo->save_state, sizeof(*hw));
+       if (intelfbhw_mode_to_hw(dinfo, hw, &info->var))
+               goto invalid_mode;
+       if (intelfbhw_program_mode(dinfo, hw, 0))
+               goto invalid_mode;
 
 #if REGDUMP > 0
-       intelfbhw_read_hw_state(dinfo, hw, 0);
-       intelfbhw_print_hw_state(dinfo, hw);
+       intelfbhw_read_hw_state(dinfo, hw, 0);
+       intelfbhw_print_hw_state(dinfo, hw);
 #endif
 
        update_dinfo(dinfo, &info->var);
@@ -1410,9 +1402,9 @@ intelfb_set_par(struct fb_info *info)
                info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN |
                FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT |
                FBINFO_HWACCEL_IMAGEBLIT;
-       } else {
+       } else
                info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
-       }
+
        kfree(hw);
        return 0;
 invalid_mode:
@@ -1420,9 +1412,9 @@ invalid_mode:
        return -EINVAL;
 }
 
-static int
-intelfb_setcolreg(unsigned regno, unsigned red, unsigned green,
-                 unsigned blue, unsigned transp, struct fb_info *info)
+static int intelfb_setcolreg(unsigned regno, unsigned red, unsigned green,
+                            unsigned blue, unsigned transp,
+                            struct fb_info *info)
 {
        struct intelfb_info *dinfo = GET_DINFO(info);
 
@@ -1465,23 +1457,22 @@ intelfb_setcolreg(unsigned regno, unsigned red, unsigned green,
        return 0;
 }
 
-static int
-intelfb_blank(int blank, struct fb_info *info)
+static int intelfb_blank(int blank, struct fb_info *info)
 {
        intelfbhw_do_blank(blank, info);
        return 0;
 }
 
-static int
-intelfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
+static int intelfb_pan_display(struct fb_var_screeninfo *var,
+                              struct fb_info *info)
 {
        intelfbhw_pan_display(var, info);
        return 0;
 }
 
 /* When/if we have our own ioctls. */
-static int
-intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
+static int intelfb_ioctl(struct fb_info *info, unsigned int cmd,
+                        unsigned long arg)
 {
        int retval = 0;
        struct intelfb_info *dinfo = GET_DINFO(info);
@@ -1501,8 +1492,8 @@ intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
        return retval;
 }
 
-static void
-intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect)
+static void intelfb_fillrect (struct fb_info *info,
+                             const struct fb_fillrect *rect)
 {
         struct intelfb_info *dinfo = GET_DINFO(info);
        u32 rop, color;
@@ -1511,12 +1502,14 @@ intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect)
        DBG_MSG("intelfb_fillrect\n");
 #endif
 
-       if (!ACCEL(dinfo, info) || dinfo->depth == 4)
-               return cfb_fillrect(info, rect);
+       if (!ACCEL(dinfo, info) || dinfo->depth == 4) {
+               cfb_fillrect(info, rect);
+               return;
+       }
 
        if (rect->rop == ROP_COPY)
                rop = PAT_ROP_GXCOPY;
-       else // ROP_XOR
+       else /* ROP_XOR */
                rop = PAT_ROP_GXXOR;
 
        if (dinfo->depth != 8)
@@ -1530,8 +1523,8 @@ intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect)
                              rop);
 }
 
-static void
-intelfb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
+static void intelfb_copyarea(struct fb_info *info,
+                            const struct fb_copyarea *region)
 {
         struct intelfb_info *dinfo = GET_DINFO(info);
 
@@ -1539,16 +1532,18 @@ intelfb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
        DBG_MSG("intelfb_copyarea\n");
 #endif
 
-       if (!ACCEL(dinfo, info) || dinfo->depth == 4)
-               return cfb_copyarea(info, region);
+       if (!ACCEL(dinfo, info) || dinfo->depth == 4) {
+               cfb_copyarea(info, region);
+               return;
+       }
 
        intelfbhw_do_bitblt(dinfo, region->sx, region->sy, region->dx,
                            region->dy, region->width, region->height,
                            dinfo->pitch, info->var.bits_per_pixel);
 }
 
-static void
-intelfb_imageblit(struct fb_info *info, const struct fb_image *image)
+static void intelfb_imageblit(struct fb_info *info,
+                             const struct fb_image *image)
 {
         struct intelfb_info *dinfo = GET_DINFO(info);
        u32 fgcolor, bgcolor;
@@ -1558,8 +1553,10 @@ intelfb_imageblit(struct fb_info *info, const struct fb_image *image)
 #endif
 
        if (!ACCEL(dinfo, info) || dinfo->depth == 4
-           || image->depth != 1)
-               return cfb_imageblit(info, image);
+           || image->depth != 1) {
+               cfb_imageblit(info, image);
+               return;
+       }
 
        if (dinfo->depth != 8) {
                fgcolor = dinfo->pseudo_palette[image->fg_color];
@@ -1572,12 +1569,13 @@ intelfb_imageblit(struct fb_info *info, const struct fb_image *image)
        if (!intelfbhw_do_drawglyph(dinfo, fgcolor, bgcolor, image->width,
                                    image->height, image->data,
                                    image->dx, image->dy,
-                                   dinfo->pitch, info->var.bits_per_pixel))
-               return cfb_imageblit(info, image);
+                                   dinfo->pitch, info->var.bits_per_pixel)) {
+               cfb_imageblit(info, image);
+               return;
+       }
 }
 
-static int
-intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
+static int intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
 {
         struct intelfb_info *dinfo = GET_DINFO(info);
        u32 physical;
@@ -1691,8 +1689,7 @@ intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
        return 0;
 }
 
-static int
-intelfb_sync(struct fb_info *info)
+static int intelfb_sync(struct fb_info *info)
 {
         struct intelfb_info *dinfo = GET_DINFO(info);