Commit ec1a7b3d authored by Helge Deller's avatar Helge Deller Committed by Linus Torvalds

[PATCH] constify vga16fb.c

- move some static data into the .rodata section

- simplify source code for transl_l[] and transl_h[] which makes it more
  readable
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4670358a
...@@ -264,7 +264,7 @@ static void vga16fb_clock_chip(struct vga16fb_par *par, ...@@ -264,7 +264,7 @@ static void vga16fb_clock_chip(struct vga16fb_par *par,
const struct fb_info *info, const struct fb_info *info,
int mul, int div) int mul, int div)
{ {
static struct { static const struct {
u32 pixclock; u32 pixclock;
u8 misc; u8 misc;
u8 seq_clock_mode; u8 seq_clock_mode;
...@@ -652,7 +652,7 @@ static int vga16fb_set_par(struct fb_info *info) ...@@ -652,7 +652,7 @@ static int vga16fb_set_par(struct fb_info *info)
static void ega16_setpalette(int regno, unsigned red, unsigned green, unsigned blue) static void ega16_setpalette(int regno, unsigned red, unsigned green, unsigned blue)
{ {
static unsigned char map[] = { 000, 001, 010, 011 }; static const unsigned char map[] = { 000, 001, 010, 011 };
int val; int val;
if (regno >= 16) if (regno >= 16)
...@@ -1139,23 +1139,19 @@ static void vga16fb_copyarea(struct fb_info *info, const struct fb_copyarea *are ...@@ -1139,23 +1139,19 @@ static void vga16fb_copyarea(struct fb_info *info, const struct fb_copyarea *are
} }
} }
#ifdef __LITTLE_ENDIAN #define TRANS_MASK_LOW {0x0,0x8,0x4,0xC,0x2,0xA,0x6,0xE,0x1,0x9,0x5,0xD,0x3,0xB,0x7,0xF}
static unsigned int transl_l[] = #define TRANS_MASK_HIGH {0x000, 0x800, 0x400, 0xC00, 0x200, 0xA00, 0x600, 0xE00, \
{0x0,0x8,0x4,0xC,0x2,0xA,0x6,0xE,0x1,0x9,0x5,0xD,0x3,0xB,0x7,0xF}; 0x100, 0x900, 0x500, 0xD00, 0x300, 0xB00, 0x700, 0xF00}
static unsigned int transl_h[] =
{0x000, 0x800, 0x400, 0xC00, 0x200, 0xA00, 0x600, 0xE00, #if defined(__LITTLE_ENDIAN)
0x100, 0x900, 0x500, 0xD00, 0x300, 0xB00, 0x700, 0xF00}; static const u16 transl_l[] = TRANS_MASK_LOW;
#else static const u16 transl_h[] = TRANS_MASK_HIGH;
#ifdef __BIG_ENDIAN #elif defined(__BIG_ENDIAN)
static unsigned int transl_h[] = static const u16 transl_l[] = TRANS_MASK_HIGH;
{0x0,0x8,0x4,0xC,0x2,0xA,0x6,0xE,0x1,0x9,0x5,0xD,0x3,0xB,0x7,0xF}; static const u16 transl_h[] = TRANS_MASK_LOW;
static unsigned int transl_l[] =
{0x000, 0x800, 0x400, 0xC00, 0x200, 0xA00, 0x600, 0xE00,
0x100, 0x900, 0x500, 0xD00, 0x300, 0xB00, 0x700, 0xF00};
#else #else
#error "Only __BIG_ENDIAN and __LITTLE_ENDIAN are supported in vga-planes" #error "Only __BIG_ENDIAN and __LITTLE_ENDIAN are supported in vga-planes"
#endif #endif
#endif
static void vga_8planes_imageblit(struct fb_info *info, const struct fb_image *image) static void vga_8planes_imageblit(struct fb_info *info, const struct fb_image *image)
{ {
......
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