Commit 6993bea1 authored by Krzysztof Helt's avatar Krzysztof Helt Committed by David S. Miller

[CG6]: code cleanup

This patch:
- corrects coding style errors pointed by Lindent and checkpatch
- replaces space chunks with tabs
- removes one redundant include
- improves indentations of defines
- removes from comments leftovers from skeletonfb
- adds __devinit attribute to two init functions
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d773b339
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/prom.h>
#include <asm/of_device.h> #include <asm/of_device.h>
#include <asm/fbio.h> #include <asm/fbio.h>
...@@ -267,7 +266,7 @@ struct cg6_par { ...@@ -267,7 +266,7 @@ struct cg6_par {
static int cg6_sync(struct fb_info *info) static int cg6_sync(struct fb_info *info)
{ {
struct cg6_par *par = (struct cg6_par *) info->par; struct cg6_par *par = (struct cg6_par *)info->par;
struct cg6_fbc __iomem *fbc = par->fbc; struct cg6_fbc __iomem *fbc = par->fbc;
int limit = 10000; int limit = 10000;
...@@ -281,16 +280,14 @@ static int cg6_sync(struct fb_info *info) ...@@ -281,16 +280,14 @@ static int cg6_sync(struct fb_info *info)
} }
/** /**
* cg6_fillrect - REQUIRED function. Can use generic routines if * cg6_fillrect - Draws a rectangle on the screen.
* non acclerated hardware and packed pixel based.
* Draws a rectangle on the screen.
* *
* @info: frame buffer structure that represents a single frame buffer * @info: frame buffer structure that represents a single frame buffer
* @rect: structure defining the rectagle and operation. * @rect: structure defining the rectagle and operation.
*/ */
static void cg6_fillrect(struct fb_info *info, const struct fb_fillrect *rect) static void cg6_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{ {
struct cg6_par *par = (struct cg6_par *) info->par; struct cg6_par *par = (struct cg6_par *)info->par;
struct cg6_fbc __iomem *fbc = par->fbc; struct cg6_fbc __iomem *fbc = par->fbc;
unsigned long flags; unsigned long flags;
s32 val; s32 val;
...@@ -316,16 +313,14 @@ static void cg6_fillrect(struct fb_info *info, const struct fb_fillrect *rect) ...@@ -316,16 +313,14 @@ static void cg6_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
} }
/** /**
* cg6_imageblit - REQUIRED function. Can use generic routines if * cg6_imageblit - Copies a image from system memory to the screen.
* non acclerated hardware and packed pixel based.
* Copies a image from system memory to the screen.
* *
* @info: frame buffer structure that represents a single frame buffer * @info: frame buffer structure that represents a single frame buffer
* @image: structure defining the image. * @image: structure defining the image.
*/ */
static void cg6_imageblit(struct fb_info *info, const struct fb_image *image) static void cg6_imageblit(struct fb_info *info, const struct fb_image *image)
{ {
struct cg6_par *par = (struct cg6_par *) info->par; struct cg6_par *par = (struct cg6_par *)info->par;
struct cg6_fbc __iomem *fbc = par->fbc; struct cg6_fbc __iomem *fbc = par->fbc;
const u8 *data = image->data; const u8 *data = image->data;
unsigned long flags; unsigned long flags;
...@@ -404,7 +399,8 @@ static void cg6_imageblit(struct fb_info *info, const struct fb_image *image) ...@@ -404,7 +399,8 @@ static void cg6_imageblit(struct fb_info *info, const struct fb_image *image)
} }
/** /**
* cg6_setcolreg - Optional function. Sets a color register. * cg6_setcolreg - Sets a color register.
*
* @regno: boolean, 0 copy local, 1 get_user() function * @regno: boolean, 0 copy local, 1 get_user() function
* @red: frame buffer colormap structure * @red: frame buffer colormap structure
* @green: The green value which can be up to 16 bits wide * @green: The green value which can be up to 16 bits wide
...@@ -416,7 +412,7 @@ static int cg6_setcolreg(unsigned regno, ...@@ -416,7 +412,7 @@ static int cg6_setcolreg(unsigned regno,
unsigned red, unsigned green, unsigned blue, unsigned red, unsigned green, unsigned blue,
unsigned transp, struct fb_info *info) unsigned transp, struct fb_info *info)
{ {
struct cg6_par *par = (struct cg6_par *) info->par; struct cg6_par *par = (struct cg6_par *)info->par;
struct bt_regs __iomem *bt = par->bt; struct bt_regs __iomem *bt = par->bt;
unsigned long flags; unsigned long flags;
...@@ -440,25 +436,24 @@ static int cg6_setcolreg(unsigned regno, ...@@ -440,25 +436,24 @@ static int cg6_setcolreg(unsigned regno,
} }
/** /**
* cg6_blank - Optional function. Blanks the display. * cg6_blank - Blanks the display.
*
* @blank_mode: the blank mode we want. * @blank_mode: the blank mode we want.
* @info: frame buffer structure that represents a single frame buffer * @info: frame buffer structure that represents a single frame buffer
*/ */
static int static int cg6_blank(int blank, struct fb_info *info)
cg6_blank(int blank, struct fb_info *info)
{ {
struct cg6_par *par = (struct cg6_par *) info->par; struct cg6_par *par = (struct cg6_par *)info->par;
struct cg6_thc __iomem *thc = par->thc; struct cg6_thc __iomem *thc = par->thc;
unsigned long flags; unsigned long flags;
u32 val; u32 val;
spin_lock_irqsave(&par->lock, flags); spin_lock_irqsave(&par->lock, flags);
val = sbus_readl(&thc->thc_misc);
switch (blank) { switch (blank) {
case FB_BLANK_UNBLANK: /* Unblanking */ case FB_BLANK_UNBLANK: /* Unblanking */
val = sbus_readl(&thc->thc_misc);
val |= CG6_THC_MISC_VIDEO; val |= CG6_THC_MISC_VIDEO;
sbus_writel(val, &thc->thc_misc);
par->flags &= ~CG6_FLAG_BLANKED; par->flags &= ~CG6_FLAG_BLANKED;
break; break;
...@@ -466,13 +461,12 @@ cg6_blank(int blank, struct fb_info *info) ...@@ -466,13 +461,12 @@ cg6_blank(int blank, struct fb_info *info)
case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */ case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */
case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */ case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */
case FB_BLANK_POWERDOWN: /* Poweroff */ case FB_BLANK_POWERDOWN: /* Poweroff */
val = sbus_readl(&thc->thc_misc);
val &= ~CG6_THC_MISC_VIDEO; val &= ~CG6_THC_MISC_VIDEO;
sbus_writel(val, &thc->thc_misc);
par->flags |= CG6_FLAG_BLANKED; par->flags |= CG6_FLAG_BLANKED;
break; break;
} }
sbus_writel(val, &thc->thc_misc);
spin_unlock_irqrestore(&par->lock, flags); spin_unlock_irqrestore(&par->lock, flags);
return 0; return 0;
...@@ -533,7 +527,7 @@ static int cg6_mmap(struct fb_info *info, struct vm_area_struct *vma) ...@@ -533,7 +527,7 @@ static int cg6_mmap(struct fb_info *info, struct vm_area_struct *vma)
static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
{ {
struct cg6_par *par = (struct cg6_par *) info->par; struct cg6_par *par = (struct cg6_par *)info->par;
return sbusfb_ioctl_helper(cmd, arg, info, return sbusfb_ioctl_helper(cmd, arg, info,
FBTYPE_SUNFAST_COLOR, 8, par->fbsize); FBTYPE_SUNFAST_COLOR, 8, par->fbsize);
...@@ -543,15 +537,14 @@ static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) ...@@ -543,15 +537,14 @@ static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
* Initialisation * Initialisation
*/ */
static void static void __devinit cg6_init_fix(struct fb_info *info, int linebytes)
cg6_init_fix(struct fb_info *info, int linebytes)
{ {
struct cg6_par *par = (struct cg6_par *)info->par; struct cg6_par *par = (struct cg6_par *)info->par;
const char *cg6_cpu_name, *cg6_card_name; const char *cg6_cpu_name, *cg6_card_name;
u32 conf; u32 conf;
conf = sbus_readl(par->fhc); conf = sbus_readl(par->fhc);
switch(conf & CG6_FHC_CPU_MASK) { switch (conf & CG6_FHC_CPU_MASK) {
case CG6_FHC_CPU_SPARC: case CG6_FHC_CPU_SPARC:
cg6_cpu_name = "sparc"; cg6_cpu_name = "sparc";
break; break;
...@@ -563,21 +556,19 @@ cg6_init_fix(struct fb_info *info, int linebytes) ...@@ -563,21 +556,19 @@ cg6_init_fix(struct fb_info *info, int linebytes)
break; break;
}; };
if (((conf >> CG6_FHC_REV_SHIFT) & CG6_FHC_REV_MASK) >= 11) { if (((conf >> CG6_FHC_REV_SHIFT) & CG6_FHC_REV_MASK) >= 11) {
if (par->fbsize <= 0x100000) { if (par->fbsize <= 0x100000)
cg6_card_name = "TGX"; cg6_card_name = "TGX";
} else { else
cg6_card_name = "TGX+"; cg6_card_name = "TGX+";
}
} else { } else {
if (par->fbsize <= 0x100000) { if (par->fbsize <= 0x100000)
cg6_card_name = "GX"; cg6_card_name = "GX";
} else { else
cg6_card_name = "GX+"; cg6_card_name = "GX+";
} }
}
sprintf(info->fix.id, "%s %s", cg6_card_name, cg6_cpu_name); sprintf(info->fix.id, "%s %s", cg6_card_name, cg6_cpu_name);
info->fix.id[sizeof(info->fix.id)-1] = 0; info->fix.id[sizeof(info->fix.id) - 1] = 0;
info->fix.type = FB_TYPE_PACKED_PIXELS; info->fix.type = FB_TYPE_PACKED_PIXELS;
info->fix.visual = FB_VISUAL_PSEUDOCOLOR; info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
...@@ -588,7 +579,7 @@ cg6_init_fix(struct fb_info *info, int linebytes) ...@@ -588,7 +579,7 @@ cg6_init_fix(struct fb_info *info, int linebytes)
} }
/* Initialize Brooktree DAC */ /* Initialize Brooktree DAC */
static void cg6_bt_init(struct cg6_par *par) static void __devinit cg6_bt_init(struct cg6_par *par)
{ {
struct bt_regs __iomem *bt = par->bt; struct bt_regs __iomem *bt = par->bt;
...@@ -602,9 +593,9 @@ static void cg6_bt_init(struct cg6_par *par) ...@@ -602,9 +593,9 @@ static void cg6_bt_init(struct cg6_par *par)
sbus_writel(0x00 << 24, &bt->control); sbus_writel(0x00 << 24, &bt->control);
} }
static void cg6_chip_init(struct fb_info *info) static void __devinit cg6_chip_init(struct fb_info *info)
{ {
struct cg6_par *par = (struct cg6_par *) info->par; struct cg6_par *par = (struct cg6_par *)info->par;
struct cg6_tec __iomem *tec = par->tec; struct cg6_tec __iomem *tec = par->tec;
struct cg6_fbc __iomem *fbc = par->fbc; struct cg6_fbc __iomem *fbc = par->fbc;
u32 rev, conf, mode; u32 rev, conf, mode;
...@@ -671,7 +662,8 @@ static void cg6_unmap_regs(struct of_device *op, struct fb_info *info, ...@@ -671,7 +662,8 @@ static void cg6_unmap_regs(struct of_device *op, struct fb_info *info,
of_iounmap(&op->resource[0], info->screen_base, par->fbsize); of_iounmap(&op->resource[0], info->screen_base, par->fbsize);
} }
static int __devinit cg6_probe(struct of_device *op, const struct of_device_id *match) static int __devinit cg6_probe(struct of_device *op,
const struct of_device_id *match)
{ {
struct device_node *dp = op->node; struct device_node *dp = op->node;
struct fb_info *info; struct fb_info *info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment