Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752795AbcD2KZe (ORCPT ); Fri, 29 Apr 2016 06:25:34 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:52437 "EHLO mx0a-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588AbcD2KZc (ORCPT ); Fri, 29 Apr 2016 06:25:32 -0400 From: Amitkumar Karwar To: CC: , Ganapathi Bhat , Amitkumar Karwar Subject: [PATCH v9 1/3] Bluetooth: hci_uart: add prepare callback Date: Fri, 29 Apr 2016 03:24:36 -0700 Message-ID: <1461925478-31851-1-git-send-email-akarwar@marvell.com> X-Mailer: git-send-email 1.7.3.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-04-29_06:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1604290162 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1501 Lines: 44 From: Ganapathi Bhat This new uart protocol callback is used to prepare the device before HCI becomes ready. One can use this to download firmware if the download process doesn't use HCI commands. Signed-off-by: Ganapathi Bhat Signed-off-by: Amitkumar Karwar --- drivers/bluetooth/hci_ldisc.c | 6 ++++++ drivers/bluetooth/hci_uart.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 49b3e1e..075a82d 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -641,6 +641,12 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id) hu->proto = p; set_bit(HCI_UART_PROTO_READY, &hu->flags); + if (p->prepare) { + err = p->prepare(hu); + if (err) + return err; + } + err = hci_uart_register_dev(hu); if (err) { clear_bit(HCI_UART_PROTO_READY, &hu->flags); diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h index 839bad1..ad4d66b 100644 --- a/drivers/bluetooth/hci_uart.h +++ b/drivers/bluetooth/hci_uart.h @@ -67,6 +67,7 @@ struct hci_uart_proto { int (*close)(struct hci_uart *hu); int (*flush)(struct hci_uart *hu); int (*setup)(struct hci_uart *hu); + int (*prepare)(struct hci_uart *hu); int (*set_baudrate)(struct hci_uart *hu, unsigned int speed); int (*recv)(struct hci_uart *hu, const void *data, int len); int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb); -- 1.8.1.4