lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1440727215.11525.122.camel@perches.com>
Date:	Thu, 27 Aug 2015 19:00:15 -0700
From:	Joe Perches <joe@...ches.com>
To:	Gregory Fong <gregory.0xf0@...il.com>
Cc:	Ralf Baechle <ralf@...ux-mips.org>,
	Florian Fainelli <f.fainelli@...il.com>,
	Jonas Gorski <jogo@...nwrt.org>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Nicolas Schichan <nschichan@...ebox.fr>,
	"open list:MIPS" <linux-mips@...ux-mips.org>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] MIPS: BCM63XX: Use pr_* instead of printk

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ