From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388737; b=DzqapWtWprn9OG6Pa6cqweG7J0dZbuvWtv5LgxRBVoM4hRFlQFkSR6BDXMQXk6wyI/pE r0t3v93Jj6STpLbk4GzHe/75BlCpCKpwSgPXk6kKOwm1cHtfhqSwDIi7hNyDoxIN9ZrrJ vH67/jl3hvp5jDgab4oLzfYMwnGEaSrEqfhW0AJ5YyZkufgHUYXxTbnUi/Vkxj3HZdNmw qadHB7m0IcKBEo2M04gw40qMqjbMAlxiBfWYYm70bAFHpoOvKCmZr92CZwNu5i8XelHUW fJySY6V/ouyojOX58y15/GOtIERWaB0g+wMUFpZD3uP4W1HvvfHoIohqOqN6whX/THg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388737; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=+PdsOCm+8vMBqwSvEvWDm/UIMOM/Iq3YSkfvtg8Z1Gk=; b=RK3KNplItE/WWycpmqQ2cTA2pve6rDmvXsB2xUr7vhgTkuzh/x5Ct3aTzU/mEcPydgdd vBZYwtCFbYmjhD1Vvxhxaq+ppvRX1weiQy8++BDFios0JwnsiUPYB6AXWDdUPYq6AI4RE 5Tyqhvnfc0pCa2iv7X0xoR69FXJMMFxCt1vnge9YyUleu7L1YA5ducWrSs1cO6rrx7TDL WSljMtGPApCzCXNNe/G5Ju1mM/kotTaNKpqseCqaJal6x/avr7IArmhcdkv7Z833tgyIp n8tnyAqQ7I3bV1Iq46UtEZIkMp+sl/Z9M2yzxyrDtc5TTBrhP/NEhoXiHexFzstNphw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=tU97ZgSP; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 696BE606A33D; Fri, 4 Dec 2026 12:52:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=tU97ZgSP Received: by smtp.kernel.org (Postfix) with ESMTPSA id D04091F00897; Fri, 4 Dec 2026 12:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388737; bh=+PdsOCm+8vMBqwSvEvWDm/UIMOM/Iq3YSkfvtg8Z1Gk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tU97ZgSPg+scP5sJAGf+mqlzH9P2p9d5xtpN0lVq8txv9aUstlf1kgord7mMwrztO Cnd3DtmIW4hH4UbcXYaJUcmYO9QKNB/wLE77YWFAJZpGAvYjcofYkFcsvn5r8ef2jL UJ6MLcjeFePL62I/vSDpX7YmuTso44c1FILCX8Mg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrey Skvortsov , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.1 0734/1059] Bluetooth: hci_h5: Add ability to allocate memory for private data Date: Fri, 4 Dec 2026 19:04:25 +0900 Message-ID: <20261204100702.987624255@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrey Skvortsov [ Upstream commit 7a6d793e9ca8bc0c1d2f0aa0a02ec380d1124c74 ] In some cases uart-base drivers may need to use priv data. For example, to store information needed for devcoredump. Fixes: 044014ce85a1 ("Bluetooth: btrtl: Add Realtek devcoredump support") Signed-off-by: Andrey Skvortsov Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_h5.c | 4 +++- drivers/bluetooth/hci_serdev.c | 9 +++++---- drivers/bluetooth/hci_uart.h | 12 +++++++++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index c93307c9595e6..6d9ccf104d95c 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -113,6 +113,7 @@ struct h5_vnd { int (*suspend)(struct h5 *h5); int (*resume)(struct h5 *h5); const struct acpi_gpio_mapping *acpi_gpio_map; + int sizeof_priv; }; struct h5_device_data { @@ -861,7 +862,8 @@ static int h5_serdev_probe(struct serdev_device *serdev) if (IS_ERR(h5->device_wake_gpio)) return PTR_ERR(h5->device_wake_gpio); - return hci_uart_register_device(&h5->serdev_hu, &h5p); + return hci_uart_register_device_priv(&h5->serdev_hu, &h5p, + h5->vnd->sizeof_priv); } static void h5_serdev_remove(struct serdev_device *serdev) diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index 158b057ed3a6d..753343ca84895 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -300,8 +300,9 @@ static const struct serdev_device_ops hci_serdev_client_ops = { .write_wakeup = hci_uart_write_wakeup, }; -int hci_uart_register_device(struct hci_uart *hu, - const struct hci_uart_proto *p) +int hci_uart_register_device_priv(struct hci_uart *hu, + const struct hci_uart_proto *p, + int sizeof_priv) { int err; struct hci_dev *hdev; @@ -325,7 +326,7 @@ int hci_uart_register_device(struct hci_uart *hu, set_bit(HCI_UART_PROTO_READY, &hu->flags); /* Initialize and register HCI device */ - hdev = hci_alloc_dev(); + hdev = hci_alloc_dev_priv(sizeof_priv); if (!hdev) { BT_ERR("Can't allocate HCI device"); err = -ENOMEM; @@ -389,7 +390,7 @@ int hci_uart_register_device(struct hci_uart *hu, percpu_free_rwsem(&hu->proto_lock); return err; } -EXPORT_SYMBOL_GPL(hci_uart_register_device); +EXPORT_SYMBOL_GPL(hci_uart_register_device_priv); void hci_uart_unregister_device(struct hci_uart *hu) { diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h index 70449949d5276..39f39704be41f 100644 --- a/drivers/bluetooth/hci_uart.h +++ b/drivers/bluetooth/hci_uart.h @@ -97,7 +97,17 @@ struct hci_uart { int hci_uart_register_proto(const struct hci_uart_proto *p); int hci_uart_unregister_proto(const struct hci_uart_proto *p); -int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *p); + +int hci_uart_register_device_priv(struct hci_uart *hu, + const struct hci_uart_proto *p, + int sizeof_priv); + +static inline int hci_uart_register_device(struct hci_uart *hu, + const struct hci_uart_proto *p) +{ + return hci_uart_register_device_priv(hu, p, 0); +} + void hci_uart_unregister_device(struct hci_uart *hu); int hci_uart_tx_wakeup(struct hci_uart *hu); -- 2.53.0