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

Configure Feed

Select the types of activity you want to include in your feed.

usb: hub: Use max() to improve usb_set_lpm_pel()

Use max() to simplify and improve the readability of usb_set_lpm_pel().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250917101235.58381-2-thorsten.blum@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thorsten Blum and committed by
Greg Kroah-Hartman
87653d54 09bf21bf

+3 -8
+3 -8
drivers/usb/core/hub.c
··· 28 28 #include <linux/usb/otg.h> 29 29 #include <linux/usb/quirks.h> 30 30 #include <linux/workqueue.h> 31 + #include <linux/minmax.h> 31 32 #include <linux/mutex.h> 32 33 #include <linux/random.h> 33 34 #include <linux/pm_qos.h> ··· 278 277 * device and the parent hub into U0. The exit latency is the bigger of 279 278 * the device exit latency or the hub exit latency. 280 279 */ 281 - if (udev_exit_latency > hub_exit_latency) 282 - first_link_pel = udev_exit_latency * 1000; 283 - else 284 - first_link_pel = hub_exit_latency * 1000; 280 + first_link_pel = max(udev_exit_latency, hub_exit_latency) * 1000; 285 281 286 282 /* 287 283 * When the hub starts to receive the LFPS, there is a slight delay for ··· 292 294 * According to figure C-7 in the USB 3.0 spec, the PEL for this device 293 295 * is the greater of the two exit latencies. 294 296 */ 295 - if (first_link_pel > hub_pel) 296 - udev_lpm_params->pel = first_link_pel; 297 - else 298 - udev_lpm_params->pel = hub_pel; 297 + udev_lpm_params->pel = max(first_link_pel, hub_pel); 299 298 } 300 299 301 300 /*