Message ID | 20231207-tps6598x_update-v2-2-f3cfcde6d890@wolfvision.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8671566dys; Thu, 14 Dec 2023 08:29:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBy5ffdUpKbg+wdVjygHndw1YmAEwgeiMk52o+S/IL1z2KmNPxgn7G8JynY0uuvkixbX9e X-Received: by 2002:a05:6a00:b51:b0:6ce:3f02:108c with SMTP id p17-20020a056a000b5100b006ce3f02108cmr5482964pfo.22.1702571380100; Thu, 14 Dec 2023 08:29:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702571380; cv=pass; d=google.com; s=arc-20160816; b=jGgIMM2wI6QJ3pzAqN+lQrGoUsbg6FQWF4iDKryDnxbKLMmWP5722hMr6hZhWl1dfb 8tzuv2T1ol+LVxBpwp2cBvLhRinS2SR0I09evStfkJfqAdSp/Bsp31CYbIHLC1R35KQm DSlg426wdvQFwa5myHK6l8QuXq21KZIezLdxYar+qzwaAAlDPUPKrzp9NyDN8eYM6ACY EyKtVr4Ixqy6FnaKDB4ptgSiXq20MkWWErCejnC+Bs9NfguaKtia2n7Iw67Z/UtDJG4C YjVwTeNbL5ycVdgC31yM5NDChYuBoanNvlHICdr+HkBnISyIsXGLgbbXDyMiu523Ky/y xMMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:cc:to:in-reply-to:references :message-id:content-transfer-encoding:subject:date:from :dkim-signature; bh=Alf3X77o95+4npf2Xmg3XH0mq/gq3JSYWbS2tW+Hm+4=; fh=skg4aWcIne/NkBvGBSxiPFt6u1LkY77F5jj9Umi9ZmE=; b=ND58U656jYeN4UTjKg+KtQ31J1WnlOfHHAi5pLUFbWu6Qtt7cFOPzNzYYuBn4RDrEj TnxD9mSptWcG6aa96yoYjlZ958quW9ZIRnlzb8O+phGmrg+oFQKKd/dUax9ZNI7y6NI4 ngNWRO9hEYrvKAYLoP77MeaKTlnbugn+Uwe/3z1zndzOxU2Rp4t9TtYSUovvm96chTd9 2BTDAj5thpBn+99l64vWncJEgKvDLglys+mfdaC8pyMghyUnlgvKgfGiAltMbxsvS9aW asEFhMQ2gGkayTKpZEYMLYIvJ0M79yArv+N0DDXv7BNOGkDlq9DiJ8WxUOaySUQ06pq9 IhVA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=VcEM6raC; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 189-20020a6300c6000000b005c615702198si11340668pga.703.2023.12.14.08.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 08:29:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=VcEM6raC; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9CEA482662FD; Thu, 14 Dec 2023 08:29:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443478AbjLNQ3V (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Thu, 14 Dec 2023 11:29:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229851AbjLNQ3O (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Dec 2023 11:29:14 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2082.outbound.protection.outlook.com [40.107.8.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D794125; Thu, 14 Dec 2023 08:29:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LC/GedQ0M8c3vvDrPd8WNx+gHBZq8WX8WUwlEimV0Yb2ZxGoz4sByLa0RY8HYBIz7LeRLBdTpAe25wEj6OCjpykbXo0lb7qjR9G/Lh6TUX0NYO7XXu4yYKWx2bIJjYEFJq1swnbl1HiXK3GqF0elx9bLJcvF32Fs/wfZiK0As/dnWtSYbFkCkOJ7s/AmZC4k9bRiI2Mn1RB7VOBSt+ax4evkAN482dwKYew9iHH2GAKpT1koz4Zz5Y/nqPKBHZ0k5n7a4DlQVxOyfHEt4FG2cKTSR7vvSz2/NKsWjbBfkxduZscM8q/EkFcoYCsEM1DrVkNiZdKLZbFkRc5MYmdfXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Alf3X77o95+4npf2Xmg3XH0mq/gq3JSYWbS2tW+Hm+4=; b=Rp8AfizAK/cFmUUaKp42wjlhfB/H2egD2pxtbmIUhsE0NH1sg8PzD229ESj5xVXaMSQMi72a0VTpC+v55m3kF/YmOgA6fv+/x+shFEVpOOQ+t3SKODPjqzbocg85Mx86y1N1U475VZBJRLUcBg7VXfqkXhQW5Wkt9kv4Pj+EZVKezp6UEvX6dSmOrSw248qnVUhbuMVtJCFvlbQpmDwt5JgWR1lfoBxVYfM7kVE33kkbHH0540EG5x4T8tefF+mYAMKnyDNlEgNR889azxTTo+MwgP+B524ityEpnLb6bGJTSvwCJv7+meYe/6DgDHWhsPgJA2F7zMSGTS535orZPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Alf3X77o95+4npf2Xmg3XH0mq/gq3JSYWbS2tW+Hm+4=; b=VcEM6raCuel7OKb81UHkq4EOYCdHt8dFlr7wCkX2UGqx6A+H/5QIZiP+BDt1EXocTHrPefDIPnlIUIjgD/R1cutyTffRmmLMZuqcGlo/vABJNtQ4UvqINqWEfRjaXD5kAXU2KvV43KRfBl6OQAKAX5xKV6OO1CH/l+j/mfLTSMg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by DU0PR08MB8302.eurprd08.prod.outlook.com (2603:10a6:10:40e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.28; Thu, 14 Dec 2023 16:29:16 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc%4]) with mapi id 15.20.7091.028; Thu, 14 Dec 2023 16:29:16 +0000 From: Javier Carrasco <javier.carrasco@wolfvision.net> Date: Thu, 14 Dec 2023 17:29:10 +0100 Subject: [PATCH v2 2/4] usb: typec: tipd: add function to request firmware Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231207-tps6598x_update-v2-2-f3cfcde6d890@wolfvision.net> References: <20231207-tps6598x_update-v2-0-f3cfcde6d890@wolfvision.net> In-Reply-To: <20231207-tps6598x_update-v2-0-f3cfcde6d890@wolfvision.net> To: Heikki Krogerus <heikki.krogerus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco <javier.carrasco@wolfvision.net> X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1702571354; l=1726; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=lu6STSMTUjxa+BhbXAPxJC7PhXobLmfFr1D/or+2rAI=; b=RSHvW9zwcGH7+aW/7UCIa4jd5kXjoEA2JuQNqkLNVXbd/4ps3mZSCh5/3he3xYYHGrzHA6FC+ O6qDgge+zLlDIhZ1O+DVsFsyx13IJIPJWke1FWYMnodeLUtSy+pvvEz X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1P191CA0011.EURP191.PROD.OUTLOOK.COM (2603:10a6:800:1ba::19) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DU0PR08MB8302:EE_ X-MS-Office365-Filtering-Correlation-Id: 48531cf0-c2f1-4d82-9c25-08dbfcc1d08d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mHBgiFvIdmh6ojZbOwIHJY/TuvJxE6JG+gYPXV6tPIJ23oDoBug1XGPSZtmZh1i6WZWKJAyM7gY/rzM+gMPhKggMarTtNciM3H0iD+JlfOmYnTCYzEjLvQOzQjkSPniHI7unFseOGE9IrAQZCZNQM0c1joZcmqPyPFDr48TKOxXLPHCHX7QX9BV5u2NcQD1MOtE9vVwuxC7J5xf0VvQ7yj4hBigCZ3Ec4cHHSipCd17zDw9YQ2gvZhjPb5dEkvPflPmxWyE83zxTOCNk0ZazB88m2KOAQjzMXI3W5P0IY9WBRJFVj9Buf1mccmU3e+c11eAGhArnMAOds9fvq7K3L8G3AwUn5P8Y30RoDj72f68aJxq/dtSeu4Gxse9hf92gpjnEcGiPz9IvIr8b549+Gj780itg5+60NSb9Jcucmu3RcCof83bOcrNpUzD5aDTLzPP/KdkrnzaOZXp9/33SYfGL/2AQmDFp5K7+915s/66Vs73bllSK/2Jb8UVa0JinWDnQ/TidYnVcoa2uILPGc4J7cUv/DrxKtHYk88BoKlNkEOYubZTHENF2f6XEqb9LW3Ohzu+mIeRzEvbsPSZf3glGkivog+vCIpTxH92jTQ5NYoUds7OjH5LVRIujf3Kr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(136003)(396003)(39850400004)(376002)(366004)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(52116002)(107886003)(2616005)(26005)(6666004)(6512007)(6506007)(66556008)(83380400001)(44832011)(2906002)(5660300002)(41300700001)(6486002)(478600001)(66946007)(8936002)(4326008)(66476007)(316002)(110136005)(8676002)(38350700005)(86362001)(38100700002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wdVxc1nWqRQVvTzBjIVQZ9H3cF4T?= =?utf-8?q?zfvY2cvtWY1sUqXO/U3bIIed99o5jQhuUqD4VREkGKwc91l+rzf9Ar5gjxOuyxL9F?= =?utf-8?q?6bhPv6YLTPGY5bCwj3TKtHQXQi/w8QypaLvrjbBcwNgFZMiS0uFW3ZncenpR1TJ9l?= =?utf-8?q?GatuLrFGCpQiPqkwTJfnacHSeAe5MGHz22hPnJKQZVLprlxmQP20ASavnie7uIYMz?= =?utf-8?q?MAdNgh9HiEl9JMhex31XRVH+RZplsIhvk+RJPnJKqNt1aIfusznlzpJDro2RAIpCt?= =?utf-8?q?tkG30FGfKa2eGnGPNaf152WQlfDSWrp1GnaC4IcQuLXG54NQMeLULf9QyfyBXrcPm?= =?utf-8?q?1V1+lWAT6kY8YTkdyVq9gIeTiZ65/qviBB+KJbNWXVCZFLhDDW5tczuDSzMS1FbpY?= =?utf-8?q?91FFsY1RT2VtkngEbcXEQ8nH4E52itsbrswDRxMRQRPxlqGkn2T9PrNYApZABaYb5?= =?utf-8?q?IAU5u3+cykPvijRzmznG3+66gz+j6rBYSEfToPyxc3xXrQOatBAr6i4jjj4YZyywO?= =?utf-8?q?n5YMFSX5S8smPvnCx4bLIFlW35PW1ZmOZKOf6I3HK2fhIBSZI7xy/1oavrSZZDTPu?= =?utf-8?q?ClEYPKb56sP3afMULnx8/ImVujaShKtvP6qub7YzR9Nf2plJE+Bf53Guzthtww+q2?= =?utf-8?q?1DitOt/BMKaAxjTjKFvcyueEI6Ne5qPolaVyKzZufT6mVCAVG3j3U6UB9IYRdwQ3t?= =?utf-8?q?4jb7KZfLMIVaxBNUikfcc+fvnbbLZy9PZdqjAARdbe6MNdH8VH8XnDfjQ7YGCZFzi?= =?utf-8?q?EcU8N7iz/w60CvjcOK/pcU7XUeuhL4ETt20fyXKAhiWtn2ZnjYnvCStTaxICJ9Gee?= =?utf-8?q?rTD5xHLLrbi0f3G853Ba8byi7UDd1/7/Vmy0DqyiboS5SEKbv60072Rce/pdhmp4h?= =?utf-8?q?pQPoQUf37yoZSLvXcC2SsAG8xQyFqLLD8HcoaoJEStbd8V2ta05+0bJJVnWaEXGxt?= =?utf-8?q?Rlijmx0x3CH0WTH88gLg5EurhDMTnjsNNFVbRI6fFBKBFXc6tXW9fThT80BoLDWhc?= =?utf-8?q?OqXMRCGHcchxX9bC6UwJUp3cf8aQLLykHvKOGVID/D+utVZlxVTiRkHF9sxNcqT3Z?= =?utf-8?q?3185t9EXUd1qfWvUNrq8ScpN14ZRlp3XG6KaxSiwO3i1qft8iVYv2smWE6eoU0QeR?= =?utf-8?q?gramSBpgFwzScnqc/pSQC9nY5dqgMcXQseMFemhdwylbX4GTYQpFzERZ9QnAMUEmS?= =?utf-8?q?Ur+mZ3HcOO56a6Kfx4Trq9ytUHcqCQw11/KvRWgIvMdauTNwi6ypCylO8RFeAbh1z?= =?utf-8?q?xL9jQZ2McW0jGKMBF+sW7dpyh2X2iXvPZ62mKqliMJXLcdpo/9MNHQgkKu75csliH?= =?utf-8?q?FcpBmGm7THe0kzEUUNIpEUmh8QsyyDI130y48KmZpaB9Qc2ACexCFz5KJKf1NbvIi?= =?utf-8?q?HEIZqG7QBmCqGWztrwkE54qvRtT1esCuls++SI5wunpWQ2GpnuuPRzVW757I17gg3?= =?utf-8?q?YZ+T+hQ35bkY+GJrzKnPXpLervW8Ge0bzIcTYD8BLSPvBDh1NeHIxSCkm6PDxFm+H?= =?utf-8?q?VCOnH28nTKZGk/o+XF+kmNpKibMlSGjZkW0pCi6AiDJiUfadRBG0LTs=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 48531cf0-c2f1-4d82-9c25-08dbfcc1d08d X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 16:29:16.2077 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: P6aWcS4NVFV9qzCNh6ULaQtrwrBgBZDIXjQ8nTTnsEpZTCIsfGaGjCMChrpCQjiXLeE3F+OexB+k1eDss9BT14SUw9zIBLxhWFOZg3BTAKY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8302 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 14 Dec 2023 08:29:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785275487240931627 X-GMAIL-MSGID: 1785275487240931627 |
Series |
usb: typec: tipd: add patch update support for tps6598x
|
|
Commit Message
Javier Carrasco
Dec. 14, 2023, 4:29 p.m. UTC
The firmware request process is device agnostic and can be used for
other parts.
Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
---
drivers/usb/typec/tipd/core.c | 35 ++++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 9 deletions(-)
Comments
On Thu, Dec 14, 2023 at 05:29:10PM +0100, Javier Carrasco wrote: > The firmware request process is device agnostic and can be used for > other parts. > > Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/tipd/core.c | 35 ++++++++++++++++++++++++++--------- > 1 file changed, 26 insertions(+), 9 deletions(-) > > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c > index f0c4cd571a37..83e5eeecdf5c 100644 > --- a/drivers/usb/typec/tipd/core.c > +++ b/drivers/usb/typec/tipd/core.c > @@ -873,6 +873,30 @@ tps6598x_register_port(struct tps6598x *tps, struct fwnode_handle *fwnode) > return 0; > } > > +static int tps_request_firmware(struct tps6598x *tps, const struct firmware **fw) > +{ > + const char *firmware_name; > + int ret; > + > + ret = device_property_read_string(tps->dev, "firmware-name", > + &firmware_name); > + if (ret) > + return ret; > + > + ret = request_firmware(fw, firmware_name, tps->dev); > + if (ret) { > + dev_err(tps->dev, "failed to retrieve \"%s\"\n", firmware_name); > + return ret; > + } > + > + if ((*fw)->size == 0) { > + release_firmware(*fw); > + ret = -EINVAL; > + } > + > + return ret; > +} > + > static int > tps25750_write_firmware(struct tps6598x *tps, > u8 bpms_addr, const u8 *data, size_t len) > @@ -961,16 +985,9 @@ static int tps25750_start_patch_burst_mode(struct tps6598x *tps) > if (ret) > return ret; > > - ret = request_firmware(&fw, firmware_name, tps->dev); > - if (ret) { > - dev_err(tps->dev, "failed to retrieve \"%s\"\n", firmware_name); > + ret = tps_request_firmware(tps, &fw); > + if (ret) > return ret; > - } > - > - if (fw->size == 0) { > - ret = -EINVAL; > - goto release_fw; > - } > > ret = of_property_match_string(np, "reg-names", "patch-address"); > if (ret < 0) { > > -- > 2.39.2
diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index f0c4cd571a37..83e5eeecdf5c 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -873,6 +873,30 @@ tps6598x_register_port(struct tps6598x *tps, struct fwnode_handle *fwnode) return 0; } +static int tps_request_firmware(struct tps6598x *tps, const struct firmware **fw) +{ + const char *firmware_name; + int ret; + + ret = device_property_read_string(tps->dev, "firmware-name", + &firmware_name); + if (ret) + return ret; + + ret = request_firmware(fw, firmware_name, tps->dev); + if (ret) { + dev_err(tps->dev, "failed to retrieve \"%s\"\n", firmware_name); + return ret; + } + + if ((*fw)->size == 0) { + release_firmware(*fw); + ret = -EINVAL; + } + + return ret; +} + static int tps25750_write_firmware(struct tps6598x *tps, u8 bpms_addr, const u8 *data, size_t len) @@ -961,16 +985,9 @@ static int tps25750_start_patch_burst_mode(struct tps6598x *tps) if (ret) return ret; - ret = request_firmware(&fw, firmware_name, tps->dev); - if (ret) { - dev_err(tps->dev, "failed to retrieve \"%s\"\n", firmware_name); + ret = tps_request_firmware(tps, &fw); + if (ret) return ret; - } - - if (fw->size == 0) { - ret = -EINVAL; - goto release_fw; - } ret = of_property_match_string(np, "reg-names", "patch-address"); if (ret < 0) {