Re: [PATCH] MIPS: BCM63XX: Use pr_* instead of printk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2015-08-27 at 18:30 -0700, Gregory Fong wrote:
>

If you ever do more of these, here are a few trivial style notes:

> diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c

> +#define pr_fmt(fmt) "board_bcm963xx: " fmt

Using:

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

is more common

> @@ -740,7 +741,7 @@ int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
>  		memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
>  		return 0;
>  	} else {
> -		printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
> +		pr_err("unable to fill SPROM for given bustype.\n");

The periods at the end of logging lines are generally
superfluous and can be removed.

> @@ -808,7 +809,7 @@ void __init board_prom_init(void)
>  		char name[17];
>  		memcpy(name, board_name, 16);
>  		name[16] = 0;
> -		printk(KERN_ERR PFX "unknown bcm963xx board: %s\n",
> +		pr_err("unknown bcm963xx board: %s\n",
>  		       name);

It's nicer to unwrap lines where appropriate:

		pr_err("unknown bcm963xx board: %s\n", name);

> diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
[]
> @@ -376,10 +376,10 @@ void __init bcm63xx_cpu_init(void)
>  	bcm63xx_cpu_freq = detect_cpu_clock();
>  	bcm63xx_memory_size = detect_memory_size();
>  
> -	printk(KERN_INFO "Detected Broadcom 0x%04x CPU revision %02x\n",
> +	pr_info("Detected Broadcom 0x%04x CPU revision %02x\n",
>  	       bcm63xx_cpu_id, bcm63xx_cpu_rev);

It's nicer to reflow alignment for the entire statement to
keep the subsequent line arguments at the open parenthesis:

	pr_info("Detected Broadcom 0x%04x CPU revision %02x\n",
 		bcm63xx_cpu_id, bcm63xx_cpu_rev);

> +	pr_info("CPU frequency is %u MHz\n",
>  	       bcm63xx_cpu_freq / 1000000);

	pr_info("CPU frequency is %u MHz\n", bcm63xx_cpu_freq / 1000000);

etc...

> diff --git a/arch/mips/bcm63xx/timer.c b/arch/mips/bcm63xx/timer.c
[]
> @@ -195,7 +195,7 @@ int bcm63xx_timer_init(void)
>  	irq = bcm63xx_get_irq_number(IRQ_TIMER);
>  	ret = request_irq(irq, timer_interrupt, 0, "bcm63xx_timer", NULL);
>  	if (ret) {
> -		printk(KERN_ERR "bcm63xx_timer: failed to register irq\n");
> +		pr_err("bcm63xx_timer: failed to register irq\n");

It's sometimes nicer to change embedded function names
to use "%s: ", __func__

		pr_err("%s: failed to register irq\n", __func__);






[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux