Commit bcf4373e authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Helge Deller
Browse files

fbdev: au1100fb: Replace custom printk wrappers by pr_*



The global wrappers also have the advantage to do stricter format
checking, so the pr_devel formats are also checked if DEBUG is not
defined. The global variants only check for DEBUG being defined and not
its actual value, so the #define to zero is dropped, too.

There is only a slight semantic change as the (by default disabled)
debug output doesn't contain __FILE__ any more.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent 6f366e86
Loading
Loading
Loading
Loading
+21 −20
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@
 *  with this program; if not, write  to the Free Software Foundation, Inc.,
 *  675 Mass Ave, Cambridge, MA 02139, USA.
 */

#define pr_fmt(fmt) "au1100fb:" fmt "\n"

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/io.h>
@@ -57,8 +60,6 @@
#include <linux/platform_device.h>
#include <linux/slab.h>

#define DEBUG 0

#include "au1100fb.h"

#if defined(CONFIG_COMPILE_TEST) && !defined(CONFIG_MIPS)
@@ -97,7 +98,7 @@ static int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi)
{
	struct au1100fb_device *fbdev = to_au1100fb_device(fbi);

	print_dbg("fb_blank %d %p", blank_mode, fbi);
	pr_devel("fb_blank %d %p", blank_mode, fbi);

	switch (blank_mode) {

@@ -291,7 +292,7 @@ static int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info

	fbdev = to_au1100fb_device(fbi);

	print_dbg("fb_pan_display %p %p", var, fbi);
	pr_devel("fb_pan_display %p %p", var, fbi);

	if (!var || !fbdev) {
		return -EINVAL;
@@ -302,13 +303,13 @@ static int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info
		return -EINVAL;
	}

	print_dbg("fb_pan_display 2 %p %p", var, fbi);
	pr_devel("fb_pan_display 2 %p %p", var, fbi);
	dy = var->yoffset - fbi->var.yoffset;
	if (dy) {

		u32 dmaaddr;

		print_dbg("Panning screen of %d lines", dy);
		pr_devel("Panning screen of %d lines", dy);

		dmaaddr = fbdev->regs->lcd_dmaaddr0;
		dmaaddr += (fbi->fix.line_length * dy);
@@ -322,7 +323,7 @@ static int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info
			fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(dmaaddr);
	}
	}
	print_dbg("fb_pan_display 3 %p %p", var, fbi);
	pr_devel("fb_pan_display 3 %p %p", var, fbi);

	return 0;
}
@@ -365,7 +366,7 @@ static int au1100fb_setup(struct au1100fb_device *fbdev)
	int num_panels = ARRAY_SIZE(known_lcd_panels);

	if (num_panels <= 0) {
		print_err("No LCD panels supported by driver!");
		pr_err("No LCD panels supported by driver!");
		return -ENODEV;
	}

@@ -388,16 +389,16 @@ static int au1100fb_setup(struct au1100fb_device *fbdev)
				}
			}
			if (i >= num_panels) {
				print_warn("Panel '%s' not supported!", this_opt);
				pr_warn("Panel '%s' not supported!", this_opt);
				return -ENODEV;
			}
		}
		/* Unsupported option */
		else
			print_warn("Unsupported option \"%s\"", this_opt);
			pr_warn("Unsupported option \"%s\"", this_opt);
	}

	print_info("Panel=%s", fbdev->panel->name);
	pr_info("Panel=%s", fbdev->panel->name);

	return 0;
}
@@ -422,7 +423,7 @@ static int au1100fb_drv_probe(struct platform_device *dev)
	/* Allocate region for our registers and map them */
	regs_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
	if (!regs_res) {
		print_err("fail to retrieve registers resource");
		pr_err("fail to retrieve registers resource");
		return -EFAULT;
	}

@@ -440,15 +441,15 @@ static int au1100fb_drv_probe(struct platform_device *dev)
				     fbdev->info.fix.mmio_start,
				     fbdev->info.fix.mmio_len,
				     DRIVER_NAME)) {
		print_err("fail to lock memory region at 0x%08lx",
		pr_err("fail to lock memory region at 0x%08lx",
			  fbdev->info.fix.mmio_start);
		return -EBUSY;
	}

	fbdev->regs = (struct au1100fb_regs*)KSEG1ADDR(fbdev->info.fix.mmio_start);

	print_dbg("Register memory map at %p", fbdev->regs);
	print_dbg("phys=0x%08x, size=%zu", fbdev->regs_phys, fbdev->regs_len);
	pr_devel("Register memory map at %p", fbdev->regs);
	pr_devel("phys=0x%08x, size=%zu", fbdev->regs_phys, fbdev->regs_len);

	c = clk_get(NULL, "lcd_intclk");
	if (!IS_ERR(c)) {
@@ -465,7 +466,7 @@ static int au1100fb_drv_probe(struct platform_device *dev)
					    PAGE_ALIGN(fbdev->fb_len),
					    &fbdev->fb_phys, GFP_KERNEL);
	if (!fbdev->fb_mem) {
		print_err("fail to allocate framebuffer (size: %zuK))",
		pr_err("fail to allocate framebuffer (size: %zuK))",
			  fbdev->fb_len / 1024);
		return -ENOMEM;
	}
@@ -473,8 +474,8 @@ static int au1100fb_drv_probe(struct platform_device *dev)
	fbdev->info.fix.smem_start = fbdev->fb_phys;
	fbdev->info.fix.smem_len = fbdev->fb_len;

	print_dbg("Framebuffer memory map at %p", fbdev->fb_mem);
	print_dbg("phys=0x%pad, size=%zuK", &fbdev->fb_phys, fbdev->fb_len / 1024);
	pr_devel("Framebuffer memory map at %p", fbdev->fb_mem);
	pr_devel("phys=0x%pad, size=%zuK", &fbdev->fb_phys, fbdev->fb_len / 1024);

	/* load the panel info into the var struct */
	fbdev->info.var = (struct fb_var_screeninfo) {
@@ -498,7 +499,7 @@ static int au1100fb_drv_probe(struct platform_device *dev)
		return -ENOMEM;

	if (fb_alloc_cmap(&fbdev->info.cmap, AU1100_LCD_NBR_PALETTE_ENTRIES, 0) < 0) {
		print_err("Fail to allocate colormap (%d entries)",
		pr_err("Fail to allocate colormap (%d entries)",
			   AU1100_LCD_NBR_PALETTE_ENTRIES);
		return -EFAULT;
	}
@@ -508,7 +509,7 @@ static int au1100fb_drv_probe(struct platform_device *dev)

	/* Register new framebuffer */
	if (register_framebuffer(&fbdev->info) < 0) {
		print_err("cannot register new framebuffer");
		pr_err("cannot register new framebuffer");
		goto failed;
	}

+0 −10
Original line number Diff line number Diff line
@@ -30,16 +30,6 @@
#ifndef _AU1100LCD_H
#define _AU1100LCD_H

#define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg)
#define print_warn(f, arg...) printk(KERN_WARNING DRIVER_NAME ": " f "\n", ## arg)
#define print_info(f, arg...) printk(KERN_INFO DRIVER_NAME ": " f "\n", ## arg)

#if DEBUG
#define print_dbg(f, arg...) printk(__FILE__ ": " f "\n", ## arg)
#else
#define print_dbg(f, arg...) do {} while (0)
#endif

#if defined(__BIG_ENDIAN)
#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_11
#else