diff mbox series

[6/9] usb: cdns3: call cdns_power_is_lost() only once in cdns_resume()

Message ID 20250129105613.403923-6-theo.lebrun@bootlin.com
State New
Headers show
Series [1/9] usb: host: xhci-plat: mvebu: use ->quirks instead of ->init_quirk() func | expand

Commit Message

Théo Lebrun Jan. 29, 2025, 10:56 a.m. UTC
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 mbox series

Patch

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;
 }