Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1416783ybt; Thu, 2 Jul 2020 05:03:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCKO8285/2bP0LRoZRw6k5DsVpX3CDx223me6esczm10HcwhzconTCGBUVtPvFQIUhrZLL X-Received: by 2002:a17:906:29d8:: with SMTP id y24mr26925867eje.212.1593691418856; Thu, 02 Jul 2020 05:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593691418; cv=none; d=google.com; s=arc-20160816; b=NqPhnxDP3p2LFdUVj0TRYI8KBh5RB07mGBpm1roUzeRqQR1ZfNxu8k5rHYIL5YNwvg J7bPOrQlcbqNYS1cLwfzZq94WsIQEmUQYHn5+3xTxAKdbOdi+Z1/UZbfpCNsrxJ3jfzp rQaBQfQwOoWO/9EJVAzcWvwfQslUjV6pUNYO3dYVwsTGIJK8sLZK4ZUGf920t5jiJYNa kpQWiNR5RHFFV/gU2myR8fWxzoMr9HMBjS/rEjckLLhy+oaicAr2HAcCOWs3FNvVYCYf +o94J+x8DqO+PC8Q1ngIkI336dnRs0EAcVp8xV8p1gqfYGVpw/HXIH3fqUCeAn2f+gwk nQmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=avQRZeZiWf+GmxdWgro3IwgEZL0o7t7KCpsTS8Vhe7Q=; b=SAqdfWS85Oo6PiDmHPhTvIsZekMSjtBqQc5FU4oaHDRko8t6jM3HK0J5AdrAK/wBWb lS1gQD2db79swIMu2wtyXvHCc3M2hpAXVRtKuw4ErWP7++ZQW8wczAoSMmv8EIFBOER4 6J+r5qIc3Yk39UGJsLEZ3FYd6m83JZ6IRKovhXOxYEi8Z+UOcBmlqzpOtF8KnqlyYpUE 6PVoJmmntuzumNrT+51N+OMNL/79z4ZSCN8r6zrW+dVteKuVgdU7smtYAhk5JpURFc6s KsmfLGPkyMGG16z84mfVTyZVIQr0MfkVXdv6GB73DhYll2XkMq1qm5WkTsK+k2b3STZK nS7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t7si5756985ejx.225.2020.07.02.05.03.14; Thu, 02 Jul 2020 05:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728792AbgGBMCM (ORCPT + 99 others); Thu, 2 Jul 2020 08:02:12 -0400 Received: from mga14.intel.com ([192.55.52.115]:27652 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728668AbgGBMCL (ORCPT ); Thu, 2 Jul 2020 08:02:11 -0400 IronPort-SDR: XGl3C8HuIy2Jk/PMhqYYGOf9VnzyYKu0pnj5uYUSTOeQs9Pg/vZGBmQiZNVAMm3QOKMuMVISQJ 2gcmdH3KhKlA== X-IronPort-AV: E=McAfee;i="6000,8403,9669"; a="145947827" X-IronPort-AV: E=Sophos;i="5.75,304,1589266800"; d="scan'208";a="145947827" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2020 05:02:11 -0700 IronPort-SDR: W2BRSz48UqmPOn4XB85Y3nspYydEHmB0wdj0zs+Sd36QKGQzKovQd6ASbqbvoeQBGSTcyeaih2 0703lwsYyUlQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,304,1589266800"; d="scan'208";a="304224715" Received: from unknown (HELO intel-Lenovo-Legion-Y540-15IRH-PG0.iind.intel.com) ([10.224.186.95]) by fmsmga004.fm.intel.com with ESMTP; 02 Jul 2020 05:02:09 -0700 From: Kiran K To: linux-bluetooth@vger.kernel.org Cc: ravishankar.srivatsa@intel.com, chethan.tumkur.narayan@intel.com, kiraank@gmail.com, Kiran K , Amit K Bag , Raghuram Hegde Subject: [PATCH 2/5] Bluetooth: btintel: Refactor firmware header download sequence Date: Thu, 2 Jul 2020 17:33:12 +0530 Message-Id: <20200702120315.26768-3-kiran.k@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200702120315.26768-1-kiran.k@intel.com> References: <20200702120315.26768-1-kiran.k@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Move firmware header download code to a separate function to enhance readability and reusability Signed-off-by: Kiran K Signed-off-by: Amit K Bag Signed-off-by: Raghuram Hegde Reviewed-by: Chethan T N Reviewed-by: Sathish Narasimman Reviewed-by: Srivatsa Ravishankar --- drivers/bluetooth/btintel.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index dea96c585ecb..1c820c187421 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -646,12 +646,10 @@ int btintel_read_boot_params(struct hci_dev *hdev, } EXPORT_SYMBOL_GPL(btintel_read_boot_params); -int btintel_download_firmware(struct hci_dev *hdev, const struct firmware *fw, - u32 *boot_param) +static int btintel_sfi_rsa_header_secure_send(struct hci_dev *hdev, + const struct firmware *fw) { int err; - const u8 *fw_ptr; - u32 frag_len; /* Start the firmware download transaction with the Init fragment * represented by the 128 bytes of CSS header. @@ -679,6 +677,21 @@ int btintel_download_firmware(struct hci_dev *hdev, const struct firmware *fw, bt_dev_err(hdev, "Failed to send firmware signature (%d)", err); goto done; } +done: + return err; +} + +int btintel_download_firmware(struct hci_dev *hdev, const struct firmware *fw, + u32 *boot_param) +{ + int err; + const u8 *fw_ptr; + u32 frag_len; + + err = btintel_sfi_rsa_header_secure_send(hdev, fw); + if (err) + goto done; + fw_ptr = fw->data + 644; frag_len = 0; -- 2.17.1