From patchwork Thu Jun 6 09:03:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13688097 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2137.outbound.protection.outlook.com [40.107.22.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DDDE13E8B0; Thu, 6 Jun 2024 09:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.137 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717664651; cv=fail; b=efEQThqHqs9ECKYNcGL2Jjb/+HjgNX9ua4P90V2hSMSWiCMtLXTpI3vwjA9PGFNpSe8KQopD7yMdHnJfhFKQMtQ+W0T7MfaPuDzwiewckPDms286DeCn4/18JlImR2njtklOFwmtS6RCuNUABx9bC7+9oOhPbTeG+sszgQMLko4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717664651; c=relaxed/simple; bh=oGHAmiaIXUBlb1bL754L4bhEDbYyEsEujOoaumKhU5Q=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=iGRBQdMo2brXHwBrI8LC+HUn1wewLQxL8TdqLI4S/OTI2Mpcuo3v6wG3O/XZW42tmO+FQ/M1rIfEG2AcsYQE4yjvhI9FJudV575CluOzk6d8nV4EPsXTx2pO5z3wu0RF0piSmV+yZnkXh4vQGrH4zS4OHkMytUxdNMZoMtgnfFY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=0Sjn8JvX; arc=fail smtp.client-ip=40.107.22.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="0Sjn8JvX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qqly8M9vKzho9rop16OrtqL17MPQzk5iWIuFHnWepelOMD0Yo3H3LvHCTJF2YNizyEihJ91cvtuuVXbwt6ISAI4chbVNNcOQ70mF+HM0LZULyPcQAfj4nnhFmTpUktWQgK4fKf2GFIJ6bRLlvxq9fgxnBs0VfgO+XYyNFLhc+O+M+lrHKOO7BoSS8/3+FAaS0DnShEXOgSXQDkBuV73AmROV5YieH7JUmVIMUTJ3bvXGzC+IwrhuALHaGJfiMCCy+5UeG2S6XIBO6Gg0Cb2eoG31QMSlw35vRZ9pdwz7oCQtzhl/A9i+0kk0E8PxA9gv4cY4CHNEAVBLdk/BZbwJhg== 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=pgVPp8pUkqh1jiJMjjW5QlfFUuPCqjWn94zVfmSvdT0=; b=mOxJ2igyqVy8UbCbwqHZzRNMaMN/PmAGTg4DdOZanckbSiM4Wfd4Hpmc3A9mG6rd7vTu+lao+yB+OWgbnlenYuFOguvYjx+qrhl+JkmtxBgJzSNhrAvWEpKlYlL/h3BJpRtUD5Psuc0tlz04esgpL3D5kIUmOfhh5vBmI8/gbxl4SCLIfEU/uzseXm4L0sthY4B9bszWgPPOqlUd0+wL5bCZozmA0wCtkL9rEeajZuXvMOLpvJiZ2YQ5QbnPFHVoAAOzh9FYHXrx4SIZe6nm3gOLniBkbC4PjLR2x+MjlPMea17LKNBxqRWVCpmu2ysMwdXkedzPBdApbS4Q7K/Qyg== 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=pgVPp8pUkqh1jiJMjjW5QlfFUuPCqjWn94zVfmSvdT0=; b=0Sjn8JvXW7UV7tPN5zxsQxeiO2G0CtF4PcZLTq+nmgzfxjdUa9DFfQkvWx4iVOFf+I+NhI7TevxwppMMhNHB0ksn6FIEmyypgLpovvXcwi0idTQMgDJUuXApV/dNOnphc2QMnTfciB2x+sscrGgB9hselmOwUesqEliefmTg26k= 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 DB9PR08MB9513.eurprd08.prod.outlook.com (2603:10a6:10:459::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.31; Thu, 6 Jun 2024 09:04:04 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::a08:11be:8709:f5e1]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::a08:11be:8709:f5e1%4]) with mapi id 15.20.7633.033; Thu, 6 Jun 2024 09:04:04 +0000 From: Javier Carrasco Date: Thu, 06 Jun 2024 11:03:55 +0200 Subject: [PATCH 1/3] usb: typec: tipd: drop second firmware name read Message-Id: <20240606-tps6598x_fw_update_log-v1-1-2b5b8369a0ba@wolfvision.net> References: <20240606-tps6598x_fw_update_log-v1-0-2b5b8369a0ba@wolfvision.net> In-Reply-To: <20240606-tps6598x_fw_update_log-v1-0-2b5b8369a0ba@wolfvision.net> To: Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1717664643; l=2278; i=javier.carrasco@wolfvision.net; s=20240320; h=from:subject:message-id; bh=oGHAmiaIXUBlb1bL754L4bhEDbYyEsEujOoaumKhU5Q=; b=r4KNoC8k4VSaEhfrsjFcfiHVzBdM9agVHEPIE02+v6efdb+cmOpugYSW7DXUW7YapQQ1R+99x rU94TB5UcGbClpBuPM2ufQHxaW8jRn+Y97sPiHBxm/Ag7ZGCt7v1C5l X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=Vxk2/0sGIxM8rsKnceszFuSuHVfQwa1Yo8+is7BX2nY= X-ClientProxiedBy: VI1PR07CA0310.eurprd07.prod.outlook.com (2603:10a6:800:130::38) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DB9PR08MB9513:EE_ X-MS-Office365-Filtering-Correlation-Id: 149ea9b0-4999-4dc0-e74f-08dc86079ce5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|1800799015|52116005|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?eo1z6HggemNEfPSBNkqmQ0f1clpjrvA?= =?utf-8?q?l4sAdj2oP3OEFfZre5oT/uSjQlqljsIH+ZUhtBU4jSl04iLac7wqGstuLJMCdXVdJ?= =?utf-8?q?28NsidadZpvJKDwILXzPNhiR897r4CqWVib6QBI80g1U21h1tESaReHkPrjY8P9UA?= =?utf-8?q?JeFPWWqF4+fgkDSbSShBAWMfQM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97CeWYcZltOT4/zV0GvWxnTD7l+Pu2tbGr/bAQw?= =?utf-8?q?3bouXuHQTipB4aP8VYqMvFT8lzjt1+dbl6cUKrKBwkn9wRaNFcjTNH6v9rddaBhbs?= =?utf-8?q?Ew9+spn9Z5JO0bPQ8mkHlLl3Qkl++dgiHjulyJyQ7V0lKGEBQiObmLiKIK76BRQH+?= =?utf-8?q?rTfj8vW5ERZHNGK2ofYd7MEjbCpbCIqiwUztplTbYdyMaece3TbMM533cvFivsC+u?= =?utf-8?q?c8K9+gqmnc1Uq5aCCF5/whfLzIIawnZUw1+WYamCyDB3KopZXViWLDi0=3D?= 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)(376005)(366007)(1800799015)(52116005)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?LPTVFPbXucBnzKg+53GbbIgBYB4w?= =?utf-8?q?U9wlc6YGdfECICbty4DGQkb4i06q+BC45ryGI/S/I2qiF1PuCIPyTfxl+AjbhPGrw?= =?utf-8?q?rUer5LJsMnl67Io5iebRfzLD1TGn9v2fyUaINVKuY9hq4Ji33XcUSZFWD6HLVlr0K?= =?utf-8?q?Vd+Z3gq4LbKa+D73hLP2XBSDuYneS+aKJTh1Cv7FiISLOwsp7uGTz0l7dkRHHQcSr?= =?utf-8?q?bttVXr0vKwOrqJIc1wILm/7IemJ4uD8bS+cMHdQ46eoxuEKdJaJy61uxIB/YCkCqh?= =?utf-8?q?ZfmiNlirargJpIdiQ4bPtic2U98+Yn0tHNjlDHGLhuemu+FEDtFEycXQjNq+N2UQi?= =?utf-8?q?TOlGt3yedoj9/Ro+BQZDpvxISjeZelueUXFGh92IF5IL5awYPHs+cv1e7qGocA7dX?= =?utf-8?q?o8EHBIV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3ABF558OXcZqQe8OyhcBahms5IDRO4JHX8P7N84h3PGP/BiP0n0Ka6TYmHt?= =?utf-8?q?7UqPo4V/Wgh6sE28kME9e2+CYi5D2vsd/Pk5CzDnr1SfgEXwrOkc55A1aUt36OdwX?= =?utf-8?q?I4ta0cIxfngvXMAUeRattR9Km4Nt9r/CiIWCrQ4Iv9quI5MagnH5VXNhulmLcA+cR?= =?utf-8?q?RBBM+48Cy/082zjVLnsndrt7In25OU9ayV/VbtZ9xx8Pw2qV1DV0qsN4MH2BljhSN?= =?utf-8?q?Iwbzr1sNJBbyPDYVRi6yNxPjy8zsmCk3uw=3D=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 149ea9b0-4999-4dc0-e74f-08dc86079ce5 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 09:04:03.5791 (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: laNCqxEUZNcPkI0p1r9DfuI1GyHVylkNayYNcbGEbIXCZdHF6MXGUKlp18jhoL3F9e6WM2hffOJmde9IqKTD0lVfQ3RKNcApWBjh4Z2YKFk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB9513 tps_request_firmware() reads the firmware name and there is no need to repeat the action in the device-specific implementations of the firmware update mechanism. Provide the firmware name as a parameter in tps_request_firmware() to avoid repetitive operations in the device-specific implementations. Signed-off-by: Javier Carrasco Reviewed-by: Heikki Krogerus --- drivers/usb/typec/tipd/core.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index ad76dbd20e65..851b0d02727a 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -892,19 +892,19 @@ tps6598x_register_port(struct tps6598x *tps, struct fwnode_handle *fwnode) return 0; } -static int tps_request_firmware(struct tps6598x *tps, const struct firmware **fw) +static int tps_request_firmware(struct tps6598x *tps, const struct firmware **fw, + const char **firmware_name) { - const char *firmware_name; int ret; ret = device_property_read_string(tps->dev, "firmware-name", - &firmware_name); + firmware_name); if (ret) return ret; - ret = request_firmware(fw, firmware_name, tps->dev); + ret = request_firmware(fw, *firmware_name, tps->dev); if (ret) { - dev_err(tps->dev, "failed to retrieve \"%s\"\n", firmware_name); + dev_err(tps->dev, "failed to retrieve \"%s\"\n", *firmware_name); return ret; } @@ -999,12 +999,7 @@ static int tps25750_start_patch_burst_mode(struct tps6598x *tps) u32 addr; struct device_node *np = tps->dev->of_node; - ret = device_property_read_string(tps->dev, "firmware-name", - &firmware_name); - if (ret) - return ret; - - ret = tps_request_firmware(tps, &fw); + ret = tps_request_firmware(tps, &fw, &firmware_name); if (ret) return ret; @@ -1155,12 +1150,7 @@ static int tps6598x_apply_patch(struct tps6598x *tps) const char *firmware_name; int ret; - ret = device_property_read_string(tps->dev, "firmware-name", - &firmware_name); - if (ret) - return ret; - - ret = tps_request_firmware(tps, &fw); + ret = tps_request_firmware(tps, &fw, &firmware_name); if (ret) return ret;