Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp681311imm; Sat, 14 Jul 2018 09:46:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdD1jzga0TLgE4Vzd+MU1f5cGMKFtx5sSVGBCK9ZEdZ5LjqRNMuVRGz79xwoiYWYiMYgy0L X-Received: by 2002:a62:be03:: with SMTP id l3-v6mr4102230pff.138.1531586779189; Sat, 14 Jul 2018 09:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531586779; cv=none; d=google.com; s=arc-20160816; b=hhJFsd8g8PpzICIdKoWM3rwj2hWY9ZjeW5hsJc5vUzGEHL9HRImdW4W8kAUWFkpZIp lxFfauuUErfddlnp5FSp6Hx9s8hNV4ntwz9Yz8/b/oX/Nc91zbfzs8t6wEZoVioDMGS/ rPpzlm2pABSH27OUgThXosccORFLTb2rvOekz/l9nZSR/ng/cCJTUxECRcf8KXR+he4t jIpJ7IrqJ4f5pvpYOFGztDW15Mh4aCOcSx5Ck6qJPfgTNN0tR8gOV65d6ECfWkUJO/T3 tXuoDMz4GCoestEiHmcEwRZ/R/+cGAEnQy5Xv3LexNeKo3sd69SEhQyxHsJw1QBhC1dM iwYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:arc-authentication-results; bh=QWw0G35LK+yaSm68kZ910MK+epQlS5dz+gWkvfuTHBA=; b=lTWTty0QHx6eFU+5fGPaFKlKKw0/V8AI3tdvR1uq6X2TefWI8qmKMtqEIJTTCR4oAy xpb1qGAmZ6+fpvlDlQjCLivSghPcF+KPz827jBMKmDSvmJGhtYHzRymgiNwLLKI6DKvi QjeBlG1UkSRTXVGMedF87o3WQGcJKo10ih8d2jRiJmSwkbtOO5NswA0fi9OI4R3uZTuY pobfm+sJOKqY9mEkrp9bQEVbdZMOXlucBSgfIsJ0XeNvLMtf0NQATR1oAk/zbOonr5gz rV7/Lk61D4RdESV7ct1CP9DnHY9z07VoHuqOhc86j6+zD8SrSUHefbEtWh1eXsHpu/t+ 8YVA== 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 s84-v6si27966735pfd.288.2018.07.14.09.45.49; Sat, 14 Jul 2018 09:46:19 -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 S1727679AbeGNREb convert rfc822-to-8bit (ORCPT + 99 others); Sat, 14 Jul 2018 13:04:31 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:48522 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726960AbeGNREb (ORCPT ); Sat, 14 Jul 2018 13:04:31 -0400 Received: from [192.168.0.117] (188.146.224.185.nat.umts.dynamic.t-mobile.pl [188.146.224.185]) by mail.holtmann.org (Postfix) with ESMTPSA id E83B0CF163; Sat, 14 Jul 2018 18:51:43 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: [PATCH v5 5/7] Bluetooth: Extend btuart driver for join more vendor devices From: Marcel Holtmann In-Reply-To: <85d449cdd34bf47d72935a821915e825c64a2145.1531150733.git.sean.wang@mediatek.com> Date: Sat, 14 Jul 2018 18:44:49 +0200 Cc: robh+dt@kernel.org, mark.rutland@arm.com, Johan Hedberg , devicetree@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <70616B99-5A2D-417A-8815-246700EEF4E2@holtmann.org> References: <85d449cdd34bf47d72935a821915e825c64a2145.1531150733.git.sean.wang@mediatek.com> To: sean.wang@mediatek.com X-Mailer: Apple Mail (2.3445.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. Regards Marcel