Linux wireless drivers development
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>,
	Hauke Mehrtens <hauke@hauke-m.de>
Subject: Re: [PATCH] bcma: use custom printing functions
Date: Fri, 29 Jun 2012 03:39:12 -0700	[thread overview]
Message-ID: <1340966352.6562.17.camel@joe2Laptop> (raw)
In-Reply-To: <1340964011-17528-1-git-send-email-zajec5@gmail.com>

On Fri, 2012-06-29 at 12:00 +0200, Rafał Miłecki wrote:
> Having bus number printed makes it much easier to anaylze logs on
> systems with more buses. For example Netgear WNDR4500 has 3 AMBA buses
> in total, which makes standard log really messy.

Hi again Rafał

> diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
[]
> @@ -10,6 +10,14 @@
>  
>  #define BCMA_CORE_SIZE		0x1000
>  
> +/* We use pr_fmt, so call printk directly */
> +#define bcma_err(bus, fmt, ...) \
> +	printk(KERN_ERR KBUILD_MODNAME " bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
> +#define bcma_warn(bus, fmt, ...) \
> +	printk(KERN_WARNING KBUILD_MODNAME " bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
> +#define bcma_info(bus, fmt, ...) \
> +	printk(KERN_INFO KBUILD_MODNAME " bus%d: " fmt, (bus)->num, ##__VA_ARGS__)

seems fine.

> diff --git a/drivers/bcma/core.c b/drivers/bcma/core.c
[]
> @@ -56,6 +56,7 @@ EXPORT_SYMBOL_GPL(bcma_core_enable);
>  void bcma_core_set_clockmode(struct bcma_device *core,
>  			     enum bcma_clkmode clkmode)
>  {
> +	struct bcma_bus *bus = core->bus;

It seems unnecessary to me to do this assignment here
and in lots of other places when it's only used once.

It could cause unnecessary stack pressure.

> @@ -75,7 +76,7 @@ void bcma_core_set_clockmode(struct bcma_device *core,
>  			udelay(10);
>  		}
>  		if (i)
> -			pr_err("HT force timeout\n");
> +			bcma_err(bus, "HT force timeout\n");

These individual style uses could become

			bcma_err(core->bus, "HT force timeout\n");

[]

> @@ -137,8 +138,8 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
>  				       | BCMA_CC_CORECTL_UARTCLKEN);
>  		}
>  	} else {
> -		pr_err("serial not supported on this device ccrev: 0x%x\n",
> -		       ccrev);
> +		bcma_err(bus, "serial not supported on this device "
> +			 "ccrev: 0x%x\n", ccrev);

		bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n",
			 ccrev);

Please don't split format strings.  Ignore 80 column lengths for
the formats only.

>From Documentatation/CodingStyle chapter 2:

The limit on the length of lines is 80 columns and this is a strongly
preferred limit.
[]
However, never break user-visible strings such as
printk messages, because that breaks the ability to grep for them.

cheers, Joe


  parent reply	other threads:[~2012-06-29 10:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29 10:00 [PATCH] bcma: use custom printing functions Rafał Miłecki
2012-06-29 10:06 ` Rafał Miłecki
2012-06-29 10:39 ` Joe Perches [this message]
2012-06-29 11:04   ` Rafał Miłecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340966352.6562.17.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=hauke@hauke-m.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=zajec5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox