Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Théo Lebrun and committed by
Greg Kroah-Hartman
17c6526b 0bde749c

+3 -2
+3 -2
drivers/usb/cdns3/core.c
··· 524 524 525 525 int cdns_resume(struct cdns *cdns) 526 526 { 527 + bool power_lost = cdns_power_is_lost(cdns); 527 528 enum usb_role real_role; 528 529 bool role_changed = false; 529 530 int ret = 0; 530 531 531 - if (cdns_power_is_lost(cdns)) { 532 + if (power_lost) { 532 533 if (!cdns->role_sw) { 533 534 real_role = cdns_hw_role_state_machine(cdns); 534 535 if (real_role != cdns->role) { ··· 552 551 } 553 552 554 553 if (cdns->roles[cdns->role]->resume) 555 - cdns->roles[cdns->role]->resume(cdns, cdns_power_is_lost(cdns)); 554 + cdns->roles[cdns->role]->resume(cdns, power_lost); 556 555 557 556 return 0; 558 557 }