linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] serial: 8520_mtk: Prepare for platform_get_irq_optional() changes
@ 2021-12-17 18:15 Andy Shevchenko
  2022-03-04 18:11 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2021-12-17 18:15 UTC (permalink / raw)
  To: Zhiyong Tao, Andy Shevchenko, linux-serial, linux-arm-kernel,
	linux-mediatek, linux-kernel
  Cc: Greg Kroah-Hartman, Jiri Slaby, Matthias Brugger

The platform_get_irq_optional() is going to be changed in a way
that the result of it:
   = 0 means no IRQ is provided
   < 0 means the error which needs to be propagated to the upper layers
   > 0 valid vIRQ is allocated

In this case, drop check for 0. Note, the 0 is not valid vIRQ and
platform_get_irq_optional() issues a big WARN() in such case,

It's safe to assume that 0 is not valid IRQ in this case since
the driver is only instantiated via Device Tree and corresponding
OF APIs should never ever return 0 for valid IRQ. Otherwise it is
a regression there.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: explained why it's safe to assume 0 is not valid here (Greg)
 drivers/tty/serial/8250/8250_mtk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index fb65dc601b23..328ab074fd89 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -621,7 +621,7 @@ static int __maybe_unused mtk8250_suspend(struct device *dev)
 	serial8250_suspend_port(data->line);
 
 	pinctrl_pm_select_sleep_state(dev);
-	if (irq >= 0) {
+	if (irq > 0) {
 		err = enable_irq_wake(irq);
 		if (err) {
 			dev_err(dev,
@@ -641,7 +641,7 @@ static int __maybe_unused mtk8250_resume(struct device *dev)
 	struct mtk8250_data *data = dev_get_drvdata(dev);
 	int irq = data->rx_wakeup_irq;
 
-	if (irq >= 0)
+	if (irq > 0)
 		disable_irq_wake(irq);
 	pinctrl_pm_select_default_state(dev);
 
-- 
2.34.1


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] serial: 8520_mtk: Prepare for platform_get_irq_optional() changes
  2021-12-17 18:15 [PATCH v2 1/1] serial: 8520_mtk: Prepare for platform_get_irq_optional() changes Andy Shevchenko
@ 2022-03-04 18:11 ` Andy Shevchenko
  2022-03-04 18:48   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2022-03-04 18:11 UTC (permalink / raw)
  To: Zhiyong Tao, linux-serial, linux-arm-kernel, linux-mediatek,
	linux-kernel
  Cc: Greg Kroah-Hartman, Jiri Slaby, Matthias Brugger

On Fri, Dec 17, 2021 at 08:15:47PM +0200, Andy Shevchenko wrote:
> The platform_get_irq_optional() is going to be changed in a way
> that the result of it:
>    = 0 means no IRQ is provided
>    < 0 means the error which needs to be propagated to the upper layers
>    > 0 valid vIRQ is allocated
> 
> In this case, drop check for 0. Note, the 0 is not valid vIRQ and
> platform_get_irq_optional() issues a big WARN() in such case,
> 
> It's safe to assume that 0 is not valid IRQ in this case since
> the driver is only instantiated via Device Tree and corresponding
> OF APIs should never ever return 0 for valid IRQ. Otherwise it is
> a regression there.

Can it be applied now?

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] serial: 8520_mtk: Prepare for platform_get_irq_optional() changes
  2022-03-04 18:11 ` Andy Shevchenko
@ 2022-03-04 18:48   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-03-04 18:48 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Zhiyong Tao, linux-serial, linux-arm-kernel, linux-mediatek,
	linux-kernel, Jiri Slaby, Matthias Brugger

On Fri, Mar 04, 2022 at 08:11:10PM +0200, Andy Shevchenko wrote:
> On Fri, Dec 17, 2021 at 08:15:47PM +0200, Andy Shevchenko wrote:
> > The platform_get_irq_optional() is going to be changed in a way
> > that the result of it:
> >    = 0 means no IRQ is provided
> >    < 0 means the error which needs to be propagated to the upper layers
> >    > 0 valid vIRQ is allocated
> > 
> > In this case, drop check for 0. Note, the 0 is not valid vIRQ and
> > platform_get_irq_optional() issues a big WARN() in such case,
> > 
> > It's safe to assume that 0 is not valid IRQ in this case since
> > the driver is only instantiated via Device Tree and corresponding
> > OF APIs should never ever return 0 for valid IRQ. Otherwise it is
> > a regression there.
> 
> Can it be applied now?

What changed to make this viable?

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-04 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 18:15 [PATCH v2 1/1] serial: 8520_mtk: Prepare for platform_get_irq_optional() changes Andy Shevchenko
2022-03-04 18:11 ` Andy Shevchenko
2022-03-04 18:48   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).