* [PATCH 0/2] tty: serial: imx: improve the imx uart wakeup function
@ 2025-09-23 3:16 Sherry Sun
2025-09-23 3:16 ` [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source Sherry Sun
2025-09-23 3:16 ` [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting Sherry Sun
0 siblings, 2 replies; 8+ messages in thread
From: Sherry Sun @ 2025-09-23 3:16 UTC (permalink / raw)
To: gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam,
shenwei.wang
Cc: linux-serial, linux-kernel, imx
Make some improvements for imx uart wakeup function. The first patch adds
device_may_wakeup() check before configuring the wake related registers.
The second patch adds the wakeup event reporting support for imx uart.
Sherry Sun (2):
tty: serial: imx: Only configure the wake register when device is set
as wakeup source
tty: serial: imx: Add missing wakeup event reporting
drivers/tty/serial/imx.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source 2025-09-23 3:16 [PATCH 0/2] tty: serial: imx: improve the imx uart wakeup function Sherry Sun @ 2025-09-23 3:16 ` Sherry Sun 2025-09-23 8:32 ` Peng Fan 2025-09-23 16:42 ` kernel test robot 2025-09-23 3:16 ` [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting Sherry Sun 1 sibling, 2 replies; 8+ messages in thread From: Sherry Sun @ 2025-09-23 3:16 UTC (permalink / raw) To: gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam, shenwei.wang Cc: linux-serial, linux-kernel, imx Currently, imx uart defaults to enabling the wake related registers for all uart devices. However, it is unnecessary for those devices not configured as wakeup source, so add device_may_wakeup() check before configuring the uart wake related registers. Fixes: db1a9b55004c ("tty: serial: imx: Allow UART to be a source for wakeup") Signed-off-by: Sherry Sun <sherry.sun@nxp.com> --- drivers/tty/serial/imx.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 500dfc009d03..4ddfc89816bf 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2697,7 +2697,22 @@ static void imx_uart_save_context(struct imx_port *sport) /* called with irq off */ 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; u32 ucr3; + bool may_wake; + + tty = tty_port_tty_get(port); + if (tty) { + tty_dev = tty->dev; + may_wake = tty_dev && device_may_wakeup(tty_dev); + tty_kref_put(tty); + } + + /* only configure the wake register when device set as wakeup source */ + if (!may_wake) + return; uart_port_lock_irq(&sport->port); -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source 2025-09-23 3:16 ` [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source Sherry Sun @ 2025-09-23 8:32 ` Peng Fan 2025-09-23 7:36 ` Sherry Sun 2025-09-23 16:42 ` kernel test robot 1 sibling, 1 reply; 8+ messages in thread From: Peng Fan @ 2025-09-23 8:32 UTC (permalink / raw) To: Sherry Sun Cc: gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam, shenwei.wang, linux-serial, linux-kernel, imx On Tue, Sep 23, 2025 at 11:16:12AM +0800, Sherry Sun wrote: >Currently, imx uart defaults to enabling the wake related registers for >all uart devices. However, it is unnecessary for those devices not >configured as wakeup source, so add device_may_wakeup() check before >configuring the uart wake related registers. I would rewrite as this: Currently, the i.MX UART driver enables wake-related registers for all UART devices by default. However, this is unnecessary for devices that are not configured as wakeup sources. To address this, add a device_may_wakeup() check before configuring the UART wake-related registers. > >Fixes: db1a9b55004c ("tty: serial: imx: Allow UART to be a source for wakeup") >Signed-off-by: Sherry Sun <sherry.sun@nxp.com> >--- > drivers/tty/serial/imx.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > >diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c >index 500dfc009d03..4ddfc89816bf 100644 >--- a/drivers/tty/serial/imx.c >+++ b/drivers/tty/serial/imx.c >@@ -2697,7 +2697,22 @@ static void imx_uart_save_context(struct imx_port *sport) > /* called with irq off */ > 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; > u32 ucr3; >+ bool may_wake; 'bool may_wake = false;' otherwise there might be report on using an uninitalized value by coverity or other tools. >+ >+ tty = tty_port_tty_get(port); >+ if (tty) { >+ tty_dev = tty->dev; >+ may_wake = tty_dev && device_may_wakeup(tty_dev); >+ tty_kref_put(tty); >+ } >+ >+ /* only configure the wake register when device set as wakeup source */ >+ if (!may_wake) >+ return; Regards, Peng ^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source 2025-09-23 8:32 ` Peng Fan @ 2025-09-23 7:36 ` Sherry Sun 0 siblings, 0 replies; 8+ messages in thread From: Sherry Sun @ 2025-09-23 7:36 UTC (permalink / raw) To: Peng Fan (OSS) Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, Shenwei Wang, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev > -----Original Message----- > From: Peng Fan (OSS) <peng.fan@oss.nxp.com> > Sent: Tuesday, September 23, 2025 4:32 PM > To: Sherry Sun <sherry.sun@nxp.com> > Cc: gregkh@linuxfoundation.org; jirislaby@kernel.org; shawnguo@kernel.org; > s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com; > Shenwei Wang <shenwei.wang@nxp.com>; linux-serial@vger.kernel.org; > linux-kernel@vger.kernel.org; imx@lists.linux.dev > Subject: Re: [PATCH 1/2] tty: serial: imx: Only configure the wake register when > device is set as wakeup source > > On Tue, Sep 23, 2025 at 11:16:12AM +0800, Sherry Sun wrote: > >Currently, imx uart defaults to enabling the wake related registers for > >all uart devices. However, it is unnecessary for those devices not > >configured as wakeup source, so add device_may_wakeup() check before > >configuring the uart wake related registers. > > I would rewrite as this: > Currently, the i.MX UART driver enables wake-related registers for all UART > devices by default. However, this is unnecessary for devices that are not > configured as wakeup sources. To address this, add a device_may_wakeup() > check before configuring the UART wake-related registers. Thanks, that's much clearer. > > > > >Fixes: db1a9b55004c ("tty: serial: imx: Allow UART to be a source for > >wakeup") > >Signed-off-by: Sherry Sun <sherry.sun@nxp.com> > >--- > > drivers/tty/serial/imx.c | 15 +++++++++++++++ > > 1 file changed, 15 insertions(+) > > > >diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index > >500dfc009d03..4ddfc89816bf 100644 > >--- a/drivers/tty/serial/imx.c > >+++ b/drivers/tty/serial/imx.c > >@@ -2697,7 +2697,22 @@ static void imx_uart_save_context(struct > >imx_port *sport) > > /* called with irq off */ > > 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; > > u32 ucr3; > >+ bool may_wake; > > 'bool may_wake = false;' otherwise there might be report on using an > uninitalized value by coverity or other tools. Ok, will fix this in V2. Best Regards Sherry > > >+ > >+ tty = tty_port_tty_get(port); > >+ if (tty) { > >+ tty_dev = tty->dev; > >+ may_wake = tty_dev && device_may_wakeup(tty_dev); > >+ tty_kref_put(tty); > >+ } > >+ > >+ /* only configure the wake register when device set as wakeup source > */ > >+ if (!may_wake) > >+ return; > > Regards, > Peng ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source 2025-09-23 3:16 ` [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source Sherry Sun 2025-09-23 8:32 ` Peng Fan @ 2025-09-23 16:42 ` kernel test robot 1 sibling, 0 replies; 8+ messages in thread From: kernel test robot @ 2025-09-23 16:42 UTC (permalink / raw) To: Sherry Sun, gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam, shenwei.wang Cc: llvm, oe-kbuild-all, linux-serial, linux-kernel, imx Hi Sherry, kernel test robot noticed the following build warnings: [auto build test WARNING on shawnguo/for-next] [also build test WARNING on tty/tty-testing tty/tty-next tty/tty-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.17-rc7 next-20250922] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Sherry-Sun/tty-serial-imx-Only-configure-the-wake-register-when-device-is-set-as-wakeup-source/20250923-111951 base: https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next patch link: https://lore.kernel.org/r/20250923031613.2448073-2-sherry.sun%40nxp.com patch subject: [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source config: arm-randconfig-004-20250923 (https://download.01.org/0day-ci/archive/20250924/202509240009.Q4htWwxE-lkp@intel.com/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project cafc064fc7a96b3979a023ddae1da2b499d6c954) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250924/202509240009.Q4htWwxE-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202509240009.Q4htWwxE-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/tty/serial/imx.c:2707:6: warning: variable 'may_wake' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] 2707 | if (tty) { | ^~~ drivers/tty/serial/imx.c:2714:7: note: uninitialized use occurs here 2714 | if (!may_wake) | ^~~~~~~~ drivers/tty/serial/imx.c:2707:2: note: remove the 'if' if its condition is always true 2707 | if (tty) { | ^~~~~~~~ drivers/tty/serial/imx.c:2704:15: note: initialize the variable 'may_wake' to silence this warning 2704 | bool may_wake; | ^ | = 0 1 warning generated. vim +2707 drivers/tty/serial/imx.c 2696 2697 /* called with irq off */ 2698 static void imx_uart_enable_wakeup(struct imx_port *sport, bool on) 2699 { 2700 struct tty_port *port = &sport->port.state->port; 2701 struct tty_struct *tty; 2702 struct device *tty_dev; 2703 u32 ucr3; 2704 bool may_wake; 2705 2706 tty = tty_port_tty_get(port); > 2707 if (tty) { 2708 tty_dev = tty->dev; 2709 may_wake = tty_dev && device_may_wakeup(tty_dev); 2710 tty_kref_put(tty); 2711 } 2712 2713 /* only configure the wake register when device set as wakeup source */ 2714 if (!may_wake) 2715 return; 2716 2717 uart_port_lock_irq(&sport->port); 2718 2719 ucr3 = imx_uart_readl(sport, UCR3); 2720 if (on) { 2721 imx_uart_writel(sport, USR1_AWAKE, USR1); 2722 ucr3 |= UCR3_AWAKEN; 2723 } else { 2724 ucr3 &= ~UCR3_AWAKEN; 2725 } 2726 imx_uart_writel(sport, ucr3, UCR3); 2727 2728 if (sport->have_rtscts) { 2729 u32 ucr1 = imx_uart_readl(sport, UCR1); 2730 if (on) { 2731 imx_uart_writel(sport, USR1_RTSD, USR1); 2732 ucr1 |= UCR1_RTSDEN; 2733 } else { 2734 ucr1 &= ~UCR1_RTSDEN; 2735 } 2736 imx_uart_writel(sport, ucr1, UCR1); 2737 } 2738 2739 uart_port_unlock_irq(&sport->port); 2740 } 2741 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting 2025-09-23 3:16 [PATCH 0/2] tty: serial: imx: improve the imx uart wakeup function Sherry Sun 2025-09-23 3:16 ` [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source Sherry Sun @ 2025-09-23 3:16 ` Sherry Sun 2025-09-23 17:35 ` kernel test robot 2025-09-23 18:27 ` kernel test robot 1 sibling, 2 replies; 8+ messages in thread From: Sherry Sun @ 2025-09-23 3:16 UTC (permalink / raw) To: gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam, shenwei.wang Cc: linux-serial, linux-kernel, imx Current imx uart wakeup event would not report itself through sysfs as being the source of wakeup, add pm_wakeup_event() to support this. Signed-off-by: Sherry Sun <sherry.sun@nxp.com> --- drivers/tty/serial/imx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 4ddfc89816bf..647123da04f5 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -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; - u32 ucr3; - bool may_wake; + u32 ucr3, usr1; + bool may_wake, wake_active; 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting 2025-09-23 3:16 ` [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting Sherry Sun @ 2025-09-23 17:35 ` kernel test robot 2025-09-23 18:27 ` kernel test robot 1 sibling, 0 replies; 8+ messages in thread From: kernel test robot @ 2025-09-23 17:35 UTC (permalink / raw) To: Sherry Sun, gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam, shenwei.wang Cc: llvm, oe-kbuild-all, linux-serial, linux-kernel, imx Hi Sherry, kernel test robot noticed the following build errors: [auto build test ERROR on shawnguo/for-next] [also build test ERROR on usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.17-rc7 next-20250922] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Sherry-Sun/tty-serial-imx-Only-configure-the-wake-register-when-device-is-set-as-wakeup-source/20250923-111951 base: https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next patch link: https://lore.kernel.org/r/20250923031613.2448073-3-sherry.sun%40nxp.com patch subject: [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting config: x86_64-buildonly-randconfig-004-20250923 (https://download.01.org/0day-ci/archive/20250924/202509240146.aj950Liu-lkp@intel.com/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250924/202509240146.aj950Liu-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202509240146.aj950Liu-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/tty/serial/imx.c:2742:21: error: call to undeclared function 'irqd_is_wakeup_set'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 2742 | if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq))) | ^ >> drivers/tty/serial/imx.c:2742:40: error: call to undeclared function 'irq_get_irq_data'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 2742 | if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq))) | ^ drivers/tty/serial/imx.c:2742:40: note: did you mean 'irq_set_irq_wake'? include/linux/interrupt.h:481:12: note: 'irq_set_irq_wake' declared here 481 | extern int irq_set_irq_wake(unsigned int irq, unsigned int on); | ^ 2 errors generated. vim +/irqd_is_wakeup_set +2742 drivers/tty/serial/imx.c 2696 2697 /* called with irq off */ 2698 static void imx_uart_enable_wakeup(struct imx_port *sport, bool on) 2699 { 2700 struct tty_port *port = &sport->port.state->port; 2701 struct tty_struct *tty; 2702 struct device *tty_dev; 2703 u32 ucr3, usr1; 2704 bool may_wake, wake_active; 2705 2706 tty = tty_port_tty_get(port); 2707 if (tty) { 2708 tty_dev = tty->dev; 2709 may_wake = tty_dev && device_may_wakeup(tty_dev); 2710 tty_kref_put(tty); 2711 } 2712 2713 /* only configure the wake register when device set as wakeup source */ 2714 if (!may_wake) 2715 return; 2716 2717 uart_port_lock_irq(&sport->port); 2718 2719 usr1 = imx_uart_readl(sport, USR1); 2720 ucr3 = imx_uart_readl(sport, UCR3); 2721 if (on) { 2722 imx_uart_writel(sport, USR1_AWAKE, USR1); 2723 ucr3 |= UCR3_AWAKEN; 2724 } else { 2725 ucr3 &= ~UCR3_AWAKEN; 2726 wake_active = usr1 & USR1_AWAKE; 2727 } 2728 imx_uart_writel(sport, ucr3, UCR3); 2729 2730 if (sport->have_rtscts) { 2731 u32 ucr1 = imx_uart_readl(sport, UCR1); 2732 if (on) { 2733 imx_uart_writel(sport, USR1_RTSD, USR1); 2734 ucr1 |= UCR1_RTSDEN; 2735 } else { 2736 ucr1 &= ~UCR1_RTSDEN; 2737 wake_active |= usr1 & USR1_RTSD; 2738 } 2739 imx_uart_writel(sport, ucr1, UCR1); 2740 } 2741 > 2742 if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq))) 2743 pm_wakeup_event(tty_port_tty_get(port)->dev, 0); 2744 2745 uart_port_unlock_irq(&sport->port); 2746 } 2747 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting 2025-09-23 3:16 ` [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting Sherry Sun 2025-09-23 17:35 ` kernel test robot @ 2025-09-23 18:27 ` kernel test robot 1 sibling, 0 replies; 8+ messages in thread From: kernel test robot @ 2025-09-23 18:27 UTC (permalink / raw) To: Sherry Sun, gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam, shenwei.wang Cc: llvm, oe-kbuild-all, linux-serial, linux-kernel, imx Hi Sherry, kernel test robot noticed the following build warnings: [auto build test WARNING on shawnguo/for-next] [also build test WARNING on tty/tty-testing tty/tty-next tty/tty-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.17-rc7 next-20250922] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Sherry-Sun/tty-serial-imx-Only-configure-the-wake-register-when-device-is-set-as-wakeup-source/20250923-111951 base: https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next patch link: https://lore.kernel.org/r/20250923031613.2448073-3-sherry.sun%40nxp.com patch subject: [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting config: arm-randconfig-004-20250923 (https://download.01.org/0day-ci/archive/20250924/202509240214.bHWiT4Db-lkp@intel.com/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project cafc064fc7a96b3979a023ddae1da2b499d6c954) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250924/202509240214.bHWiT4Db-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202509240214.bHWiT4Db-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/tty/serial/imx.c:2721:6: warning: variable 'wake_active' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] 2721 | if (on) { | ^~ drivers/tty/serial/imx.c:2742:6: note: uninitialized use occurs here 2742 | if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq))) | ^~~~~~~~~~~ drivers/tty/serial/imx.c:2721:2: note: remove the 'if' if its condition is always false 2721 | if (on) { | ^~~~~~~~~ 2722 | imx_uart_writel(sport, USR1_AWAKE, USR1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2723 | ucr3 |= UCR3_AWAKEN; | ~~~~~~~~~~~~~~~~~~~~ 2724 | } else { | ~~~~~~ drivers/tty/serial/imx.c:2704:28: note: initialize the variable 'wake_active' to silence this warning 2704 | bool may_wake, wake_active; | ^ | = 0 drivers/tty/serial/imx.c:2707:6: warning: variable 'may_wake' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] 2707 | if (tty) { | ^~~ drivers/tty/serial/imx.c:2714:7: note: uninitialized use occurs here 2714 | if (!may_wake) | ^~~~~~~~ drivers/tty/serial/imx.c:2707:2: note: remove the 'if' if its condition is always true 2707 | if (tty) { | ^~~~~~~~ drivers/tty/serial/imx.c:2704:15: note: initialize the variable 'may_wake' to silence this warning 2704 | bool may_wake, wake_active; | ^ | = 0 2 warnings generated. vim +2721 drivers/tty/serial/imx.c c868cbb7e5c6d3 Eduardo Valentin 2015-08-11 2696 3c199ed5bd6469 Esben Haabendal 2024-09-13 2697 /* called with irq off */ 9d1a50a2cceb3a Uwe Kleine-König 2018-03-02 2698 static void imx_uart_enable_wakeup(struct imx_port *sport, bool on) 189550b8644ef5 Eduardo Valentin 2015-08-11 2699 { 519ca97b8a2e94 Sherry Sun 2025-09-23 2700 struct tty_port *port = &sport->port.state->port; 519ca97b8a2e94 Sherry Sun 2025-09-23 2701 struct tty_struct *tty; 519ca97b8a2e94 Sherry Sun 2025-09-23 2702 struct device *tty_dev; 2e33c984e6b3d6 Sherry Sun 2025-09-23 2703 u32 ucr3, usr1; 2e33c984e6b3d6 Sherry Sun 2025-09-23 2704 bool may_wake, wake_active; 519ca97b8a2e94 Sherry Sun 2025-09-23 2705 519ca97b8a2e94 Sherry Sun 2025-09-23 2706 tty = tty_port_tty_get(port); 519ca97b8a2e94 Sherry Sun 2025-09-23 2707 if (tty) { 519ca97b8a2e94 Sherry Sun 2025-09-23 2708 tty_dev = tty->dev; 519ca97b8a2e94 Sherry Sun 2025-09-23 2709 may_wake = tty_dev && device_may_wakeup(tty_dev); 519ca97b8a2e94 Sherry Sun 2025-09-23 2710 tty_kref_put(tty); 519ca97b8a2e94 Sherry Sun 2025-09-23 2711 } 519ca97b8a2e94 Sherry Sun 2025-09-23 2712 519ca97b8a2e94 Sherry Sun 2025-09-23 2713 /* only configure the wake register when device set as wakeup source */ 519ca97b8a2e94 Sherry Sun 2025-09-23 2714 if (!may_wake) 519ca97b8a2e94 Sherry Sun 2025-09-23 2715 return; 189550b8644ef5 Eduardo Valentin 2015-08-11 2716 fbd22c4fa737f9 Xiaolei Wang 2024-12-11 2717 uart_port_lock_irq(&sport->port); 3c199ed5bd6469 Esben Haabendal 2024-09-13 2718 2e33c984e6b3d6 Sherry Sun 2025-09-23 2719 usr1 = imx_uart_readl(sport, USR1); 4444dcf1fe7ea5 Uwe Kleine-König 2018-03-02 2720 ucr3 = imx_uart_readl(sport, UCR3); 09df0b3464e528 Martin Kaiser 2018-01-05 @2721 if (on) { 27c844261b87f8 Uwe Kleine-König 2018-03-02 2722 imx_uart_writel(sport, USR1_AWAKE, USR1); 4444dcf1fe7ea5 Uwe Kleine-König 2018-03-02 2723 ucr3 |= UCR3_AWAKEN; 4444dcf1fe7ea5 Uwe Kleine-König 2018-03-02 2724 } else { 4444dcf1fe7ea5 Uwe Kleine-König 2018-03-02 2725 ucr3 &= ~UCR3_AWAKEN; 2e33c984e6b3d6 Sherry Sun 2025-09-23 2726 wake_active = usr1 & USR1_AWAKE; 09df0b3464e528 Martin Kaiser 2018-01-05 2727 } 4444dcf1fe7ea5 Uwe Kleine-König 2018-03-02 2728 imx_uart_writel(sport, ucr3, UCR3); bc85734b126f81 Eduardo Valentin 2015-08-11 2729 38b1f0fb42f772 Fabio Estevam 2018-01-04 2730 if (sport->have_rtscts) { 4444dcf1fe7ea5 Uwe Kleine-König 2018-03-02 2731 u32 ucr1 = imx_uart_readl(sport, UCR1); c67643b46c28fc Fugang Duan 2021-11-25 2732 if (on) { c67643b46c28fc Fugang Duan 2021-11-25 2733 imx_uart_writel(sport, USR1_RTSD, USR1); 4444dcf1fe7ea5 Uwe Kleine-König 2018-03-02 2734 ucr1 |= UCR1_RTSDEN; c67643b46c28fc Fugang Duan 2021-11-25 2735 } else { 4444dcf1fe7ea5 Uwe Kleine-König 2018-03-02 2736 ucr1 &= ~UCR1_RTSDEN; 2e33c984e6b3d6 Sherry Sun 2025-09-23 2737 wake_active |= usr1 & USR1_RTSD; c67643b46c28fc Fugang Duan 2021-11-25 2738 } 4444dcf1fe7ea5 Uwe Kleine-König 2018-03-02 2739 imx_uart_writel(sport, ucr1, UCR1); 189550b8644ef5 Eduardo Valentin 2015-08-11 2740 } 3c199ed5bd6469 Esben Haabendal 2024-09-13 2741 2e33c984e6b3d6 Sherry Sun 2025-09-23 2742 if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq))) 2e33c984e6b3d6 Sherry Sun 2025-09-23 2743 pm_wakeup_event(tty_port_tty_get(port)->dev, 0); 2e33c984e6b3d6 Sherry Sun 2025-09-23 2744 fbd22c4fa737f9 Xiaolei Wang 2024-12-11 2745 uart_port_unlock_irq(&sport->port); 38b1f0fb42f772 Fabio Estevam 2018-01-04 2746 } 189550b8644ef5 Eduardo Valentin 2015-08-11 2747 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-09-23 18:27 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-09-23 3:16 [PATCH 0/2] tty: serial: imx: improve the imx uart wakeup function Sherry Sun 2025-09-23 3:16 ` [PATCH 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source Sherry Sun 2025-09-23 8:32 ` Peng Fan 2025-09-23 7:36 ` Sherry Sun 2025-09-23 16:42 ` kernel test robot 2025-09-23 3:16 ` [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting Sherry Sun 2025-09-23 17:35 ` kernel test robot 2025-09-23 18:27 ` kernel test robot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox