Received: by 2002:ab2:7a09:0:b0:1f8:46dc:890e with SMTP id k9csp323321lqo; Wed, 15 May 2024 16:16:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUojSS7XPmWO3e8ZvJIeOow7Sl4rPKh4xC+xVsuAvq9OOlSG+w2GN/2FsFuvznV7USG4NeNz5ibgFamEHvRudAWNxS6ZG2CFvoiL/njeQ== X-Google-Smtp-Source: AGHT+IEqy9jzP/8HCKOnE5A7fG0N1zCU9LoCEOMJy/mXEJPyVjZ/wOSTY3Pzg6jzNzd0WJs6mkP0 X-Received: by 2002:ac8:590a:0:b0:43b:1472:1685 with SMTP id d75a77b69052e-43dfdcd7256mr197156101cf.51.1715814961622; Wed, 15 May 2024 16:16:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715814961; cv=pass; d=google.com; s=arc-20160816; b=BNs/GdOrqecRu3+/GY3OCqSqJ9tGgCQqhvQXvXzfdPBkPtrVdynAVGWTnnrq/rQzC5 tTHK7BE2gNUkq4JkYiB5lsRf8AHJcIFL9JbBhsBZaX++m25Xo66u+I8HVUGoq2vw/ZNn i7vTBryqh9bAVB2eLN7hSGDkdIHg8mUKvmtSaJlFPc7ehgNLgIyd2PpCMgU20T+kOrmv fSM1l+GT/NcBmg873gcsheQpsCLOKTlz1Z/9EpwXLesHdeZ1tV1jrFGD2RlBV1iqdzz9 m3+ITo7biH7VFaigNtiX4KBpe96cQUJ6Undcl7jmIWJDUdJhFXjjbU2RLIDgHhdBDTf1 9G1g== 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=dhvsCgYPvB92Q5BFBKTie57uhIEMm1z1mEV6N05fCRE=; fh=BooDLXa3FUh0Yyxmau3EUP5pvR1QwUoPTs7jAr50Ufg=; b=WP+TpOVCtkR1ajB3xCcwd9FOgrBn/LcKuzzwURf9tXyNs6i5XcH6Wa1ZPxtNmIexbn P6wEiDRaj+22AQpEUHNHzex6Nkr0z6O+eVHXlh1PdEoWxaVfKVDPnjmCqnnBZ5GJc0Ib ZfpAo9bXv1/9Vb8gLzky0tb1p9oDQHEf7oRts5h44wzqY2Or5z6LewYoJjxLCp6I6GD/ KpkApQckLIKvPj7vskKqFsQdBFj3CXJWChhzBQOwg7lEac88SbUAzkBUIVCb+vFbJS/B VEBKr0LCVETeq12Gf9Dv2vXPGMujq+e0Og+Xo0WKfaJVegHDTWOiReAAd1KPBJtEJYpY GXnA==; 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-kernel+bounces-180475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df56dd8e2si151389661cf.744.2024.05.15.16.16.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 16:16:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-180475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180475-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5D21D1C2215C for ; Wed, 15 May 2024 23:16:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5CE515B132; Wed, 15 May 2024 23:15:37 +0000 (UTC) Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 CB32B52F99; Wed, 15 May 2024 23:15:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715814937; cv=none; b=WUu1X2d/g0GTx/x1gTLZWLtYpn29WlIJLzC0YJwSTqK4XNuwhq7HDbvo8dl+16d2tuUbDqkOC+GdzI80KlvhHY2fksekGzbV4dUoNU62QI9eJt32j3oE+KPgnuu7o99kbpAvwzEuiFcmezQKEvWDzGl/dHgKTBhezbOyLUOqocg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715814937; c=relaxed/simple; bh=Saa+Cv9T0K8Lpspg+3DK0q7kAqVgxKAxcJ1zxIGrbFY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Fieb8SbOONMltp1CZvBJS1/j5/2KlvNl7CXRH9hpwzCqHVRIH7BXB6boZiXMGQdvZxUK/VZ78L8nPsaEvdlN5TvR77p8FrX/crXgR9LbIjSC2rrNj82wAIKdplz5jkYCMrdtFR+BycAgqQMaUo7SKBSjyzIfJcJdOquUlKUq5/8= 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.210.53 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-ot1-f53.google.com with SMTP id 46e09a7af769-6f0e516ee2bso574858a34.1; Wed, 15 May 2024 16:15:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715814935; x=1716419735; 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=dhvsCgYPvB92Q5BFBKTie57uhIEMm1z1mEV6N05fCRE=; b=BlA64QNVk6bH5XTCGKwnx1qfedNSpCwOJZuUuQUq5iTtoKZ2OaYyvZSvGqCagfS1WT VYTNVAjaeZOzegvhhtt5eBE4bFiM+gehMPJ1NBWSXLNgDoQgjhkMPpXazE/YA/C4958q fBk++MS8lMSPiSl4GiSNweZU8UF4RV5Q+KvAITLmBEFVqvbGwCcqSIh32PPhOvVMsWFs fPvQh7ttsyVCENei/A5EDMtPbnD4Pvc+GWF2zCrnPC2aD71pmt3ua5WW133FiEW43mwT kymwcgaVM7wPCCdmBFeyF/BCH+ZvbVcexuLm5nsZ4MpCkHk2ev9f8m8bYw5UWc5nHEk5 AcLQ== X-Forwarded-Encrypted: i=1; AJvYcCWRU189kpyusLhVvxo3/YDTwwZkD8m/9B/rid0U/4+O+GXWPSAV2n/smMqlajfsFi0qjMIz5f4nJ2zNe8oH3LYNX7S6kCkUO3mRT8zc X-Gm-Message-State: AOJu0Yw1chs1QriYGQ551C4eC7qQq1ItTSVPR/K9S6gxJYxLPS4t+pLE aI5B7uBi4XF1qusvl0xL3q2U61aWWOCVaTVGnggHACweV3GhWE1o X-Received: by 2002:a9d:6d95:0:b0:6f0:85dd:131e with SMTP id 46e09a7af769-6f0e92a69bfmr21075455a34.2.1715814934801; Wed, 15 May 2024 16:15:34 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6f0ec2e566dsm2032159a34.15.2024.05.15.16.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 16:15:34 -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 v5 2/5] Bluetooth: btmtk: apply the common btmtk_fw_get_filename Date: Wed, 15 May 2024 16:15:18 -0700 Message-Id: <1e9c955a0b311ede0bafedd4c49436cb5a04c9b1.1715813148.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@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 v5: update the caller usage with btmtk_fw_get_filename --- 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 e384ef6ff050..611135d1ce01 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