Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp68787lqo; Tue, 7 May 2024 12:22:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTqvsr1ucbNaEVSWH3rtbC3JFRkHINqAmahqb4q7p7Ei8KxW6iGWy89MO3kJ44hnRYbz8w3jYl4f+JNhr4iOyF9hESHrRZhNVDyZvZbQ== X-Google-Smtp-Source: AGHT+IGsGUTKvGJJmOmBg/Yylrb1liCzFlCWufm+EL17g7aQmcIXYI4kHqB3Weh5ft+5ZryrtO3k X-Received: by 2002:a05:6358:280e:b0:186:431:d9be with SMTP id e5c5f4694b2df-192d305796amr73667855d.19.1715109750094; Tue, 07 May 2024 12:22:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715109750; cv=pass; d=google.com; s=arc-20160816; b=cOBWH3yIRef7QxdZSiQjxRX5nGOTMnVCkH9zh6c1K5VyFWHKBKvIx+rFNijXMIMG6K E9KVrBxtAnsUXMZ4kuKtzLtFicp1GQqvFC2hISMJ6ddmQ69CjayoxWgr6b4qmWk8djwA l01buPek2ChUGhfFI2168PQewRF8VCDHSrDarw6Zuh99uC9fG1TRuaUSpmIsughsp5Ax 74HOJwcuXOR+T2UTywAgNJ11QL6C+OEGhLBp1OkPFsGDaReDNy6imKBnrMsDXzBCDjx8 V7N7VY1zaZJYICY4iBMzTKxxZTNkeWd2ShlHm2UASDTCqFv6fvFlZSDJNToI08riabTK IOyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=7sYQ7hw69f2uaeyraCUDwvaBx7HkdTU5mSjbOPq3iac=; fh=uD7HUHeenGy5+H1ZANKo26SnKsXytK1Xq57Vnik8jks=; b=unJmN6J+7oqUZi6VtDdKNwy7PQUICbj900MnVDvYujC3GY5f1jgR5sL59XKyyvjdao RMzucfHNvGD2G3YSoi1vRZDxVWkVBpBDv4WUdGLaJW4D1sdUMvFommMXeKXx8YyGuuzC jHZC4tYwkVe/jXFI+shel30a1QVIBF4K+tyCsj8BQucdlxcwa4Mnx6NJS2ko7uRkl3YH 08XDK4XG9xoDAqUJBrbRVYDdqpB29rk+eKk4sv674CwKCxCoqOSlhXV2U+ZBfh90FKoX 68Xg5IORFnyjHk4awTkrUzrSeWvkJKWijozgbJ2BNbHAZpIO20ykFWhsF9mnfgGfukWh F0GA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4364-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s26-20020a65691a000000b0061b56f70cd5si10062003pgq.107.2024.05.07.12.22.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 12:22:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4364-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4364-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E2D5E28A40E for ; Tue, 7 May 2024 19:22:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 295E416E894; Tue, 7 May 2024 19:22:09 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6883E16DECF; Tue, 7 May 2024 19:22:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715109728; cv=none; b=hnmmRRFaagbtkCDfrkZs1B6zKlyDRoZfy7sml+OSsrB/V5CchGZ9sGzGhttu3m4oWOUHkPLGflr6bl3nuNYU3A6zBHNXK1vOP0MxVP8IhaHvRoAoYUU3w4Ig4mAimCkW3TKtK94RWi2cySNHbw1ERZuq5A8moiEbt9lmcDXTpOA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715109728; c=relaxed/simple; bh=p2WcEKEhwoNTo10Ew+OtVoaB84xhMJC42oHb4GD7Lfg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Dt4z0Vx5JqbRMi+uHQzAiZjT9kR7CNkk76ursziMbIiLK9NJ77BGQPTZgW52rWf5PxqFfLbfKSfXfqsyD17kKkNkDwHxr+NrMs9183M9iTH3DxbbRZfff0TKyEfEcLvc/x9j0n+Qt4pbrwBkaVx3HP9Vu+zSOLSmWdyvqo8fhAw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3c6febc1506so97285b6e.1; Tue, 07 May 2024 12:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715109726; x=1715714526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7sYQ7hw69f2uaeyraCUDwvaBx7HkdTU5mSjbOPq3iac=; b=hXmn2htT/SHsrx28gz05zJNiZkWpLgpD2CCqTjXItdaLMBuKLu4Hq1ZvK1JXCrpLBT kjJFr982zbbfwoN2E42jf+ws+R3swx2FPZRB+DsefIldwuqZM8QZWscSNQcUZjqu3Tuj Zqf30QsjcWH9yays1SikDEBq9IpQ0gsyQgbJzVSb9kBpnenoYDNntPtpOnXTOOTri2HF mkYcUSujsWnPHMwPSlremYu5++RXCmElw0CPQdbcP9buFccyQ4KE09otfvKq7SIrKOsM NAputCJy2w5ThtUrL8Q+qy5tXotvvZvdTe6UW3AXuMLwMQAeOsrabn/2ptTQR3v/+otT 6SKA== X-Forwarded-Encrypted: i=1; AJvYcCWWJzHqVhmmxT26muRFjBffOdbvSCZJ+JexaBDoZ4eUAxw2QAqJvOoUiswy1b/Y/CXT8RvVLlQ9rR9zdnhx07TOLfmGo9vbcZ9w26l6 X-Gm-Message-State: AOJu0Ywn07lxC32LlmFVlN0xbmQKxH3nriKuVT2uG5eE6Rd+HWZHHj4D qim1cNLM3LewuDH8Ck6cHfmlL9U3/LrTxYPLs9xIZyjp/kQEFiCk X-Received: by 2002:a05:6808:181f:b0:3c8:4b12:107b with SMTP id 5614622812f47-3c9852ba08cmr595514b6e.2.1715109726543; Tue, 07 May 2024 12:22:06 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id ec18-20020a056808639200b003c8643f0e5csm1937839oib.16.2024.05.07.12.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 12:22:04 -0700 (PDT) From: sean.wang@kernel.org To: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com Cc: linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Sean Wang Subject: [PATCH v4 2/5] Bluetooth: btmtk: apply the common btmtk_fw_get_filename Date: Tue, 7 May 2024 12:21:58 -0700 Message-Id: <6aef1a64b54a32134f5e995d1dadacbcd9c9ce33.1715109394.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <965cd14922aea67e2750ff2c2ecad773f8ba485a.1715109394.git.sean.wang@kernel.org> References: <965cd14922aea67e2750ff2c2ecad773f8ba485a.1715109394.git.sean.wang@kernel.org> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sean Wang Apply the common btmtk_fw_get_filename to avoid the similar coding in each driver. Signed-off-by: Sean Wang --- v3: first added to the series v4: rebase onto the latest code --- drivers/bluetooth/btmtksdio.c | 3 +++ drivers/bluetooth/btusb.c | 14 ++------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index ff4868c83cd8..04be06f73e05 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -1117,6 +1117,9 @@ static int btmtksdio_setup(struct hci_dev *hdev) return err; } + btmtk_fw_get_filename(fwname, sizeof(fwname), dev_id, + fw_version, 0); + snprintf(fwname, sizeof(fwname), "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin", dev_id & 0xffff, (fw_version & 0xff) + 1); diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 90d1f1697357..1603e97f0d7c 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3166,18 +3166,8 @@ static int btusb_mtk_setup(struct hci_dev *hdev) case 0x7922: case 0x7961: case 0x7925: - if (dev_id == 0x7925) - snprintf(fw_bin_name, sizeof(fw_bin_name), - "mediatek/mt%04x/BT_RAM_CODE_MT%04x_1_%x_hdr.bin", - dev_id & 0xffff, dev_id & 0xffff, (fw_version & 0xff) + 1); - else if (dev_id == 0x7961 && fw_flavor) - snprintf(fw_bin_name, sizeof(fw_bin_name), - "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin", - dev_id & 0xffff, (fw_version & 0xff) + 1); - else - snprintf(fw_bin_name, sizeof(fw_bin_name), - "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin", - dev_id & 0xffff, (fw_version & 0xff) + 1); + btmtk_fw_get_filename(fw_bin_name, sizeof(fw_bin_name), dev_id, + fw_version, fw_flavor); err = btmtk_setup_firmware_79xx(hdev, fw_bin_name, btusb_mtk_hci_wmt_sync); -- 2.25.1