Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1215059

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

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] MIPS: BCM63XX: Use pr_* instead of printk
Date 2015-08-28 04:10 +0200
Message-ID <q2hh8-645-13@gated-at.bofh.it> (permalink)
References <q2gO6-5gI-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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__);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] MIPS: BCM63XX: Use pr_* instead of printk Gregory Fong <gregory.0xf0@gmail.com> - 2015-08-28 03:40 +0200
  Re: [PATCH] MIPS: BCM63XX: Use pr_* instead of printk Joe Perches <joe@perches.com> - 2015-08-28 04:10 +0200

csiph-web