Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp619933ybh; Wed, 11 Mar 2020 07:34:51 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvgOuGfXMeUfwxf/0B9d9f2yqQbe+lqaMV06ND8b2BgdzUHBj4TuJyGE3PT9lhWnBunoHy1 X-Received: by 2002:a9d:7b4c:: with SMTP id f12mr2389863oto.137.1583937291571; Wed, 11 Mar 2020 07:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583937291; cv=none; d=google.com; s=arc-20160816; b=VBK0yLvMp9qpSQhSMpZmqe3QShAWD4VKqcTPKZyUvoECjM+vSpk0ylTrjEnQ/aemoI THZbih+eWpufQIOhgIWBzw+0uQzrlBAelZ5wksX28Aox0kc0XyE3HfpBHswWQ4BAzgw3 qko9l45UqLcDb7mCeA4U4OP3GjDT7A4wTNorJS+frmgvZLbOyFSKK/WmFkH985/NaG71 QxQOGRL9Cwl+Y12x1/Yy2Ybz3D7uzWTkZOuWghcyV6B7us/pSrhpBofRnd6Zw3HhXp/7 HpR3ZIjBgJA5Rp/VcEq5fr1vSwVQigYe1WuE8Z3sBD9zhnUuEfCZuV+3RWz6dTKpQIb3 jXeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=EHtLtsS2WGZPHYcJ3EhBfzxYPCz+NoPNkTjvW7OOCBY=; b=Yc9q//z39jj2WXMycCQ7uUaH5C7d8LNbfjETpQvpm99+9z1E1ppMbHcyVwvAKuNNoa xBaSJ5xjNL66CF1wbo+MeDH3PHSg+2iIw47hJi7kr7Ve+iFs17WoYNlfabTxU7/3i0sX hWiN+cmMkooXhQ8qSaRK6gm8uPo/RTJ97KKWIMSqCcEM7aUPXACNqN6ewG5t2ZNGbDpU RibTFEsFRwgM4+ywZh2q8hVzmkom1018SWmCLxohhmmqT8mGARUTMW/sQUbQldT6FWjg 7FRg/cD6SvGX5DcECEQ2ER12YSC8asBQ8bzKmKQm2TZ+NkFSvzNm6483mO/y6zxw7D0l t+oA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si247642ooq.79.2020.03.11.07.34.40; Wed, 11 Mar 2020 07:34:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729473AbgCKOdC convert rfc822-to-8bit (ORCPT + 99 others); Wed, 11 Mar 2020 10:33:02 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:50336 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729309AbgCKOdC (ORCPT ); Wed, 11 Mar 2020 10:33:02 -0400 Received: from [172.20.10.2] (x59cc8a78.dyn.telefonica.de [89.204.138.120]) by mail.holtmann.org (Postfix) with ESMTPSA id A6AF1CECDF; Wed, 11 Mar 2020 15:42:28 +0100 (CET) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: [PATCH] Bluetooth: include file and function names in logs From: Marcel Holtmann In-Reply-To: <20200310095959.1.I864ded253b57454e732ab5acb1cae5b22c67cfae@changeid> Date: Wed, 11 Mar 2020 15:32:59 +0100 Cc: Joseph Hwang , Yoni Shavit , Miao-chen Chou , Alain Michaud , linux-bluetooth@vger.kernel.org, "David S. Miller" , Johan Hedberg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Kicinski Content-Transfer-Encoding: 8BIT Message-Id: <017831DA-9E5C-438A-A094-2826255076EC@holtmann.org> References: <20200310095959.1.I864ded253b57454e732ab5acb1cae5b22c67cfae@changeid> To: Manish Mandlik X-Mailer: Apple Mail (2.3608.60.0.2.5) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Manish, > Include file and function names in bluetooth kernel logs to > help debugging. > > Signed-off-by: Joseph Hwang > Signed-off-by: Manish Mandlik > --- > > include/net/bluetooth/bluetooth.h | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h > index 1576353a27732..2024d9c53d687 100644 > --- a/include/net/bluetooth/bluetooth.h > +++ b/include/net/bluetooth/bluetooth.h > @@ -150,10 +150,21 @@ void bt_warn_ratelimited(const char *fmt, ...); > __printf(1, 2) > void bt_err_ratelimited(const char *fmt, ...); > > -#define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__) > -#define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__) > -#define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__) > -#define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__) > +static inline const char *basename(const char *path) > +{ > + const char *str = strrchr(path, '/'); > + > + return str ? (str + 1) : path; > +} > + > +#define BT_INFO(fmt, ...) bt_info("%s:%s() " fmt "\n", \ > + basename(__FILE__), __func__, ##__VA_ARGS__) > +#define BT_WARN(fmt, ...) bt_warn("%s:%s() " fmt "\n", \ > + basename(__FILE__), __func__, ##__VA_ARGS__) > +#define BT_ERR(fmt, ...) bt_err("%s:%s() " fmt "\n", \ > + basename(__FILE__), __func__, ##__VA_ARGS__) > +#define BT_DBG(fmt, ...) pr_debug("%s:%s() " fmt "\n", \ > + basename(__FILE__), __func__, ##__VA_ARGS__) > > #define bt_dev_info(hdev, fmt, ...) \ > BT_INFO("%s: " fmt, (hdev)->name, ##__VA_ARGS__) this is NAK from my side. We don’t want to include __FILE__ and __func__ names in the standard messages. I am however working in revamping the whole printk and debug of the Bluetooth subsystem. I will send around the initial pieces of my work as a RFC soon. Regards Marcel