]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: cdns3: call cdns_power_is_lost() only once in cdns_resume()
authorThéo Lebrun <theo.lebrun@bootlin.com>
Wed, 5 Feb 2025 17:36:49 +0000 (18:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Mar 2025 08:18:02 +0000 (09:18 +0100)
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>
drivers/usb/cdns3/core.c

index 98980a23e1c22befabd049e12e13d31c58773b18..1243a5cea91b52c92172b9688a865576d4639f00 100644 (file)
@@ -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;
 }