Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1171266imm; Sun, 15 Jul 2018 00:53:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd+Z/PXc6mZb1xRqE3AMrFX9B1zk8gLVTBwj+nUJA95d+DjVyW6GtQiyDIQz5fBVxndP+2Z X-Received: by 2002:a17:902:8541:: with SMTP id d1-v6mr12578953plo.81.1531641233718; Sun, 15 Jul 2018 00:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531641233; cv=none; d=google.com; s=arc-20160816; b=E868TcY7vKCtLao3Z/XxEN0cs7ih73/+eVjo9zJJO7S/Ge83RRIANKYBav/6Hb6vGK jVGc8itpgFX4clalBbX2yQJ3Kfwi/laQpGhIrRDcoYifu2kZ2vSbu78nBAGPGgy6KjXU ToGTW4BFO7h/DgQ6dV7oR8VhS8a7g/H9oIbngxtayL0t6iRSNB7H8TT6S6SGLv4ovg7S DwAdKgyYYj+P1et97dyOy8QtYygupo2eBBaVCwdJdLlnyvKZB0ZUcdNe/jb/tBP/vLL7 yn7kqOXObful4sX7fYr9VuPLB6QcrhuHP57jk76EZzv4BdL+WBy6Sgwg4DXl7a0+IldH a64w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=Ny6Jmd2iwnSzNRvxHxj/Cl6Trsnmbh+EyUtcgo/aBFQ=; b=pgtxWyOCDM72ybdtIDOxQ6RAYxyuPhD7p+n2TqDB329IeA1otfV6xnkpzvjMO6Y20V uBt5xOuPsr22NXc71jIKfb5us1kIYR1Xs/7BdB/qVmjCkUTrhjTKga65066rlvDc8xu4 PPJPxFrtflAHGuimydkbEu3z0QAm0dve7TuF3+LbUSAxVjGVADxPOsCRJHYKSULzN8sH LqKHOgD6hWF+gzkzlWmqRCQHcbTbMjBcqC1yknPBJ5oUgh29JpgY1SMfL/YUrQE5HCf/ Erc+aHIOqQw3A3lIldxrqi0QUMu08nJugFZZaCnmJFj6UUZmp/1vkkVN5dNONWJPsdoq hjBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8-v6si26158796pgn.473.2018.07.15.00.53.24; Sun, 15 Jul 2018 00:53:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726197AbeGOIOd (ORCPT + 99 others); Sun, 15 Jul 2018 04:14:33 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:9476 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725948AbeGOIOd (ORCPT ); Sun, 15 Jul 2018 04:14:33 -0400 X-UUID: e603597b80c8433d916e790c5275853d-20180715 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1969547162; Sun, 15 Jul 2018 15:52:22 +0800 Received: from MTKMBS06N1.mediatek.inc (172.21.101.129) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sun, 15 Jul 2018 15:52:15 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sun, 15 Jul 2018 15:52:14 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Sun, 15 Jul 2018 15:52:14 +0800 Message-ID: <1531641134.3955.19.camel@mtkswgap22> Subject: Re: [PATCH v5 5/7] Bluetooth: Extend btuart driver for join more vendor devices From: Sean Wang To: Marcel Holtmann CC: , , Johan Hedberg , , , , , Date: Sun, 15 Jul 2018 15:52:14 +0800 In-Reply-To: <70616B99-5A2D-417A-8815-246700EEF4E2@holtmann.org> References: <85d449cdd34bf47d72935a821915e825c64a2145.1531150733.git.sean.wang@mediatek.com> <70616B99-5A2D-417A-8815-246700EEF4E2@holtmann.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2018-07-14 at 18:44 +0200, Marcel Holtmann wrote: > Hi Sean, > > > Adding an independent btuart.h header allows these essential definitions > > can be reused in vendor driver. Also, struct btuart_vnd is extended with > > additional callbacks such as .init initializing vendor data, .shtudown, > > .recv and .send supporting SoC specific framing for that btuart can > > simply adapt to various Bluetooth uart-based devices. > > > > Signed-off-by: Sean Wang > > --- > > drivers/bluetooth/btuart.c | 73 ++++++++++++++++++++++++---------------------- > > drivers/bluetooth/btuart.h | 30 +++++++++++++++++++ > > 2 files changed, 68 insertions(+), 35 deletions(-) > > create mode 100644 drivers/bluetooth/btuart.h > > > > diff --git a/drivers/bluetooth/btuart.c b/drivers/bluetooth/btuart.c > > index a900aac..65d0086 100644 > > --- a/drivers/bluetooth/btuart.c > > +++ b/drivers/bluetooth/btuart.c > > @@ -33,35 +33,11 @@ > > #include > > > > #include "h4_recv.h" > > +#include "btuart.h" > > #include "btbcm.h" > > > > #define VERSION "1.0" > > > > -struct btuart_vnd { > > - const struct h4_recv_pkt *recv_pkts; > > - int recv_pkts_cnt; > > - unsigned int manufacturer; > > - int (*open)(struct hci_dev *hdev); > > - int (*close)(struct hci_dev *hdev); > > - int (*setup)(struct hci_dev *hdev); > > -}; > > - > > -struct btuart_dev { > > - struct hci_dev *hdev; > > - struct serdev_device *serdev; > > - > > - struct work_struct tx_work; > > - unsigned long tx_state; > > - struct sk_buff_head txq; > > - > > - struct sk_buff *rx_skb; > > - > > - const struct btuart_vnd *vnd; > > -}; > > I really like to avoid this since it is not clean. Frankly I prefer to keep the btuart.c driver for drivers that really just use H:4 as transport protocol. If the protocol is only H:4 alike and has extra headers, then it should be a separate driver. > thanks for letting me know your concern. I think I'm a little over in reusing these existing methods and break something generic and its beauty. I'll make the driver be a separate one based on btuart in the next version. > The common H:4 handling is abstracted in h4_recv.h already anyway and we can add more pieces if needed. However I also wonder since you have extra framing that the complex H:4 state keeping might be not needed at all. So it could be simplified. > okay, I will get rid of h4_recv.h and consider to use more simplified logic to handle the extra framing and its payload. > Regards > > Marcel > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek