Merge branch 'linus' into perf/urgent
[cascardo/linux.git] / drivers / video / s3fb.c
index d838ba8..968b299 100644 (file)
@@ -306,8 +306,8 @@ static void s3fb_settile_fast(struct fb_info *info, struct fb_tilemap *map)
 
        if ((map->width != 8) || (map->height != 16) ||
            (map->depth != 1) || (map->length != 256)) {
-               printk(KERN_ERR "fb%d: unsupported font parameters: width %d, height %d, depth %d, length %d\n",
-                       info->node, map->width, map->height, map->depth, map->length);
+               fb_err(info, "unsupported font parameters: width %d, height %d, depth %d, length %d\n",
+                      map->width, map->height, map->depth, map->length);
                return;
        }
 
@@ -476,7 +476,7 @@ static void s3_set_pixclock(struct fb_info *info, u32 pixclock)
        rv = svga_compute_pll((par->chip == CHIP_365_TRIO3D) ? &s3_trio3d_pll : &s3_pll,
                              1000000000 / pixclock, &m, &n, &r, info->node);
        if (rv < 0) {
-               printk(KERN_ERR "fb%d: cannot set requested pixclock, keeping old value\n", info->node);
+               fb_err(info, "cannot set requested pixclock, keeping old value\n");
                return;
        }
 
@@ -569,7 +569,7 @@ static int s3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
                rv = -EINVAL;
 
        if (rv < 0) {
-               printk(KERN_ERR "fb%d: unsupported mode requested\n", info->node);
+               fb_err(info, "unsupported mode requested\n");
                return rv;
        }
 
@@ -587,22 +587,21 @@ static int s3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        /* Check whether have enough memory */
        mem = ((var->bits_per_pixel * var->xres_virtual) >> 3) * var->yres_virtual;
        if (mem > info->screen_size) {
-               printk(KERN_ERR "fb%d: not enough framebuffer memory (%d kB requested , %d kB available)\n",
-                       info->node, mem >> 10, (unsigned int) (info->screen_size >> 10));
+               fb_err(info, "not enough framebuffer memory (%d kB requested , %u kB available)\n",
+                      mem >> 10, (unsigned int) (info->screen_size >> 10));
                return -EINVAL;
        }
 
        rv = svga_check_timings (&s3_timing_regs, var, info->node);
        if (rv < 0) {
-               printk(KERN_ERR "fb%d: invalid timings requested\n", info->node);
+               fb_err(info, "invalid timings requested\n");
                return rv;
        }
 
        rv = svga_compute_pll(&s3_pll, PICOS2KHZ(var->pixclock), &m, &n, &r,
                                info->node);
        if (rv < 0) {
-               printk(KERN_ERR "fb%d: invalid pixclock value requested\n",
-                       info->node);
+               fb_err(info, "invalid pixclock value requested\n");
                return rv;
        }
 
@@ -686,7 +685,7 @@ static int s3fb_set_par(struct fb_info *info)
 
 
        /* Set the offset register */
-       pr_debug("fb%d: offset register       : %d\n", info->node, offset_value);
+       fb_dbg(info, "offset register       : %d\n", offset_value);
        svga_wcrt_multi(par->state.vgabase, s3_offset_regs, offset_value);
 
        if (par->chip != CHIP_357_VIRGE_GX2 &&
@@ -769,7 +768,7 @@ static int s3fb_set_par(struct fb_info *info)
        /* Set mode-specific register values */
        switch (mode) {
        case 0:
-               pr_debug("fb%d: text mode\n", info->node);
+               fb_dbg(info, "text mode\n");
                svga_set_textmode_vga_regs(par->state.vgabase);
 
                /* Set additional registers like in 8-bit mode */
@@ -780,12 +779,12 @@ static int s3fb_set_par(struct fb_info *info)
                svga_wcrt_mask(par->state.vgabase, 0x3A, 0x00, 0x30);
 
                if (fasttext) {
-                       pr_debug("fb%d: high speed text mode set\n", info->node);
+                       fb_dbg(info, "high speed text mode set\n");
                        svga_wcrt_mask(par->state.vgabase, 0x31, 0x40, 0x40);
                }
                break;
        case 1:
-               pr_debug("fb%d: 4 bit pseudocolor\n", info->node);
+               fb_dbg(info, "4 bit pseudocolor\n");
                vga_wgfx(par->state.vgabase, VGA_GFX_MODE, 0x40);
 
                /* Set additional registers like in 8-bit mode */
@@ -796,7 +795,7 @@ static int s3fb_set_par(struct fb_info *info)
                svga_wcrt_mask(par->state.vgabase, 0x3A, 0x00, 0x30);
                break;
        case 2:
-               pr_debug("fb%d: 4 bit pseudocolor, planar\n", info->node);
+               fb_dbg(info, "4 bit pseudocolor, planar\n");
 
                /* Set additional registers like in 8-bit mode */
                svga_wcrt_mask(par->state.vgabase, 0x50, 0x00, 0x30);
@@ -806,7 +805,7 @@ static int s3fb_set_par(struct fb_info *info)
                svga_wcrt_mask(par->state.vgabase, 0x3A, 0x00, 0x30);
                break;
        case 3:
-               pr_debug("fb%d: 8 bit pseudocolor\n", info->node);
+               fb_dbg(info, "8 bit pseudocolor\n");
                svga_wcrt_mask(par->state.vgabase, 0x50, 0x00, 0x30);
                if (info->var.pixclock > 20000 ||
                    par->chip == CHIP_357_VIRGE_GX2 ||
@@ -822,7 +821,7 @@ static int s3fb_set_par(struct fb_info *info)
                }
                break;
        case 4:
-               pr_debug("fb%d: 5/5/5 truecolor\n", info->node);
+               fb_dbg(info, "5/5/5 truecolor\n");
                if (par->chip == CHIP_988_VIRGE_VX) {
                        if (info->var.pixclock > 20000)
                                svga_wcrt_mask(par->state.vgabase, 0x67, 0x20, 0xF0);
@@ -850,7 +849,7 @@ static int s3fb_set_par(struct fb_info *info)
                }
                break;
        case 5:
-               pr_debug("fb%d: 5/6/5 truecolor\n", info->node);
+               fb_dbg(info, "5/6/5 truecolor\n");
                if (par->chip == CHIP_988_VIRGE_VX) {
                        if (info->var.pixclock > 20000)
                                svga_wcrt_mask(par->state.vgabase, 0x67, 0x40, 0xF0);
@@ -879,16 +878,16 @@ static int s3fb_set_par(struct fb_info *info)
                break;
        case 6:
                /* VIRGE VX case */
-               pr_debug("fb%d: 8/8/8 truecolor\n", info->node);
+               fb_dbg(info, "8/8/8 truecolor\n");
                svga_wcrt_mask(par->state.vgabase, 0x67, 0xD0, 0xF0);
                break;
        case 7:
-               pr_debug("fb%d: 8/8/8/8 truecolor\n", info->node);
+               fb_dbg(info, "8/8/8/8 truecolor\n");
                svga_wcrt_mask(par->state.vgabase, 0x50, 0x30, 0x30);
                svga_wcrt_mask(par->state.vgabase, 0x67, 0xD0, 0xF0);
                break;
        default:
-               printk(KERN_ERR "fb%d: unsupported mode - bug\n", info->node);
+               fb_err(info, "unsupported mode - bug\n");
                return -EINVAL;
        }
 
@@ -991,27 +990,27 @@ static int s3fb_blank(int blank_mode, struct fb_info *info)
 
        switch (blank_mode) {
        case FB_BLANK_UNBLANK:
-               pr_debug("fb%d: unblank\n", info->node);
+               fb_dbg(info, "unblank\n");
                svga_wcrt_mask(par->state.vgabase, 0x56, 0x00, 0x06);
                svga_wseq_mask(par->state.vgabase, 0x01, 0x00, 0x20);
                break;
        case FB_BLANK_NORMAL:
-               pr_debug("fb%d: blank\n", info->node);
+               fb_dbg(info, "blank\n");
                svga_wcrt_mask(par->state.vgabase, 0x56, 0x00, 0x06);
                svga_wseq_mask(par->state.vgabase, 0x01, 0x20, 0x20);
                break;
        case FB_BLANK_HSYNC_SUSPEND:
-               pr_debug("fb%d: hsync\n", info->node);
+               fb_dbg(info, "hsync\n");
                svga_wcrt_mask(par->state.vgabase, 0x56, 0x02, 0x06);
                svga_wseq_mask(par->state.vgabase, 0x01, 0x20, 0x20);
                break;
        case FB_BLANK_VSYNC_SUSPEND:
-               pr_debug("fb%d: vsync\n", info->node);
+               fb_dbg(info, "vsync\n");
                svga_wcrt_mask(par->state.vgabase, 0x56, 0x04, 0x06);
                svga_wseq_mask(par->state.vgabase, 0x01, 0x20, 0x20);
                break;
        case FB_BLANK_POWERDOWN:
-               pr_debug("fb%d: sync down\n", info->node);
+               fb_dbg(info, "sync down\n");
                svga_wcrt_mask(par->state.vgabase, 0x56, 0x06, 0x06);
                svga_wseq_mask(par->state.vgabase, 0x01, 0x20, 0x20);
                break;
@@ -1352,13 +1351,16 @@ static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
                goto err_reg_fb;
        }
 
-       printk(KERN_INFO "fb%d: %s on %s, %d MB RAM, %d MHz MCLK\n", info->node, info->fix.id,
-                pci_name(dev), info->fix.smem_len >> 20, (par->mclk_freq + 500) / 1000);
+       fb_info(info, "%s on %s, %d MB RAM, %d MHz MCLK\n",
+               info->fix.id, pci_name(dev),
+               info->fix.smem_len >> 20, (par->mclk_freq + 500) / 1000);
 
        if (par->chip == CHIP_UNKNOWN)
-               printk(KERN_INFO "fb%d: unknown chip, CR2D=%x, CR2E=%x, CRT2F=%x, CRT30=%x\n",
-                       info->node, vga_rcrt(par->state.vgabase, 0x2d), vga_rcrt(par->state.vgabase, 0x2e),
-                       vga_rcrt(par->state.vgabase, 0x2f), vga_rcrt(par->state.vgabase, 0x30));
+               fb_info(info, "unknown chip, CR2D=%x, CR2E=%x, CRT2F=%x, CRT30=%x\n",
+                       vga_rcrt(par->state.vgabase, 0x2d),
+                       vga_rcrt(par->state.vgabase, 0x2e),
+                       vga_rcrt(par->state.vgabase, 0x2f),
+                       vga_rcrt(par->state.vgabase, 0x30));
 
        /* Record a reference to the driver data */
        pci_set_drvdata(dev, info);
@@ -1424,7 +1426,6 @@ static void s3_pci_remove(struct pci_dev *dev)
                pci_release_regions(dev);
 /*             pci_disable_device(dev); */
 
-               pci_set_drvdata(dev, NULL);
                framebuffer_release(info);
        }
 }