public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: theo.lebrun@bootlin.com, mathias.nyman@linux.intel.com
Cc: rogerq@kernel.org, peter.chen@kernel.org, pawell@cadence.com,
	gregkh@linuxfoundation.org, mathias.nyman@intel.com,
	gregory.clement@bootlin.com, thomas.petazzoni@bootlin.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 6/9] usb: cdns3: call cdns_power_is_lost() only once in cdns_resume()
Date: Wed, 29 Jan 2025 11:56:10 +0100	[thread overview]
Message-ID: <20250129105613.403923-6-theo.lebrun@bootlin.com> (raw)
In-Reply-To: <D7EHVKGXIFM4.3IDSI7TDG85AV@bootlin.com>

cdns_power_is_lost() does a register read.
Call it only once rather than twice.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
 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 465e9267b49c..799987c88960 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) {
 			cdns->role = cdns_role_get(cdns->role_sw);
 		} else {
@@ -553,7 +554,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;
 }
-- 
2.48.1


  parent reply	other threads:[~2025-01-29 10:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 17:13 [PATCH v6 0/5] Fix USB suspend on TI J7200 (cdns3-ti, cdns3, xhci) Théo Lebrun
2024-12-10 17:13 ` [PATCH v6 1/5] usb: cdns3-ti: move reg writes to separate function Théo Lebrun
2024-12-12 12:12   ` Roger Quadros
2024-12-10 17:13 ` [PATCH v6 2/5] usb: cdns3-ti: run HW init at resume() if HW was reset Théo Lebrun
2024-12-12 12:18   ` Roger Quadros
2024-12-13 15:28     ` Théo Lebrun
2024-12-17 21:13       ` Roger Quadros
2024-12-14  8:49   ` Peter Chen
2024-12-16 14:02     ` Théo Lebrun
2024-12-17  6:12       ` Peter Chen
2024-12-10 17:13 ` [PATCH v6 3/5] usb: cdns3: rename hibernated argument of role->resume() to lost_power Théo Lebrun
2024-12-14  8:51   ` Peter Chen
2024-12-10 17:13 ` [PATCH v6 4/5] xhci: introduce xhci->lost_power flag Théo Lebrun
2024-12-12 12:37   ` Roger Quadros
2024-12-13 16:03     ` Théo Lebrun
2024-12-17 21:00       ` Roger Quadros
2024-12-18 17:49         ` Théo Lebrun
2025-01-08 10:59           ` Théo Lebrun
2025-01-08 18:43             ` Mathias Nyman
2025-01-29 10:45               ` Théo Lebrun
2025-01-29 10:56                 ` [PATCH 1/9] usb: host: xhci-plat: mvebu: use ->quirks instead of ->init_quirk() func Théo Lebrun
2025-01-29 10:56                 ` [PATCH 2/9] usb: xhci: tegra: rename `runtime` boolean to `is_auto_runtime` Théo Lebrun
2025-01-29 10:56                 ` [PATCH 3/9] usb: cdns3-ti: move reg writes to separate function Théo Lebrun
2025-01-29 10:56                 ` [PATCH 4/9] usb: cdns3-ti: run HW init at resume() if HW was reset Théo Lebrun
2025-01-29 10:56                 ` [PATCH 5/9] usb: cdns3: rename hibernated argument of role->resume() to lost_power Théo Lebrun
2025-01-29 10:56                 ` Théo Lebrun [this message]
2025-01-29 10:56                 ` [PATCH 7/9] usb: xhci: change xhci_resume() parameters to explicit the desired info Théo Lebrun
2025-01-29 10:56                 ` [PATCH 8/9] usb: host: xhci-plat: allow upper layers to signal power loss Théo Lebrun
2025-01-29 10:56                 ` [PATCH 9/9] usb: host: cdns3: forward lost power information to xhci Théo Lebrun
2024-12-10 17:13 ` [PATCH v6 5/5] usb: cdns3: host: transmit lost_power signal from wrapper to XHCI Théo Lebrun
2024-12-14  9:06 ` [PATCH v6 0/5] Fix USB suspend on TI J7200 (cdns3-ti, cdns3, xhci) Peter Chen
2024-12-16 14:09   ` Théo Lebrun
2024-12-17  6:17     ` Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250129105613.403923-6-theo.lebrun@bootlin.com \
    --to=theo.lebrun@bootlin.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=mathias.nyman@linux.intel.com \
    --cc=pawell@cadence.com \
    --cc=peter.chen@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox