Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1616992ybl; Fri, 30 Aug 2019 22:32:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfDABoXCkHFpCMyoxuEuBah0+UFRrVwX6jACjYuqzRramLfbVApyIebdhZ7EgT45fwT0Ye X-Received: by 2002:a17:902:85:: with SMTP id a5mr19067410pla.294.1567229549205; Fri, 30 Aug 2019 22:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567229549; cv=none; d=google.com; s=arc-20160816; b=wALb+QdbR3JkGxPhve9osqlDXuAefTn/5p2MXmBf0fAwHQKcSlCWDvVlv1LGtDuj5f Jt6AbevN3sqw6kg0U7RUAtRFFYhKojIJx3uzewZvkWBJ3hoky+fbvisVmTBOStd7ERkN kR5O82XgxYtCFKJbpaA8UHdADGlBZMhECBSLXyV7uSgrr9sPhBrpC+9/Vy3c/GgUo9Ff fnzX0U6GkOi6sk+jNqpUs739hvzBgJYtJsvUwsZbU2dG4wrOh0hzFXL70XDLqW23mUdq UneQhVvhF6Ifo7n95ihakcTbUvSzgtnwfIixmJHHbjmpf/pEcHiP6vQCpMgfcCHRBO3n WNGA== 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; bh=q1h8X3EHIlrktFkdnOxXwM9dC4QQJhGe6uhV3ekV/kY=; b=iUdzKuYUCFESg0gCjTYWs57GbaSGOoZOU5WAMMQTc8PwG7aayVqHGDjy+x1mfRKRVf TUSLo6MV5++K+dx+ygKqfPAN/GJYLJ9W0jRYtmzUQxOOkvRG3RlLwT08pJ8fofojO5LA GOstyF4VMXR27WrHwqeOvoh1RJ6ZD+nAyqbmUzksJAnM4qBjtwQ8Yfsqkkx8oGVf+pVh Kqy4AOqaJLnSdekb5nx06x5a2Wpc0J6TOzRMGJ0wfhEtibdFFcZHj1VVk1sbN0lzbTvp YLqa8fOn2W+8JcfhIenVQ75DUiLo93Ql8aiUjohjOOM9tzAdfS5Juj6p9skDDoRKFS+M x9GA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-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 h5si6482846pjs.91.2019.08.30.22.31.49; Fri, 30 Aug 2019 22:32:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-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-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725836AbfHaFbs convert rfc822-to-8bit (ORCPT + 99 others); Sat, 31 Aug 2019 01:31:48 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:40167 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725298AbfHaFbs (ORCPT ); Sat, 31 Aug 2019 01:31:48 -0400 Received: from marcel-macpro.fritz.box (p4FEFC580.dip0.t-ipconnect.de [79.239.197.128]) by mail.holtmann.org (Postfix) with ESMTPSA id 1A96ACECEA; Sat, 31 Aug 2019 07:40:33 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH v2 2/2] Bluetooth: btrtl: Add firmware version print From: Marcel Holtmann In-Reply-To: <20190830221356.GA9697@laptop-alex> Date: Sat, 31 Aug 2019 07:31:46 +0200 Cc: Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Max Chou Content-Transfer-Encoding: 8BIT Message-Id: References: <20190830221356.GA9697@laptop-alex> To: Alex Lu X-Mailer: Apple Mail (2.3445.104.11) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Alex, > This patch is used to print fw version for debug convenience > > Signed-off-by: Alex Lu > --- > Changes in v2 > - Re-order the code so that no forward declaration is needed > > drivers/bluetooth/btrtl.c | 56 ++++++++++++++++++++++++--------------- > 1 file changed, 35 insertions(+), 21 deletions(-) > > diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c > index b7487ab99eed..e32ef7c60a22 100644 > --- a/drivers/bluetooth/btrtl.c > +++ b/drivers/bluetooth/btrtl.c > @@ -178,6 +178,27 @@ static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev, > return &ic_id_table[i]; > } > > +static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev) > +{ > + struct sk_buff *skb; > + > + skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, > + HCI_INIT_TIMEOUT); > + if (IS_ERR(skb)) { > + rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION failed (%ld)\n", > + PTR_ERR(skb)); > + return skb; > + } > + > + if (skb->len != sizeof(struct hci_rp_read_local_version)) { > + rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION event length mismatch\n"); > + kfree_skb(skb); > + return ERR_PTR(-EIO); > + } > + > + return skb; > +} > + > static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version) > { > struct rtl_rom_version_evt *rom_version; > @@ -368,6 +389,8 @@ static int rtl_download_firmware(struct hci_dev *hdev, > int frag_len = RTL_FRAG_LEN; > int ret = 0; > int i; > + struct sk_buff *skb; > + struct hci_rp_read_local_version *rp; > > dl_cmd = kmalloc(sizeof(struct rtl_download_cmd), GFP_KERNEL); > if (!dl_cmd) > @@ -406,6 +429,18 @@ static int rtl_download_firmware(struct hci_dev *hdev, > data += RTL_FRAG_LEN; > } > > + skb = btrtl_read_local_version(hdev); > + if (IS_ERR(skb)) { > + ret = PTR_ERR(skb); > + rtl_dev_err(hdev, "read local version failed"); > + goto out; > + } > + > + rp = (struct hci_rp_read_local_version *)skb->data; > + rtl_dev_info(hdev, "rtl: fw version 0x%04x%04x", > + __le16_to_cpu(rp->hci_rev), __le16_to_cpu(rp->lmp_subver)); the rtl: prefix in the string is pointless. The rtl_dev_info already does that. So please remove that. And then send a patch that removes all the others from the rtl_dev_info users as well. Regards Marcel