Skip to content

Commit 17c6526

Browse files
tlebgregkh
authored andcommitted
usb: cdns3: call cdns_power_is_lost() only once in cdns_resume()
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> Link: https://lore.kernel.org/r/20250205-s2r-cdns-v7-4-13658a271c3c@bootlin.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0bde749 commit 17c6526

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/usb/cdns3/core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,12 @@ EXPORT_SYMBOL_GPL(cdns_suspend);
524524

525525
int cdns_resume(struct cdns *cdns)
526526
{
527+
bool power_lost = cdns_power_is_lost(cdns);
527528
enum usb_role real_role;
528529
bool role_changed = false;
529530
int ret = 0;
530531

531-
if (cdns_power_is_lost(cdns)) {
532+
if (power_lost) {
532533
if (!cdns->role_sw) {
533534
real_role = cdns_hw_role_state_machine(cdns);
534535
if (real_role != cdns->role) {
@@ -551,7 +552,7 @@ int cdns_resume(struct cdns *cdns)
551552
}
552553

553554
if (cdns->roles[cdns->role]->resume)
554-
cdns->roles[cdns->role]->resume(cdns, cdns_power_is_lost(cdns));
555+
cdns->roles[cdns->role]->resume(cdns, power_lost);
555556

556557
return 0;
557558
}

0 commit comments

Comments
 (0)