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: dwc3: Refactor dwc3_mode_show

Use dwc3_mode_string as the single source of truth for mode-to-string
conversion.

Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20250822092411.173519-2-khtsai@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Kuen-Han Tsai and committed by
Greg Kroah-Hartman
4c9860fb 55f4ac8f

+5 -7
+5 -7
drivers/usb/dwc3/debugfs.c
··· 402 402 struct dwc3 *dwc = s->private; 403 403 unsigned long flags; 404 404 u32 reg; 405 + u32 mode; 405 406 int ret; 406 407 407 408 ret = pm_runtime_resume_and_get(dwc->dev); ··· 413 412 reg = dwc3_readl(dwc->regs, DWC3_GCTL); 414 413 spin_unlock_irqrestore(&dwc->lock, flags); 415 414 416 - switch (DWC3_GCTL_PRTCAP(reg)) { 415 + mode = DWC3_GCTL_PRTCAP(reg); 416 + switch (mode) { 417 417 case DWC3_GCTL_PRTCAP_HOST: 418 - seq_puts(s, "host\n"); 419 - break; 420 418 case DWC3_GCTL_PRTCAP_DEVICE: 421 - seq_puts(s, "device\n"); 422 - break; 423 419 case DWC3_GCTL_PRTCAP_OTG: 424 - seq_puts(s, "otg\n"); 420 + seq_printf(s, "%s\n", dwc3_mode_string(mode)); 425 421 break; 426 422 default: 427 - seq_printf(s, "UNKNOWN %08x\n", DWC3_GCTL_PRTCAP(reg)); 423 + seq_printf(s, "UNKNOWN %08x\n", mode); 428 424 } 429 425 430 426 pm_runtime_put_sync(dwc->dev);