X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fvideo%2Ftgafb.c;h=680642c089c9202b64f57f103e264b5ebc035609;hb=4dcc53da49c2387078fe8ceb7a420d125e027fc6;hp=f0fde6ea7c36e252f5f6dec8d205664d5ce8b023;hpb=5c34202b8bf942da411b6599668a76b07449bbfd;p=linux-2.6-omap-h63xx.git diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c index f0fde6ea7c3..680642c089c 100644 --- a/drivers/video/tgafb.c +++ b/drivers/video/tgafb.c @@ -5,7 +5,7 @@ * Copyright (C) 1997 Geert Uytterhoeven * Copyright (C) 1999,2000 Martin Lucina, Tom Zerucha * Copyright (C) 2002 Richard Henderson - * Copyright (C) 2006 Maciej W. Rozycki + * Copyright (C) 2006, 2007 Maciej W. Rozycki * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for @@ -13,6 +13,7 @@ */ #include +#include #include #include #include @@ -636,15 +637,6 @@ tgafb_mono_imageblit(struct fb_info *info, const struct fb_image *image) is8bpp = info->var.bits_per_pixel == 8; - /* For copies that aren't pixel expansion, there's little we - can do better than the generic code. */ - /* ??? There is a DMA write mode; I wonder if that could be - made to pull the data from the image buffer... */ - if (image->depth > 1) { - cfb_imageblit(info, image); - return; - } - dx = image->dx; dy = image->dy; width = image->width; @@ -654,6 +646,9 @@ tgafb_mono_imageblit(struct fb_info *info, const struct fb_image *image) line_length = info->fix.line_length; rincr = (width + 7) / 8; + /* A shift below cannot cope with. */ + if (unlikely(width == 0)) + return; /* Crop the image to the screen. */ if (dx > vxres || dy > vyres) return; @@ -709,9 +704,10 @@ tgafb_mono_imageblit(struct fb_info *info, const struct fb_image *image) unsigned long bwidth; /* Handle common case of imaging a single character, in - a font less than 32 pixels wide. */ + a font less than or 32 pixels wide. */ - pixelmask = (1 << width) - 1; + /* Avoid a shift by 32; width > 0 implied. */ + pixelmask = (2ul << (width - 1)) - 1; pixelmask <<= shift; __raw_writel(pixelmask, regs_base + TGA_PIXELMASK_REG); wmb(); @@ -849,7 +845,7 @@ tgafb_clut_imageblit(struct fb_info *info, const struct fb_image *image) u32 *palette = ((u32 *)info->pseudo_palette); unsigned long pos, line_length, i, j; const unsigned char *data; - void *regs_base, *fb_base; + void __iomem *regs_base, *fb_base; dx = image->dx; dy = image->dy; @@ -1625,8 +1621,7 @@ tgafb_register(struct device *dev) par->tga_regs_base = mem_base + TGA_REGS_OFFSET; par->tga_type = tga_type; if (tga_bus_pci) - pci_read_config_byte(to_pci_dev(dev), PCI_REVISION_ID, - &par->tga_chip_rev); + par->tga_chip_rev = (to_pci_dev(dev))->revision; if (tga_bus_tc) par->tga_chip_rev = TGA_READ_REG(par, TGA_START_REG) & 0xff; @@ -1635,7 +1630,7 @@ tgafb_register(struct device *dev) FBINFO_HWACCEL_IMAGEBLIT | FBINFO_HWACCEL_FILLRECT; info->fbops = &tgafb_ops; info->screen_base = par->tga_fb_base; - info->pseudo_palette = (void *)(par + 1); + info->pseudo_palette = par->palette; /* This should give a reasonable default video mode. */ if (tga_bus_pci) {