mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Alex Lu <alex_lu@realsil.com.cn>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	Max Chou <max.chou@realtek.com>
Subject: Re: [PATCH 2/2] Bluetooth: btrtl: Add firmware version print
Date: Fri, 30 Aug 2019 14:47:54 +0200	[thread overview]
Message-ID: <5F48FCE3-E0AF-458D-8560-DF0B1DB10CC9@holtmann.org> (raw)
In-Reply-To: <20190830120530.GA3299@laptop-alex>

Hi Alex,

> This patch is used to print fw version for debug convenience
> 
> Signed-off-by: Alex Lu <alex_lu@realsil.com.cn>
> ---
> drivers/bluetooth/btrtl.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
> index b7487ab99eed..7219eb98d02d 100644
> --- a/drivers/bluetooth/btrtl.c
> +++ b/drivers/bluetooth/btrtl.c
> @@ -151,6 +151,8 @@ static const struct id_table ic_id_table[] = {
> 	  .cfg_name = "rtl_bt/rtl8822b_config" },
> 	};
> 
> +static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev);
> +
> static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
> 					     u8 hci_ver, u8 hci_bus)
> {
> @@ -368,6 +370,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 +410,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));
> +	kfree_skb(skb);
> +

if you really want to do this, then please re-order the code so that no forward declaration is needed.

Regards

Marcel


      reply	other threads:[~2019-08-30 12:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30 12:05 Alex Lu
2019-08-30 12:47 ` Marcel Holtmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5F48FCE3-E0AF-458D-8560-DF0B1DB10CC9@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=alex_lu@realsil.com.cn \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.chou@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®