Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752036AbbDAGkk (ORCPT ); Wed, 1 Apr 2015 02:40:40 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:61195 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898AbbDAGki (ORCPT ); Wed, 1 Apr 2015 02:40:38 -0400 Message-ID: <551B92D0.6040409@huawei.com> Date: Wed, 1 Apr 2015 14:40:16 +0800 From: "Chentao (Boby)" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: =?windows-1252?Q?Roger_Pau_Monn=E9?= , Joe Perches CC: , , , , Subject: Re: [PATCH] xen-blkback: define pr_fmt macro to avoid the duplication of DRV_PFX References: <1427836488-48092-1-git-send-email-boby.chen@huawei.com> <551AB5D6.9080009@citrix.com> In-Reply-To: <551AB5D6.9080009@citrix.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.25.98] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3362 Lines: 99 Thanks roger and joe. I will adopt your suggestions in my v2 patch. On 2015/3/31 22:57, Roger Pau Monn? wrote: > 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 >> --- >> 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 >> #include >> >> -#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 >> #include >> #include >> @@ -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. > > > . > -- 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/