linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] serial: 8520_mtk: Prepare for platform_get_irq_optional() changes
@ 2021-12-17 15:10 Andy Shevchenko
  2021-12-17 16:54 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2021-12-17 15:10 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,

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serial/8250/8250_mtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index fb65dc601b23..8d3e16d7bf63 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

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

On Fri, Dec 17, 2021 at 05:10:34PM +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

What about 0 being a valid irq?

> 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,

But it still is a valid irq, so why did you just break things?  Yes, a
warning will happen, but the driver and platform will still work.

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/tty/serial/8250/8250_mtk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index fb65dc601b23..8d3e16d7bf63 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -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);

Why change this now?  What does this solve at this point in time?

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

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

On Fri, Dec 17, 2021 at 05:54:55PM +0100, Greg Kroah-Hartman wrote:
> On Fri, Dec 17, 2021 at 05:10:34PM +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
> 
> What about 0 being a valid irq?

For this driver it can't be possible. The driver is instantiated via DT only
and OF APIs never return 0 for IRQ. If it's the case, it's a regression in the
OF APIs.

I can elaborate in the commit message.

> > 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,
> 
> But it still is a valid irq, so why did you just break things?  Yes, a
> warning will happen, but the driver and platform will still work.

In general yes, but not in this case. See above.

...

> > -	if (irq >= 0)
> > +	if (irq > 0)
> >  		disable_irq_wake(irq);
> 
> Why change this now?  What does this solve at this point in time?

As explained in the commit message, it's a preparation patch to fix the logic
behind platform_get_irq_optional().

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-12-17 18:42 UTC | newest]

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

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).