All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Tao Chen <boby.chen@huawei.com>, <konrad.wilk@oracle.com>
Cc: <xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>,
	<wu.wubin@huawei.com>, <rudy.zhangmin@huawei.com>
Subject: Re: [PATCH] xen-blkback: define pr_fmt macro to avoid the duplication of DRV_PFX
Date: Tue, 31 Mar 2015 16:57:26 +0200	[thread overview]
Message-ID: <551AB5D6.9080009@citrix.com> (raw)
In-Reply-To: <1427836488-48092-1-git-send-email-boby.chen@huawei.com>

El 31/03/15 a les 23.14, Tao Chen ha escrit:
> Define pr_fmt macro with {xen-blkback: } prefix, then remove all use
> of DRV_PFX in the pr and DPRINTK sentences. It will simplify the code.
> 
> And if the pr sentences miss a \n, add it in the end. If the DPRINTK
> sentences have redundant \n, remove it. It will format the code.
> 
> These all make the readability of the code become better.

Thanks for the patch.

> Signed-off-by: Tao Chen <boby.chen@huawei.com>
> ---
>  drivers/block/xen-blkback/blkback.c | 62 ++++++++++++++++++-------------------
>  drivers/block/xen-blkback/common.h  |  6 ----
>  drivers/block/xen-blkback/xenbus.c  | 18 ++++++-----
>  3 files changed, 42 insertions(+), 44 deletions(-)
> 
[...]
> diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
> index 375d288..f620b5d 100644
> --- a/drivers/block/xen-blkback/common.h
> +++ b/drivers/block/xen-blkback/common.h
> @@ -44,12 +44,6 @@
>  #include <xen/interface/io/blkif.h>
>  #include <xen/interface/io/protocols.h>
>  
> -#define DRV_PFX "xen-blkback:"
> -#define DPRINTK(fmt, args...)				\
> -	pr_debug(DRV_PFX "(%s:%d) " fmt ".\n",		\
> -		 __func__, __LINE__, ##args)
> -
> -
>  /*
>   * This is the maximum number of segments that would be allowed in indirect
>   * requests. This value will also be passed to the frontend.
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index b33083e..0dbbfeb 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -14,6 +14,11 @@
>  
>  */
>  
> +#define pr_fmt(fmt) "xen-blkback: " fmt
> +#define DPRINTK(fmt, args...)			\
> +	pr_debug("(%s:%d) " fmt ".\n",		\
> +		__func__, __LINE__, ##args)
> +
>  #include <stdarg.h>
>  #include <linux/module.h>
>  #include <linux/kthread.h>
> @@ -426,14 +431,14 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
>  				 FMODE_READ : FMODE_WRITE, NULL);
>  
>  	if (IS_ERR(bdev)) {
> -		DPRINTK("xen_vbd_create: device %08x could not be opened.\n",
> +		DPRINTK("xen_vbd_create: device %08x could not be opened",
>  			vbd->pdevice);
>  		return -ENOENT;
>  	}
>  
>  	vbd->bdev = bdev;
>  	if (vbd->bdev->bd_disk == NULL) {
> -		DPRINTK("xen_vbd_create: device %08x doesn't exist.\n",
> +		DPRINTK("xen_vbd_create: device %08x doesn't exist",
>  			vbd->pdevice);

IMHO this two above should be made a pr_warn probably...

>  		xen_vbd_free(vbd);
>  		return -ENOENT;
> @@ -452,7 +457,7 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
>  	if (q && blk_queue_secdiscard(q))
>  		vbd->discard_secure = true;
>  
> -	DPRINTK("Successful creation of handle=%04x (dom=%u)\n",
> +	DPRINTK("Successful creation of handle=%04x (dom=%u)",
>  		handle, blkif->domid);

...and this should be turned into a plain pr_debug. And with that we can
get rid of DPRINTK.

Roger.


  reply	other threads:[~2015-03-31 14:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31 21:14 [PATCH] xen-blkback: define pr_fmt macro to avoid the duplication of DRV_PFX Tao Chen
2015-03-31 14:57 ` Roger Pau Monné [this message]
2015-03-31 16:53   ` Joe Perches
2015-03-31 16:53   ` Joe Perches
2015-04-01  6:40   ` Chentao (Boby)
2015-04-01  6:40   ` Chentao (Boby)
2015-03-31 14:57 ` Roger Pau Monné
  -- strict thread matches above, loose matches on Subject: below --
2015-03-31 21:14 Tao Chen

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=551AB5D6.9080009@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=boby.chen@huawei.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rudy.zhangmin@huawei.com \
    --cc=wu.wubin@huawei.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.