usb: typec: tcpm: Unconditionally return port->current_limit
authorNolen Johnson <johnsonnolen@gmail.com>
Tue, 21 Dec 2021 19:47:24 +0000 (14:47 -0500)
committerChristian Hoffmann <chrmhoffmann@gmail.com>
Sun, 12 Feb 2023 08:13:15 +0000 (09:13 +0100)
* For the function `tcpm_psy_get_current_max`, normally we compare max
  of `port->current_limit` and `tcpm_get_max_fixed_current(port)`, but
  `tcpm_get_max_fixed_current` is guarded by a messy DEBUGFS config
  check. So, lets play it safe and assume that the port's limit is the
  limit.

Change-Id: I9df703cd47f3a94b723b861fbfae0aabf13fb92c

drivers/usb/typec/tcpm.c

index 41c394e0c9bfa433ed03e96b3c1a6d1f7e4f1cfd..e939f850fb0d67a78c7bea805bc414b7db932e0f 100644 (file)
@@ -4638,9 +4638,7 @@ static int tcpm_psy_get_current_max(struct tcpm_port *port,
        if (port->pps_data.active)
                val->intval = port->pps_data.max_curr * 1000;
        else
-               val->intval = max_t(size_t, tcpm_get_max_fixed_current(port),
-                                 port->current_limit) * 1000;
-
+               val->intval = port->current_limit * 1000;
        return 0;
 }