From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v1 2/6] Bluetooth: hci_conn: Convert instances of BT_DBG to bt_dev_dbg
Date: Fri, 15 Aug 2025 17:44:01 -0400 [thread overview]
Message-ID: <20250815214406.514260-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20250815214406.514260-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This converts instances of BT_DBG to bt_dev_dbg when logging to a
specific hci_dev this is preferable since it does prints the name by
default.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
net/bluetooth/hci_conn.c | 63 ++++++++++++++++++++++------------------
1 file changed, 34 insertions(+), 29 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 7a879290dd28..2cafdc2d6f2b 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -179,7 +179,7 @@ static void hci_conn_cleanup(struct hci_conn *conn)
int hci_disconnect(struct hci_conn *conn, __u8 reason)
{
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(conn->hdev, "hcon %p", conn);
/* When we are central of an established connection and it enters
* the disconnect timeout, then go ahead and try to read the
@@ -204,7 +204,7 @@ static void hci_add_sco(struct hci_conn *conn, __u16 handle)
struct hci_dev *hdev = conn->hdev;
struct hci_cp_add_sco cp;
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(hdev, "hcon %p", conn);
conn->state = BT_CONNECT;
conn->out = true;
@@ -227,8 +227,9 @@ static bool find_next_esco_param(struct hci_conn *conn,
if (lmp_esco_2m_capable(conn->parent) ||
(esco_param[conn->attempt - 1].pkt_type & ESCO_2EV3))
break;
- BT_DBG("hcon %p skipped attempt %d, eSCO 2M not supported",
- conn, conn->attempt);
+ bt_dev_dbg(conn->hdev,
+ "hcon %p skipped attempt %d, eSCO 2M not supported",
+ conn, conn->attempt);
}
return conn->attempt <= size;
@@ -524,7 +525,7 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
struct hci_dev *hdev = conn->hdev;
struct hci_cp_le_start_enc cp;
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(hdev, "hcon %p", conn);
memset(&cp, 0, sizeof(cp));
@@ -545,7 +546,7 @@ void hci_sco_setup(struct hci_conn *conn, __u8 status)
if (!link || !link->conn)
return;
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(conn->hdev, "hcon %p", conn);
if (!status) {
if (lmp_esco_capable(conn->hdev))
@@ -564,7 +565,8 @@ static void hci_conn_timeout(struct work_struct *work)
disc_work.work);
int refcnt = atomic_read(&conn->refcnt);
- BT_DBG("hcon %p state %s", conn, state_to_string(conn->state));
+ bt_dev_dbg(conn->hdev, "hcon %p state %s", conn,
+ state_to_string(conn->state));
WARN_ON(refcnt < 0);
@@ -588,7 +590,7 @@ static void hci_conn_idle(struct work_struct *work)
idle_work.work);
struct hci_dev *hdev = conn->hdev;
- BT_DBG("hcon %p mode %d", conn, conn->mode);
+ bt_dev_dbg(hdev, "hcon %p mode %d", conn, conn->mode);
if (!lmp_sniff_capable(hdev) || !lmp_sniff_capable(conn))
return;
@@ -648,7 +650,7 @@ static void le_conn_timeout(struct work_struct *work)
le_conn_timeout.work);
struct hci_dev *hdev = conn->hdev;
- BT_DBG("");
+ bt_dev_dbg(hdev, "");
/* We could end up here due to having done directed advertising,
* so clean up the state if necessary. This should however only
@@ -776,7 +778,8 @@ static int hci_le_big_terminate(struct hci_dev *hdev, u8 big, struct hci_conn *c
struct iso_list_data *d;
int ret;
- bt_dev_dbg(hdev, "big 0x%2.2x sync_handle 0x%4.4x", big, conn->sync_handle);
+ bt_dev_dbg(hdev, "big 0x%2.2x sync_handle 0x%4.4x", big,
+ conn->sync_handle);
d = kzalloc(sizeof(*d), GFP_KERNEL);
if (!d)
@@ -822,7 +825,7 @@ static void bis_cleanup(struct hci_conn *conn)
struct hci_dev *hdev = conn->hdev;
struct hci_conn *bis;
- bt_dev_dbg(hdev, "conn %p", conn);
+ bt_dev_dbg(hdev, "hcon %p", conn);
if (conn->role == HCI_ROLE_MASTER) {
if (!test_and_clear_bit(HCI_CONN_PER_ADV, &conn->flags))
@@ -1144,7 +1147,7 @@ void hci_conn_del(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
- BT_DBG("%s hcon %p handle %d", hdev->name, conn, conn->handle);
+ bt_dev_dbg(hdev, "hcon %p handle %d", conn, conn->handle);
hci_conn_unlink(conn);
@@ -1443,8 +1446,8 @@ static int hci_explicit_conn_params_set(struct hci_dev *hdev,
params->explicit_connect = true;
- BT_DBG("addr %pMR (type %u) auto_connect %u", addr, addr_type,
- params->auto_connect);
+ bt_dev_dbg(hdev, "addr %pMR (type %u) auto_connect %u", addr, addr_type,
+ params->auto_connect);
return 0;
}
@@ -1595,7 +1598,7 @@ struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst,
goto done;
}
- BT_DBG("requesting refresh of dst_addr");
+ bt_dev_dbg(hdev, "requesting refresh of dst_addr");
conn = hci_conn_add_unset(hdev, LE_LINK, dst, HCI_ROLE_MASTER);
if (IS_ERR(conn))
@@ -2141,7 +2144,7 @@ static void create_big_complete(struct hci_dev *hdev, void *data, int err)
{
struct hci_conn *conn = data;
- bt_dev_dbg(hdev, "conn %p", conn);
+ bt_dev_dbg(hdev, "hcon %p", conn);
if (err) {
bt_dev_err(hdev, "Unable to create BIG: %d", err);
@@ -2322,7 +2325,7 @@ struct hci_conn *hci_connect_cis(struct hci_dev *hdev, bdaddr_t *dst,
/* Check link security requirement */
int hci_conn_check_link_mode(struct hci_conn *conn)
{
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(conn->hdev, "hcon %p", conn);
/* In Secure Connections Only mode, it is required that Secure
* Connections is used and the link is encrypted with AES-CCM
@@ -2362,7 +2365,7 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
/* Authenticate remote device */
static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
{
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(conn->hdev, "hcon %p", conn);
if (conn->pending_sec_level > sec_level)
sec_level = conn->pending_sec_level;
@@ -2397,7 +2400,7 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
/* Encrypt the link */
static void hci_conn_encrypt(struct hci_conn *conn)
{
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(conn->hdev, "hcon %p", conn);
if (!test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) {
struct hci_cp_set_conn_encrypt cp;
@@ -2412,7 +2415,8 @@ static void hci_conn_encrypt(struct hci_conn *conn)
int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type,
bool initiator)
{
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(conn->hdev, "hcon %p sec_level %d auth_type %d initiator %d",
+ conn, sec_level, auth_type, initiator);
if (conn->type == LE_LINK)
return smp_conn_security(conn, sec_level);
@@ -2496,7 +2500,7 @@ EXPORT_SYMBOL(hci_conn_security);
/* Check secure link requirement */
int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level)
{
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(conn->hdev, "hcon %p sec_level %u", conn, sec_level);
/* Accept if non-secure or higher security level is required */
if (sec_level != BT_SECURITY_HIGH && sec_level != BT_SECURITY_FIPS)
@@ -2515,7 +2519,7 @@ EXPORT_SYMBOL(hci_conn_check_secure);
/* Switch role */
int hci_conn_switch_role(struct hci_conn *conn, __u8 role)
{
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(conn->hdev, "hcon %p role %u", conn, role);
if (role == conn->role)
return 1;
@@ -2536,7 +2540,7 @@ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active)
{
struct hci_dev *hdev = conn->hdev;
- BT_DBG("hcon %p mode %d", conn, conn->mode);
+ bt_dev_dbg(hdev, "hcon %p mode %d", conn, conn->mode);
if (conn->mode != HCI_CM_SNIFF)
goto timer;
@@ -2562,7 +2566,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev)
struct list_head *head = &hdev->conn_hash.list;
struct hci_conn *conn;
- BT_DBG("hdev %s", hdev->name);
+ bt_dev_dbg(hdev, "");
/* We should not traverse the list here, because hci_conn_del
* can remove extra links, which may cause the list traversal
@@ -2705,10 +2709,10 @@ struct hci_chan *hci_chan_create(struct hci_conn *conn)
struct hci_dev *hdev = conn->hdev;
struct hci_chan *chan;
- BT_DBG("%s hcon %p", hdev->name, conn);
+ bt_dev_dbg(hdev, "hcon %p", conn);
if (test_bit(HCI_CONN_DROP, &conn->flags)) {
- BT_DBG("Refusing to create new hci_chan");
+ bt_dev_dbg(hdev, "Refusing to create new hci_chan");
return NULL;
}
@@ -2730,7 +2734,7 @@ void hci_chan_del(struct hci_chan *chan)
struct hci_conn *conn = chan->conn;
struct hci_dev *hdev = conn->hdev;
- BT_DBG("%s hcon %p chan %p", hdev->name, conn, chan);
+ bt_dev_dbg(hdev, "hcon %p chan %p", conn, chan);
list_del_rcu(&chan->list);
@@ -2749,7 +2753,7 @@ void hci_chan_list_flush(struct hci_conn *conn)
{
struct hci_chan *chan, *n;
- BT_DBG("hcon %p", conn);
+ bt_dev_dbg(conn->hdev, "hcon %p", conn);
list_for_each_entry_safe(chan, n, &conn->chan_list, list)
hci_chan_del(chan);
@@ -2910,7 +2914,8 @@ int hci_abort_conn(struct hci_conn *conn, u8 reason)
if (conn->abort_reason)
return 0;
- bt_dev_dbg(hdev, "handle 0x%2.2x reason 0x%2.2x", conn->handle, reason);
+ bt_dev_dbg(hdev, "hcon %p handle 0x%2.2x reason 0x%2.2x", conn,
+ conn->handle, reason);
conn->abort_reason = reason;
--
2.50.1
next prev parent reply other threads:[~2025-08-15 21:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 21:44 [PATCH v1 1/6] Bluetooth: hci_core: Convert instances of BT_DBG to bt_dev_dbg Luiz Augusto von Dentz
2025-08-15 21:44 ` Luiz Augusto von Dentz [this message]
2025-08-15 21:44 ` [PATCH v1 3/6] Bluetooth: hci_event: " Luiz Augusto von Dentz
2025-08-15 21:44 ` [PATCH v1 4/6] Bluetooth: hci_sock: " Luiz Augusto von Dentz
2025-08-15 21:44 ` [PATCH v1 5/6] Bluetooth: hci_sync: " Luiz Augusto von Dentz
2025-08-15 21:44 ` [PATCH v1 6/6] Bluetooth: hci: Add hci_conn_set_state Luiz Augusto von Dentz
2025-08-15 22:17 ` [v1,1/6] Bluetooth: hci_core: Convert instances of BT_DBG to bt_dev_dbg bluez.test.bot
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=20250815214406.514260-2-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox