From patchwork Wed Feb 5 17:36:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 13961630 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 648C01FDA85; Wed, 5 Feb 2025 17:37:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738777023; cv=none; b=D/EbvVffNjIRAByME2iUUjAfoHz6sFyxCQWZ2ps8NlQMuVeNmR9al07OMauPzYjBhWDSWBw58LDbnWht8oHR3LIXsRo63Ezafpf8kZPgBujCKQruBYJep7x1QPwbTFPUj20/YtLHSf3c5rYpceAd0awARcmbLUXOSBoM14ctvzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738777023; c=relaxed/simple; bh=ELA0k+j5OkZlZVsJFwdVC3fiQK1DARXwkSiXO8WOtbY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TRYhx3U9mM+eOFfqUeOvNMJAP3Qd3mDmFjok/N9bKExlRVvMSz5GjI31TDQIzH71+b9F4GWXMXORa/TLPayNvM/FEL4L53cJJyjgHbUbqGBtzcvTG3x7pNzKIa/QwZE3EDQxzzgXsgpJ+Fp0v6FxSB2tbIe/eZor4BGC48hP4vY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=GWTfhMIH; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="GWTfhMIH" Received: by mail.gandi.net (Postfix) with ESMTPSA id 33BF644432; Wed, 5 Feb 2025 17:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1738777012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f//Bw2prZIEuRzLIoticfHGsq42yrXy1DhOmA407QJM=; b=GWTfhMIH0j4scflBoqlu+7xX1+GQJkvKd793E/s2rEWH9L0TQ8kEneosEhx0twLDgljziI spgRNoB2eF6rr0prI8banwJpDvH7wFfkNQs4pk/1e3Ax2wXZ/3qQi+1MVwEKeqB6Qmgqyr 8zW+cBDl+oQ442DUHMrstmYK1gTEgVXIwt53fMdTvEonfN5J31Uo2svNjxRIPOmHwvFcV6 q8hfANzLRAZC77oWpBfoeSKR2N+fDIjvZOTwjZjJLsaoOMVCi6kMnFaOesVLA/JcYxfL+e 1xpYCVJOuf8GCF5MgEqH7GuumqUIhNoSO60KQI2cEu0oYmIsuFvskSffy9I1XA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 05 Feb 2025 18:36:49 +0100 Subject: [PATCH v7 4/9] usb: cdns3: call cdns_power_is_lost() only once in cdns_resume() Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250205-s2r-cdns-v7-4-13658a271c3c@bootlin.com> References: <20250205-s2r-cdns-v7-0-13658a271c3c@bootlin.com> In-Reply-To: <20250205-s2r-cdns-v7-0-13658a271c3c@bootlin.com> To: Peter Chen , Pawel Laszczak , Roger Quadros , Greg Kroah-Hartman , Mathias Nyman , Thierry Reding , Jonathan Hunter Cc: =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, =?utf-8?q?Th?= =?utf-8?q?=C3=A9o_Lebrun?= X-Mailer: b4 0.14.2 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvgedtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpefvhhorohcunfgvsghruhhnuceothhhvghordhlvggsrhhunhessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepleevhfekueefvdekgfehhffgudekjeelgfdthedtiedvtdetteegvdeileeiuefhnecukfhppedvrgdtudemtggsudegmeehheeimeejrgdttdemieeigegsmehftdhffhemfhgvuddtmeelvghfugenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvrgdtudemtggsudegmeehheeimeejrgdttdemieeigegsmehftdhffhemfhgvuddtmeelvghfugdphhgvlhhopegludelvddrudeikedruddtrdelvdgnpdhmrghilhhfrhhomhepthhhvghordhlvggsrhhunhessghoohhtlhhinhdrtghomhdpnhgspghrtghpthhtohepudefpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqthgvghhrrgesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhon hdrohhrghdprhgtphhtthhopehprgifvghllhestggruggvnhgtvgdrtghomhdprhgtphhtthhopehthhgvohdrlhgvsghruhhnsegsohhothhlihhnrdgtohhmpdhrtghpthhtoheplhhinhhugidquhhssgesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehpvghtvghrrdgthhgvnheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhoghgvrhhqsehkvghrnhgvlhdrohhrgh X-GND-Sasl: theo.lebrun@bootlin.com cdns_power_is_lost() does a register read. Call it only once rather than twice. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index 98980a23e1c22befabd049e12e13d31c58773b18..1243a5cea91b52c92172b9688a865576d4639f00 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -524,11 +524,12 @@ EXPORT_SYMBOL_GPL(cdns_suspend); int cdns_resume(struct cdns *cdns) { + bool power_lost = cdns_power_is_lost(cdns); enum usb_role real_role; bool role_changed = false; int ret = 0; - if (cdns_power_is_lost(cdns)) { + if (power_lost) { if (!cdns->role_sw) { real_role = cdns_hw_role_state_machine(cdns); if (real_role != cdns->role) { @@ -551,7 +552,7 @@ int cdns_resume(struct cdns *cdns) } if (cdns->roles[cdns->role]->resume) - cdns->roles[cdns->role]->resume(cdns, cdns_power_is_lost(cdns)); + cdns->roles[cdns->role]->resume(cdns, power_lost); return 0; }