Skip to content

Commit bcf4373

Browse files
ukleinekhdeller
authored andcommitted
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: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 6f366e8 commit bcf4373

2 files changed

Lines changed: 21 additions & 30 deletions

File tree

drivers/video/fbdev/au1100fb.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
* with this program; if not, write to the Free Software Foundation, Inc.,
4242
* 675 Mass Ave, Cambridge, MA 02139, USA.
4343
*/
44+
45+
#define pr_fmt(fmt) "au1100fb:" fmt "\n"
46+
4447
#include <linux/clk.h>
4548
#include <linux/delay.h>
4649
#include <linux/io.h>
@@ -57,8 +60,6 @@
5760
#include <linux/platform_device.h>
5861
#include <linux/slab.h>
5962

60-
#define DEBUG 0
61-
6263
#include "au1100fb.h"
6364

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

100-
print_dbg("fb_blank %d %p", blank_mode, fbi);
101+
pr_devel("fb_blank %d %p", blank_mode, fbi);
101102

102103
switch (blank_mode) {
103104

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

292293
fbdev = to_au1100fb_device(fbi);
293294

294-
print_dbg("fb_pan_display %p %p", var, fbi);
295+
pr_devel("fb_pan_display %p %p", var, fbi);
295296

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

305-
print_dbg("fb_pan_display 2 %p %p", var, fbi);
306+
pr_devel("fb_pan_display 2 %p %p", var, fbi);
306307
dy = var->yoffset - fbi->var.yoffset;
307308
if (dy) {
308309

309310
u32 dmaaddr;
310311

311-
print_dbg("Panning screen of %d lines", dy);
312+
pr_devel("Panning screen of %d lines", dy);
312313

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

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

367368
if (num_panels <= 0) {
368-
print_err("No LCD panels supported by driver!");
369+
pr_err("No LCD panels supported by driver!");
369370
return -ENODEV;
370371
}
371372

@@ -388,16 +389,16 @@ static int au1100fb_setup(struct au1100fb_device *fbdev)
388389
}
389390
}
390391
if (i >= num_panels) {
391-
print_warn("Panel '%s' not supported!", this_opt);
392+
pr_warn("Panel '%s' not supported!", this_opt);
392393
return -ENODEV;
393394
}
394395
}
395396
/* Unsupported option */
396397
else
397-
print_warn("Unsupported option \"%s\"", this_opt);
398+
pr_warn("Unsupported option \"%s\"", this_opt);
398399
}
399400

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

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

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

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

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

453454
c = clk_get(NULL, "lcd_intclk");
454455
if (!IS_ERR(c)) {
@@ -465,16 +466,16 @@ static int au1100fb_drv_probe(struct platform_device *dev)
465466
PAGE_ALIGN(fbdev->fb_len),
466467
&fbdev->fb_phys, GFP_KERNEL);
467468
if (!fbdev->fb_mem) {
468-
print_err("fail to allocate framebuffer (size: %zuK))",
469+
pr_err("fail to allocate framebuffer (size: %zuK))",
469470
fbdev->fb_len / 1024);
470471
return -ENOMEM;
471472
}
472473

473474
fbdev->info.fix.smem_start = fbdev->fb_phys;
474475
fbdev->info.fix.smem_len = fbdev->fb_len;
475476

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

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

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

509510
/* Register new framebuffer */
510511
if (register_framebuffer(&fbdev->info) < 0) {
511-
print_err("cannot register new framebuffer");
512+
pr_err("cannot register new framebuffer");
512513
goto failed;
513514
}
514515

drivers/video/fbdev/au1100fb.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@
3030
#ifndef _AU1100LCD_H
3131
#define _AU1100LCD_H
3232

33-
#define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg)
34-
#define print_warn(f, arg...) printk(KERN_WARNING DRIVER_NAME ": " f "\n", ## arg)
35-
#define print_info(f, arg...) printk(KERN_INFO DRIVER_NAME ": " f "\n", ## arg)
36-
37-
#if DEBUG
38-
#define print_dbg(f, arg...) printk(__FILE__ ": " f "\n", ## arg)
39-
#else
40-
#define print_dbg(f, arg...) do {} while (0)
41-
#endif
42-
4333
#if defined(__BIG_ENDIAN)
4434
#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_11
4535
#else

0 commit comments

Comments
 (0)