Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1910969rdb; Mon, 8 Jan 2024 14:47:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEz+X7yDAaBkvmr6hI6STJoYd+ma+201Qodc++kHGyYeg8+gLZjZE3lYBkPVd04vnMO9EJC X-Received: by 2002:a05:620a:430b:b0:783:23ea:8aa8 with SMTP id u11-20020a05620a430b00b0078323ea8aa8mr1778335qko.52.1704754052408; Mon, 08 Jan 2024 14:47:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704754052; cv=none; d=google.com; s=arc-20160816; b=tLeLN8wFkawSLXeqpjuSysCvlirocFny0GkdaNIsYANFAdj7E4nXepgwo4oNbE9GUs RysLYg1mMPICBu5CjEjuaOI5c4UVYA7lf4PdUbJM+3hVcO97+SFkJwWTOVptQhsOrBNP nMFOI368dLiOo6d6pA+QKUyFt2DiQfvgdaiJNW8OkcdmWOfW1Mh6ZSZzSxnK9Fxm76Yp bEpEx7Pz142dBFsTe54ECCsH123oXypF+qTqaV1DKHAC1WU+YSW9tvDUXhpiGe4sZyJj 8loGH2eDZhhnPj+sztRd0yyCg0yujC0UsJpRJWb5kAdvAejTEsiQ/egnqD5omKf54F5r DSZw== 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:cc:to:from; bh=b4UkFMx240jn6WjIAxqmBs/yAZe5umDjmXYJPY6CaHY=; fh=3AqDzvZy8BuFcn015+g5AB3sGQnZc/edyFwniXfpO+U=; b=BsC1DR2IGi7plUOaiGJwBqN6FVdFuBGRILPWODXdUHhPU0cz3sNlnZwjv+Y8USHJKE k5U+URsCFUyXqw5jo5MXvHr5KawS1Vlrd1nqAHlBRD9GCxoqGiQufc/El1QTlhUVR0od PSjhIZNs7SqCxxaAx08de7ohF5zXaK7kjEk/lbSpkE8Dpz1FqOlvtLQD55Qd0Bfn5dpU VCfwWorZ36OM5n8lUylXMN7Vkk1pBh/+evdIVhrB8AEW0/ghXlI31Vjz9T1E1ZjUVXr3 oaiI6WGRiCggCMa48SCN1GeoxrqJgEW0y4I9qVoQDePpiAEeiUXteybq+lcOOWVhr1f3 UrAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20160-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i8-20020a05620a404800b007830e1c409esi791558qko.673.2024.01.08.14.47.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 14:47:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20160-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; spf=pass (google.com: domain of linux-kernel+bounces-20160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20160-linux.lists.archive=gmail.com@vger.kernel.org" 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 1B2DA1C22D74 for ; Mon, 8 Jan 2024 22:47:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 276CA56B70; Mon, 8 Jan 2024 22:46:33 +0000 (UTC) Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C29B15647A; Mon, 8 Jan 2024 22:46:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=v0yd.nl Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4T88LW06kWz9srv; Mon, 8 Jan 2024 23:46:27 +0100 (CET) From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 2/4] Bluetooth: hci_event: Use HCI error defines instead of magic values Date: Mon, 8 Jan 2024 23:46:07 +0100 Message-ID: <20240108224614.56900-3-verdre@v0yd.nl> In-Reply-To: <20240108224614.56900-1-verdre@v0yd.nl> References: <20240108224614.56900-1-verdre@v0yd.nl> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4T88LW06kWz9srv We have error defines already, so let's use them. Signed-off-by: Jonas Dreßler --- 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 87d92accc..63f84e185 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -652,6 +652,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 @@ -660,6 +661,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 9423394f6..dcbba1521 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; } @@ -2326,7 +2326,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); @@ -6682,7 +6682,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