From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F317C433EF for ; Sat, 23 Jul 2022 04:08:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232258AbiGWEIo (ORCPT ); Sat, 23 Jul 2022 00:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbiGWEIn (ORCPT ); Sat, 23 Jul 2022 00:08:43 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9A6A70E54; Fri, 22 Jul 2022 21:08:39 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LqXmM41ZDzkX6Y; Sat, 23 Jul 2022 12:06:11 +0800 (CST) Received: from kwepemm600009.china.huawei.com (7.193.23.164) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 23 Jul 2022 12:08:35 +0800 Received: from [10.174.176.73] (10.174.176.73) by kwepemm600009.china.huawei.com (7.193.23.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 23 Jul 2022 12:08:34 +0800 Subject: Re: [PATCH] nbd: add missing definition of pr_fmt To: Joe Perches , Yu Kuai , , , CC: , , , References: <20220706093320.1962871-1-yukuai1@huaweicloud.com> <853a5164-78cf-1ccb-8e18-cff5b5bce4ff@huaweicloud.com> <49a8099eb7dd01e9d2d190056171341d87cd442b.camel@perches.com> <0dba2f0c-ba02-853e-60e7-873eabedcd80@huaweicloud.com> From: Yu Kuai Message-ID: <809c7cb8-6602-8568-cd91-33281a6fb508@huawei.com> Date: Sat, 23 Jul 2022 12:08:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600009.china.huawei.com (7.193.23.164) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! 在 2022/07/23 11:12, Joe Perches 写道: > On Sat, 2022-07-23 at 10:15 +0800, Yu Kuai wrote: >> Hi! > > Hello. > >> 在 2022/07/20 19:46, Yu Kuai 写道: >>> 在 2022/07/18 22:32, Joe Perches 写道: >>>> On Mon, 2022-07-18 at 21:52 +0800, Yu Kuai wrote: >>>>> 在 2022/07/06 17:33, Yu Kuai 写道: >>>>>> From: Yu Kuai >>>>>> >>>>>> commit 1243172d5894 ("nbd: use pr_err to output error message") tries >>>>>> to define pr_fmt and use short pr_err() to output error message, >>>>>> however, the definition is missed. >>>>> friendly ping ... >>>> [] >>>>>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c >>>> [] >>>>>> @@ -44,6 +44,9 @@ >>>>>>    #include >>>>>>    #include >>>>>> +#undef pr_fmt >>>>>> +#define pr_fmt(fmt) "nbd: " fmt >>>>>> + >>>> Typically, this #define is place before all #include lines >>>> so there is no need for an #undef >> >> I tried to remove the #undef: > > I'll repeat my message. > > Move the #define before _any_ #include. > > Also, there are some message that would need existing "nbd: " output > prefixes removed. Thanks for your explanation, I do miss that. Kuai > --- > drivers/block/nbd.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c > index f5d098a148cbf..222f26ac5e96a 100644 > --- a/drivers/block/nbd.c > +++ b/drivers/block/nbd.c > @@ -11,6 +11,8 @@ > * (part of code stolen from loop.c) > */ > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > + > #include > > #include > @@ -1950,8 +1952,8 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info) > test_bit(NBD_DISCONNECT_REQUESTED, &nbd->flags)) || > !refcount_inc_not_zero(&nbd->refs)) { > mutex_unlock(&nbd_index_mutex); > - pr_err("nbd: device at index %d is going down\n", > - index); > + pr_err("device at index %d is going down\n", > + index); > return -EINVAL; > } > } > @@ -1961,7 +1963,7 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info) > if (!nbd) { > nbd = nbd_dev_add(index, 2); > if (IS_ERR(nbd)) { > - pr_err("nbd: failed to add new device\n"); > + pr_err("failed to add new device\n"); > return PTR_ERR(nbd); > } > } > > > . >