Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp880722ybh; Tue, 10 Mar 2020 10:01:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvXc86NfKW7O0jC9dJ/uijoLc77To9twBW3mWZrYQ0IQ7O/ReasMFLqFtI5jp4fIq35dYXD X-Received: by 2002:aca:47c8:: with SMTP id u191mr1925110oia.17.1583859691427; Tue, 10 Mar 2020 10:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583859691; cv=none; d=google.com; s=arc-20160816; b=vKtL7ATYJ6y6AxpGpVMKLTPtMNdvpjRFZ+yYZZsj4QNxXn3bJHiZrjYa0j7dXWaPDB GphWq7t9erWK81jE4rPJmJhip2egIcpillkazdyErJcnsVdzZAz5pP8Fer62RsytFDYY m+R3AsMPVs9gIBYV0SHeAOc8c2c+PuYtqSG8Zc7/hnrU8A6A0XosVeDiSilsO8C395tr UAmHhzUhjcBmictKlhSc61A4mlWBAx0ptf0dhsojtOV2P14vtENHFj0Z/Gl8P1kofxSF +djcKg4FkfLCTmxVwsFIMbIHliO+TL8Uiv//nN0+2MYm5mEtS5slPgGkQnfufDMGgYcQ sPvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=utC88xO/3DQklGM/YS6f9zgx+KbjPZZi5VnmSXETSAc=; b=kcNVQh7yJkAXy3+kFDg6NuqXRKfPWHtfgGAJabfhOTk00Ngr6+5dkJ1r86L3bV8GNu ZbJXBRPy9PvImxfKRI6uubNN+TKCy7A3WSX78Y2Ykd/cpTDUc+XjFDrW/y0sNJvXRe3/ +l92cMqSDRqJgiI41K4h4Wy2+TxSQ3RVAu4CEi9YtBl5LkR8fJubXd396XpUXznOiAnR ehrRPBK1ZahFagbqwHjriYUY+cEYbyVJKxoI8ZQscUPTDG8bjawwJiyNMCTS/bdaqm6x xfywHnuFshLLktPdklkGKCAfdX1rZIvLlQ67+RZY3uUSCQo2XUFja6SQ8NA8qdakNv/B ikyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="C7O49/VN"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x16si7842311otp.180.2020.03.10.10.00.58; Tue, 10 Mar 2020 10:01:31 -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; dkim=pass header.i=@google.com header.s=20161025 header.b="C7O49/VN"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726837AbgCJRA5 (ORCPT + 99 others); Tue, 10 Mar 2020 13:00:57 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:48906 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbgCJRA4 (ORCPT ); Tue, 10 Mar 2020 13:00:56 -0400 Received: by mail-pf1-f202.google.com with SMTP id c17so9470374pfo.15 for ; Tue, 10 Mar 2020 10:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=utC88xO/3DQklGM/YS6f9zgx+KbjPZZi5VnmSXETSAc=; b=C7O49/VNKptjw/lBpQwmcIz0a8sArXeQ42cXcwYltCRPre0Vtqll5m97ztrXC62a7W QUZTB4QvdtN4Bqoiss33Thm/ckIzSGOux1JMfrkRwZr9APo6equSusZ7s6DSNDwT+4cg NRVEPHW9sv3KKsX6+VQjMw0yqUw5Ki51pUJg6NvKOcEvW0VFt+5TSfgi6+0FNZPB/bMN u9uGqCZ+kLYV4MUdExkun7mKU3qfokzowai0+M3L7hwDVps2X/TDyuTA/+pPy14PLzRY EPgAlrIaMlmCSVJNVsvBpU+jNp+H+/aF+RvaII931y/cYa3tr4y15JqSmybv8MMeWauH NE1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=utC88xO/3DQklGM/YS6f9zgx+KbjPZZi5VnmSXETSAc=; b=krCGMkbKDBysm5D/oSgC4pBG9UUOQnbPJI3gJsfopgmjT8apXsGF4la0milV/CPe4h aD/DS62trob5/9G8KYyfVQwq9iMn+xQoN0R8inMcdJBSoIuAlBqlqgbnwk5QnCdov3vo asMy3K0dCku+GQO+lY7+S5dlFC07G1Ws7y1ur1rM6ZPSFFcCg5DWFEWDRt7nKpAJCCfU 9zzwloKSJLlfz6poTRzvDxJ4YiijWnH4c9GM282ztNjL9taX8zbG+wH1fpyYJQl0NtgG 1eZpj8lmBD+EYqUjwQZgVPAWPCOP952YUmghh7WpMsccc5mJ/K6vqNP5TmV7esYy7EwC d0Zg== X-Gm-Message-State: ANhLgQ2voZMKYu+rVBZxazmgUDUApNBuwRiCnwuYXLXTiMvyYiCVtgXY KpSuG9gl4VfrJYEBda9L8y+Q1HZqQFUy1w== X-Received: by 2002:a17:90a:a386:: with SMTP id x6mr2667641pjp.108.1583859655698; Tue, 10 Mar 2020 10:00:55 -0700 (PDT) Date: Tue, 10 Mar 2020 10:00:38 -0700 Message-Id: <20200310095959.1.I864ded253b57454e732ab5acb1cae5b22c67cfae@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog Subject: [PATCH] Bluetooth: include file and function names in logs From: Manish Mandlik To: marcel@holtmann.org Cc: Joseph Hwang , Yoni Shavit , Miao-chen Chou , Alain Michaud , linux-bluetooth@vger.kernel.org, Manish Mandlik , "David S. Miller" , Johan Hedberg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Kicinski Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Joseph Hwang 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__) -- 2.25.1.481.gfbce0eb801-goog