lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250821233058.mmhwdxcbssyvbl6j@synopsys.com>
Date: Thu, 21 Aug 2025 23:30:59 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Kuen-Han Tsai <khtsai@...gle.com>
CC: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] usb: dwc3: Refactor dwc3_mode_show

On Mon, Aug 18, 2025, Kuen-Han Tsai wrote:
> Use dwc3_mode_string as the single source of truth for mode-to-string
> conversion.
> 
> Signed-off-by: Kuen-Han Tsai <khtsai@...gle.com>
> ---
>  drivers/usb/dwc3/debugfs.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
> index ebf03468fac4..d18bf5e32cc8 100644
> --- a/drivers/usb/dwc3/debugfs.c
> +++ b/drivers/usb/dwc3/debugfs.c
> @@ -402,6 +402,7 @@ static int dwc3_mode_show(struct seq_file *s, void *unused)
>  	struct dwc3		*dwc = s->private;
>  	unsigned long		flags;
>  	u32			reg;
> +	u32			mode;
>  	int			ret;
>  
>  	ret = pm_runtime_resume_and_get(dwc->dev);
> @@ -412,18 +413,15 @@ static int dwc3_mode_show(struct seq_file *s, void *unused)
>  	reg = dwc3_readl(dwc->regs, DWC3_GCTL);
>  	spin_unlock_irqrestore(&dwc->lock, flags);
>  
> -	switch (DWC3_GCTL_PRTCAP(reg)) {
> +	mode = DWC3_GCTL_PRTCAP(reg);
> +	switch (mode) {
>  	case DWC3_GCTL_PRTCAP_HOST:
> -		seq_puts(s, "host\n");
> -		break;
>  	case DWC3_GCTL_PRTCAP_DEVICE:
> -		seq_puts(s, "device\n");
> -		break;
>  	case DWC3_GCTL_PRTCAP_OTG:
> -		seq_puts(s, "otg\n");
> +		seq_printf(s, "%s\n", dwc3_mode_string(mode));
>  		break;
>  	default:
> -		seq_printf(s, "UNKNOWN %08x\n", DWC3_GCTL_PRTCAP(reg));
> +		seq_printf(s, "UNKNOWN %08x\n", mode);
>  	}
>  
>  	pm_runtime_put_sync(dwc->dev);
> -- 
> 2.51.0.rc1.163.g2494970778-goog
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@...opsys.com>

Thanks,
Thinh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ