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] [day] [month] [year] [list]
Message-ID:
 <DB9PR04MB842963CA515E645566CFD2B4921FA@DB9PR04MB8429.eurprd04.prod.outlook.com>
Date: Thu, 25 Sep 2025 08:51:11 +0000
From: Sherry Sun <sherry.sun@....com>
To: Frank Li <frank.li@....com>
CC: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"jirislaby@...nel.org" <jirislaby@...nel.org>, "shawnguo@...nel.org"
	<shawnguo@...nel.org>, "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
	"kernel@...gutronix.de" <kernel@...gutronix.de>, "festevam@...il.com"
	<festevam@...il.com>, Shenwei Wang <shenwei.wang@....com>, Peng Fan
	<peng.fan@....com>, "linux-serial@...r.kernel.org"
	<linux-serial@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>
Subject: RE: [PATCH V2 2/2] tty: serial: imx: Add missing wakeup event
 reporting



> -----Original Message-----
> From: Frank Li <frank.li@....com>
> Sent: Wednesday, September 24, 2025 10:53 PM
> To: Sherry Sun <sherry.sun@....com>
> Cc: gregkh@...uxfoundation.org; jirislaby@...nel.org; shawnguo@...nel.org;
> s.hauer@...gutronix.de; kernel@...gutronix.de; festevam@...il.com;
> Shenwei Wang <shenwei.wang@....com>; Peng Fan <peng.fan@....com>;
> linux-serial@...r.kernel.org; linux-kernel@...r.kernel.org;
> imx@...ts.linux.dev
> Subject: Re: [PATCH V2 2/2] tty: serial: imx: Add missing wakeup event
> reporting
> 
> On Wed, Sep 24, 2025 at 11:15:50AM +0800, Sherry Sun wrote:
> > Current imx uart wakeup event would not report itself as wakeup source
> > through sysfs. Add pm_wakeup_event() to support it.
> >
> > Signed-off-by: Sherry Sun <sherry.sun@....com>
> > ---
> >  drivers/tty/serial/imx.c | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index
> > 87d841c0b22f..b83f5c9c722c 100644
> > --- a/drivers/tty/serial/imx.c
> > +++ b/drivers/tty/serial/imx.c
> > @@ -30,7 +30,7 @@
> >  #include <linux/iopoll.h>
> >  #include <linux/dma-mapping.h>
> >
> > -#include <asm/irq.h>
> > +#include <linux/irq.h>
> >  #include <linux/dma/imx-dma.h>
> >
> >  #include "serial_mctrl_gpio.h"
> > @@ -2700,8 +2700,8 @@ static void imx_uart_enable_wakeup(struct
> imx_port *sport, bool on)
> >  	struct tty_port *port = &sport->port.state->port;
> >  	struct tty_struct *tty;
> >  	struct device *tty_dev;
> > -	bool may_wake = false;
> > -	u32 ucr3;
> > +	bool may_wake = false, wake_active = false;
> 
> You use bit OR at follow code. so wake_active should not bool type.
> change it u32.

Hi Frank, thanks for pointing this out, this does need improvement.
I'd still prefer to use a bool type for wake_active, since it indicates whether uart wakeup was triggered.
Maybe add !!()  would make it clearer.

-                       wake_active |= usr1 & USR1_RTSD;
+                       wake_active |= !!(usr1 & USR1_RTSD);

Best Regards
Sherry

> 
> Frank
> > +	u32 ucr3, usr1;
> >
> >  	tty = tty_port_tty_get(port);
> >  	if (tty) {
> > @@ -2716,12 +2716,14 @@ static void imx_uart_enable_wakeup(struct
> > imx_port *sport, bool on)
> >
> >  	uart_port_lock_irq(&sport->port);
> >
> > +	usr1 = imx_uart_readl(sport, USR1);
> >  	ucr3 = imx_uart_readl(sport, UCR3);
> >  	if (on) {
> >  		imx_uart_writel(sport, USR1_AWAKE, USR1);
> >  		ucr3 |= UCR3_AWAKEN;
> >  	} else {
> >  		ucr3 &= ~UCR3_AWAKEN;
> > +		wake_active = usr1 & USR1_AWAKE;
> >  	}
> >  	imx_uart_writel(sport, ucr3, UCR3);
> >
> > @@ -2732,10 +2734,14 @@ static void imx_uart_enable_wakeup(struct
> imx_port *sport, bool on)
> >  			ucr1 |= UCR1_RTSDEN;
> >  		} else {
> >  			ucr1 &= ~UCR1_RTSDEN;
> > +			wake_active |= usr1 & USR1_RTSD;
> >  		}
> >  		imx_uart_writel(sport, ucr1, UCR1);
> >  	}
> >
> > +	if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport-
> >port.irq)))
> > +		pm_wakeup_event(tty_port_tty_get(port)->dev, 0);
> > +
> >  	uart_port_unlock_irq(&sport->port);
> >  }
> >
> > --
> > 2.34.1
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ