Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp480465rdd; Tue, 9 Jan 2024 09:49:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFm6eX2v+RMfRKC80B7jia8ZpqojZEyiKdIo76tO0BarOQZYNYnI8NYwJ/WLFFDtx4+TOq5 X-Received: by 2002:a05:620a:178b:b0:783:2e0d:9784 with SMTP id ay11-20020a05620a178b00b007832e0d9784mr1391839qkb.4.1704822590669; Tue, 09 Jan 2024 09:49:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704822590; cv=none; d=google.com; s=arc-20160816; b=l7EyP3CYVRpb4YqZrdroimUU26IXNNkAl9C3gj72PWdPwW1YTj0k7BHOmyvOKnUot0 KPN8EkntW+CoSUY0TDc0mvu+QlMSXa5H+dZEBqmru66rkNRb2G7+i2ndMQ9+WiuDmxSJ HiTHI4pi35EtrzEl9ioRiA5VXKWyeoAnKxsULaWt6oav/ZBKh6HDGmE1+sE7TAIh0vIz x74xDDDPKE84rEc8J3C7DLJBUEevdlAtd4BicGSRREpx01jKmYZ7tCo5nWX55wSVWssy ddUDjgx+ac3eeYdyCxV4rDDJzfKfA8/tzkEpIE4kh4NtyRmJG+2ykD2Kxj0DEVjhW6vx gtwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=CALQPjgbYuWBGZQs8nNVBq5T/HxB3E5FfujH1TM+1jA=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=aDVkQ3PvwQE2RQt4SivVD36GrvEaM8IJbPd9/fRLwghA6fQus6B/SpkV+NmbdTIml0 u0Yv5MFEgtVGfDRegv7tyZW6KObjuH/QXaBLC4sQrIzHvjR0f+ROYU8IsQp3qARNOi5c 2GeyTWqupXs3RzJTE1ulznXDLEQxl4uAeeGITabSMcqkcm5amfO4HKJ7pPkog1YEB2rB pzWPt4QlPN0HkxNB5u4pr+xY9abelfYh0wYeWWpZyW1ahFiHQy6dH1+4dvg/Jq5dFsAy Qy2ItdlEM7SpCOPEkocdWTXYWKF5TffW2mHAmzdY6tT3apM8Rr35SZQVb7Vl3o3pfBzB v+xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BMCWilw1; spf=pass (google.com: domain of linux-bluetooth+bounces-1003-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1003-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 30-20020a05620a041e00b007832c3d6ffasi2289091qkp.267.2024.01.09.09.49.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 09:49:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1003-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BMCWilw1; spf=pass (google.com: domain of linux-bluetooth+bounces-1003-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1003-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 621A81C23F28 for ; Tue, 9 Jan 2024 17:49:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20CC83BB47; Tue, 9 Jan 2024 17:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BMCWilw1" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 324823BB3E for ; Tue, 9 Jan 2024 17:49:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-5988e55ede0so160519eaf.2 for ; Tue, 09 Jan 2024 09:49:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704822573; x=1705427373; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=CALQPjgbYuWBGZQs8nNVBq5T/HxB3E5FfujH1TM+1jA=; b=BMCWilw1UgOdrfSBRpzrxWYOPLpkmmqq/0U4a3bMl6NQ1/sGtvXpzwnpKuO9NLCdG+ UO5C8kHntmWyc02Fa9uhD25EGxi912ZPftdoSCzcPn+uPC1fxtCbP30o1/THk6MGLgSf LOn/Hn3sYcs7fqcUdIbYZoTy00vu/k2Km3aPAgsLR8j6Glc0EkGzRkIxXnf8mSs1sCz6 YN3SrzkvH6xgaIwoKmovbtT+VMfqMt745JVnxKJ2UjhtjaXYZt1INT3M7SPmiq3ygXM+ HJbKEf7CFwXgPUunYiZs3bjaShAP9vBOic2kYCipnCHHNTC4OPWTsatZhwzm+qF+JadO CT/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704822573; x=1705427373; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CALQPjgbYuWBGZQs8nNVBq5T/HxB3E5FfujH1TM+1jA=; b=uHdASh1Lh0vlWWl2TGvaP4bacAG/ceE/jra/u8lTsfuxR8ZjkSMhfkdoSXQuD+1KJJ xsivOlEU3a+6NhC1o6Cxp/cQfe5UifpDoOZ7ZWJkFr3JyQxHmfSgx0vNvBamDoiljitj 0a5JgbONQQY4BJP/V8vz2eMhbvpp2zfq9tTtMpAi8GvGdTkFo5Ua483vmfvE2QMOmLvJ iCsXtGJTYXk1fNLZS4xR0cPgZj9j7leH9YkvRwfHO6ZMnPQgm/NQB+JvA0GZS16SdAdM d7nzYbxQYhyy6Css55DEmidcjT9iVBGqzkKeVyCDdnNlOVJmbQ9wpKd7yDeyEqRzCUPt h1xA== X-Gm-Message-State: AOJu0Yy8v6pXp73r64onrmDuc47lO4UpPeVG9F73Co2agsTV9W0muee2 6jJo6jw8ZYcF9kkVd3oNyhuSaerMugo= X-Received: by 2002:a05:6820:240c:b0:593:fb56:1206 with SMTP id cp12-20020a056820240c00b00593fb561206mr4171858oob.17.1704822573507; Tue, 09 Jan 2024 09:49:33 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id o184-20020a4a44c1000000b00595e66557e6sm476814ooa.6.2024.01.09.09.49.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 09:49:31 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v4 2/4] Bluetooth: hci_event: Use HCI error defines instead of magic values Date: Tue, 9 Jan 2024 12:49:26 -0500 Message-ID: <20240109174928.488595-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240109174928.488595-1-luiz.dentz@gmail.com> References: <20240109174928.488595-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jonas Dreßler We have error defines already, so let's use them. Signed-off-by: Jonas Dreßler Signed-off-by: Luiz Augusto von Dentz --- include/net/bluetooth/hci.h | 2 ++ net/bluetooth/hci_event.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index a94a8491ec7a..1cd212bb3789 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -653,6 +653,7 @@ enum { #define HCI_ERROR_PIN_OR_KEY_MISSING 0x06 #define HCI_ERROR_MEMORY_EXCEEDED 0x07 #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 +#define HCI_ERROR_COMMAND_DISALLOWED 0x0c #define HCI_ERROR_REJ_LIMITED_RESOURCES 0x0d #define HCI_ERROR_REJ_BAD_ADDR 0x0f #define HCI_ERROR_INVALID_PARAMETERS 0x12 @@ -661,6 +662,7 @@ enum { #define HCI_ERROR_REMOTE_POWER_OFF 0x15 #define HCI_ERROR_LOCAL_HOST_TERM 0x16 #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 +#define HCI_ERROR_UNSUPPORTED_REMOTE_FEATURE 0x1e #define HCI_ERROR_INVALID_LL_PARAMS 0x1e #define HCI_ERROR_UNSPECIFIED 0x1f #define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 23e0e63ac312..6130c969f361 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -95,11 +95,11 @@ static u8 hci_cc_inquiry_cancel(struct hci_dev *hdev, void *data, /* It is possible that we receive Inquiry Complete event right * before we receive Inquiry Cancel Command Complete event, in * which case the latter event should have status of Command - * Disallowed (0x0c). This should not be treated as error, since + * Disallowed. This should not be treated as error, since * we actually achieve what Inquiry Cancel wants to achieve, * which is to end the last Inquiry session. */ - if (rp->status == 0x0c && !test_bit(HCI_INQUIRY, &hdev->flags)) { + if (rp->status == HCI_ERROR_COMMAND_DISALLOWED && !test_bit(HCI_INQUIRY, &hdev->flags)) { bt_dev_warn(hdev, "Ignoring error of Inquiry Cancel command"); rp->status = 0x00; } @@ -2342,7 +2342,7 @@ static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) if (status) { if (conn && conn->state == BT_CONNECT) { - if (status != 0x0c || conn->attempt > 2) { + if (status != HCI_ERROR_COMMAND_DISALLOWED || conn->attempt > 2) { conn->state = BT_CLOSED; hci_connect_cfm(conn, status); hci_conn_del(conn); @@ -6679,7 +6679,7 @@ static void hci_le_remote_feat_complete_evt(struct hci_dev *hdev, void *data, * transition into connected state and mark it as * successful. */ - if (!conn->out && ev->status == 0x1a && + if (!conn->out && ev->status == HCI_ERROR_UNSUPPORTED_REMOTE_FEATURE && (hdev->le_features[0] & HCI_LE_PERIPHERAL_FEATURES)) status = 0x00; else -- 2.43.0