diff mbox series

tty: serial: sh-sci: Fix transmit end interrupt handler

Message ID 20230411100859.305617-1-biju.das.jz@bp.renesas.com (mailing list archive)
State Rejected
Delegated to: Geert Uytterhoeven
Headers show
Series tty: serial: sh-sci: Fix transmit end interrupt handler | expand

Commit Message

Biju Das April 11, 2023, 10:08 a.m. UTC
commit b43a18647f03c87e77d50d6fe74904b61b96323e upstream.

The fourth interrupt on SCI port is transmit end interrupt compared to
the break interrupt on other port types. So, shuffle the interrupts to fix
the transmit end interrupt handler.

Fixes: e1d0be616186 ("sh-sci: Add h8300 SCI")
Cc: stable <stable@kernel.org>
Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230317150403.154094-1-biju.das.jz@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[biju: manually fixed the conflicts]
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
Resending to 4.14 with confilcts [1] fixed.
[1] https://lore.kernel.org/stable/2023041046-synthetic-urgent-3126@gregkh/T/#u
---
 drivers/tty/serial/sh-sci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Greg KH April 11, 2023, 2:14 p.m. UTC | #1
On Tue, Apr 11, 2023 at 11:08:59AM +0100, Biju Das wrote:
> commit b43a18647f03c87e77d50d6fe74904b61b96323e upstream.
> 
> The fourth interrupt on SCI port is transmit end interrupt compared to
> the break interrupt on other port types. So, shuffle the interrupts to fix
> the transmit end interrupt handler.
> 
> Fixes: e1d0be616186 ("sh-sci: Add h8300 SCI")
> Cc: stable <stable@kernel.org>
> Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Link: https://lore.kernel.org/r/20230317150403.154094-1-biju.das.jz@bp.renesas.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> [biju: manually fixed the conflicts]
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> Resending to 4.14 with confilcts [1] fixed.
> [1] https://lore.kernel.org/stable/2023041046-synthetic-urgent-3126@gregkh/T/#u

You did not actually build your patch, as it breaks the build :(
Biju Das April 11, 2023, 2:24 p.m. UTC | #2
Hi Greg,

Thanks for the feedback.

> Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt handler
> 
> On Tue, Apr 11, 2023 at 11:08:59AM +0100, Biju Das wrote:
> > commit b43a18647f03c87e77d50d6fe74904b61b96323e upstream.
> >
> > The fourth interrupt on SCI port is transmit end interrupt compared to
> > the break interrupt on other port types. So, shuffle the interrupts to
> > fix the transmit end interrupt handler.
> >
> > Fixes: e1d0be616186 ("sh-sci: Add h8300 SCI")
> > Cc: stable <stable@kernel.org>
> > Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Link:
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > [biju: manually fixed the conflicts]
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > Resending to 4.14 with confilcts [1] fixed.
> > [1]
> 
> You did not actually build your patch, as it breaks the build :(

Actually, I build the patch, but did not test it on target as I don't have the platform
to test it.

I got some issues while building modules which is unrelated to this change.

Anyway, I will double check again and confirm.

Cheers,
Biju
Biju Das April 11, 2023, 2:40 p.m. UTC | #3
Hi Greg,

> Subject: RE: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt handler
> 
> Hi Greg,
> 
> Thanks for the feedback.
> 
> > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt
> > handler
> >
> > On Tue, Apr 11, 2023 at 11:08:59AM +0100, Biju Das wrote:
> > > commit b43a18647f03c87e77d50d6fe74904b61b96323e upstream.
> > >
> > > The fourth interrupt on SCI port is transmit end interrupt compared
> > > to the break interrupt on other port types. So, shuffle the
> > > interrupts to fix the transmit end interrupt handler.
> > >
> > > Fixes: e1d0be616186 ("sh-sci: Add h8300 SCI")
> > > Cc: stable <stable@kernel.org>
> > > Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > Link:
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > [biju: manually fixed the conflicts]
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > > Resending to 4.14 with confilcts [1] fixed.
> > > [1]
> >
> > You did not actually build your patch, as it breaks the build :(
> 
> Actually, I build the patch, but did not test it on target as I don't have
> the platform to test it.
> 
> I got some issues while building modules which is unrelated to this change.
> 
> Anyway, I will double check again and confirm.

I confirm, there is an issue with this patch.

I disabled building modules from my build script and it showed the below error. 
So I would like to drop this patch for 4.14 as this header file does not exist for 4.14.

drivers/tty/serial/sh-sci.c:40:10: fatal error: linux/minmax.h: No such file or directory
   40 | #include <linux/minmax.h>
      |          ^~~~~~~~~~~~~~~~

Cheers,
Biju
Greg KH April 11, 2023, 2:56 p.m. UTC | #4
On Tue, Apr 11, 2023 at 02:40:52PM +0000, Biju Das wrote:
> Hi Greg,
> 
> > Subject: RE: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt handler
> > 
> > Hi Greg,
> > 
> > Thanks for the feedback.
> > 
> > > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt
> > > handler
> > >
> > > On Tue, Apr 11, 2023 at 11:08:59AM +0100, Biju Das wrote:
> > > > commit b43a18647f03c87e77d50d6fe74904b61b96323e upstream.
> > > >
> > > > The fourth interrupt on SCI port is transmit end interrupt compared
> > > > to the break interrupt on other port types. So, shuffle the
> > > > interrupts to fix the transmit end interrupt handler.
> > > >
> > > > Fixes: e1d0be616186 ("sh-sci: Add h8300 SCI")
> > > > Cc: stable <stable@kernel.org>
> > > > Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > Link:
> > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > [biju: manually fixed the conflicts]
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > ---
> > > > Resending to 4.14 with confilcts [1] fixed.
> > > > [1]
> > >
> > > You did not actually build your patch, as it breaks the build :(
> > 
> > Actually, I build the patch, but did not test it on target as I don't have
> > the platform to test it.
> > 
> > I got some issues while building modules which is unrelated to this change.
> > 
> > Anyway, I will double check again and confirm.
> 
> I confirm, there is an issue with this patch.
> 
> I disabled building modules from my build script and it showed the below error. 
> So I would like to drop this patch for 4.14 as this header file does not exist for 4.14.
> 
> drivers/tty/serial/sh-sci.c:40:10: fatal error: linux/minmax.h: No such file or directory
>    40 | #include <linux/minmax.h>
>       |          ^~~~~~~~~~~~~~~~

Yes, minmax is not there, but the function needed by that is there
(hint, I had to remove that include in 4.19).  Remove it and see the
next error you get :)

thanks,

greg k-h
Biju Das April 11, 2023, 3:36 p.m. UTC | #5
Hi Greg,

> Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt handler
> 
> On Tue, Apr 11, 2023 at 02:40:52PM +0000, Biju Das wrote:
> > Hi Greg,
> >
> > > Subject: RE: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt
> > > handler
> > >
> > > Hi Greg,
> > >
> > > Thanks for the feedback.
> > >
> > > > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end
> > > > interrupt handler
> > > >
> > > > On Tue, Apr 11, 2023 at 11:08:59AM +0100, Biju Das wrote:
> > > > > commit b43a18647f03c87e77d50d6fe74904b61b96323e upstream.
> > > > >
> > > > > The fourth interrupt on SCI port is transmit end interrupt
> > > > > compared to the break interrupt on other port types. So, shuffle
> > > > > the interrupts to fix the transmit end interrupt handler.
> > > > >
> > > > > Fixes: e1d0be616186 ("sh-sci: Add h8300 SCI")
> > > > > Cc: stable <stable@kernel.org>
> > > > > Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > Link:
> > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > > [biju: manually fixed the conflicts]
> > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > ---
> > > > > Resending to 4.14 with confilcts [1] fixed.
> > > > > [1]
> > > >
> > > > You did not actually build your patch, as it breaks the build :(
> > >
> > > Actually, I build the patch, but did not test it on target as I
> > > don't have the platform to test it.
> > >
> > > I got some issues while building modules which is unrelated to this
> change.
> > >
> > > Anyway, I will double check again and confirm.
> >
> > I confirm, there is an issue with this patch.
> >
> > I disabled building modules from my build script and it showed the below
> error.
> > So I would like to drop this patch for 4.14 as this header file does not
> exist for 4.14.
> >
> > drivers/tty/serial/sh-sci.c:40:10: fatal error: linux/minmax.h: No such
> file or directory
> >    40 | #include <linux/minmax.h>
> >       |          ^~~~~~~~~~~~~~~~
> 
> Yes, minmax is not there, but the function needed by that is there (hint, I
> had to remove that include in 4.19).  Remove it and see the next error you
> get :)
> 

OK got it, The SCIx_TEI_IRQ  is introduced after 4.18 by patch [1]. 

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/tty/serial/sh-sci.c?h=linux-5.4.y&id=628c534ae73581fd21a09a27b7a4222b01a44d64

So, 4.14 does not require this patch, as it have combined interrupt.

Cheers,
Biju
Greg KH April 12, 2023, 6:37 a.m. UTC | #6
On Tue, Apr 11, 2023 at 03:36:04PM +0000, Biju Das wrote:
> 
> Hi Greg,
> 
> > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt handler
> > 
> > On Tue, Apr 11, 2023 at 02:40:52PM +0000, Biju Das wrote:
> > > Hi Greg,
> > >
> > > > Subject: RE: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt
> > > > handler
> > > >
> > > > Hi Greg,
> > > >
> > > > Thanks for the feedback.
> > > >
> > > > > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end
> > > > > interrupt handler
> > > > >
> > > > > On Tue, Apr 11, 2023 at 11:08:59AM +0100, Biju Das wrote:
> > > > > > commit b43a18647f03c87e77d50d6fe74904b61b96323e upstream.
> > > > > >
> > > > > > The fourth interrupt on SCI port is transmit end interrupt
> > > > > > compared to the break interrupt on other port types. So, shuffle
> > > > > > the interrupts to fix the transmit end interrupt handler.
> > > > > >
> > > > > > Fixes: e1d0be616186 ("sh-sci: Add h8300 SCI")
> > > > > > Cc: stable <stable@kernel.org>
> > > > > > Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > > Link:
> > > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > > > [biju: manually fixed the conflicts]
> > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > > ---
> > > > > > Resending to 4.14 with confilcts [1] fixed.
> > > > > > [1]
> > > > >
> > > > > You did not actually build your patch, as it breaks the build :(
> > > >
> > > > Actually, I build the patch, but did not test it on target as I
> > > > don't have the platform to test it.
> > > >
> > > > I got some issues while building modules which is unrelated to this
> > change.
> > > >
> > > > Anyway, I will double check again and confirm.
> > >
> > > I confirm, there is an issue with this patch.
> > >
> > > I disabled building modules from my build script and it showed the below
> > error.
> > > So I would like to drop this patch for 4.14 as this header file does not
> > exist for 4.14.
> > >
> > > drivers/tty/serial/sh-sci.c:40:10: fatal error: linux/minmax.h: No such
> > file or directory
> > >    40 | #include <linux/minmax.h>
> > >       |          ^~~~~~~~~~~~~~~~
> > 
> > Yes, minmax is not there, but the function needed by that is there (hint, I
> > had to remove that include in 4.19).  Remove it and see the next error you
> > get :)
> > 
> 
> OK got it, The SCIx_TEI_IRQ  is introduced after 4.18 by patch [1]. 
> 
> [1] 
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/tty/serial/sh-sci.c?h=linux-5.4.y&id=628c534ae73581fd21a09a27b7a4222b01a44d64
> 
> So, 4.14 does not require this patch, as it have combined interrupt.

Great, thanks for checking, it turns out that the Fixes: tag was wrong :(
Biju Das April 12, 2023, 6:52 a.m. UTC | #7
Hi Greg,

Thanks for the feedback.

> Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt handler
> 
> On Tue, Apr 11, 2023 at 03:36:04PM +0000, Biju Das wrote:
> >
> > Hi Greg,
> >
> > > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt
> > > handler
> > >
> > > On Tue, Apr 11, 2023 at 02:40:52PM +0000, Biju Das wrote:
> > > > Hi Greg,
> > > >
> > > > > Subject: RE: [PATCH] tty: serial: sh-sci: Fix transmit end
> > > > > interrupt handler
> > > > >
> > > > > Hi Greg,
> > > > >
> > > > > Thanks for the feedback.
> > > > >
> > > > > > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end
> > > > > > interrupt handler
> > > > > >
> > > > > > On Tue, Apr 11, 2023 at 11:08:59AM +0100, Biju Das wrote:
> > > > > > > commit b43a18647f03c87e77d50d6fe74904b61b96323e upstream.
> > > > > > >
> > > > > > > The fourth interrupt on SCI port is transmit end interrupt
> > > > > > > compared to the break interrupt on other port types. So,
> > > > > > > shuffle the interrupts to fix the transmit end interrupt
> handler.
> > > > > > >
> > > > > > > Fixes: e1d0be616186 ("sh-sci: Add h8300 SCI")
> > > > > > > Cc: stable <stable@kernel.org>
> > > > > > > Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > > > Link:
> > > > > > > Signed-off-by: Greg Kroah-Hartman
> > > > > > > <gregkh@linuxfoundation.org>
> > > > > > > [biju: manually fixed the conflicts]
> > > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > > > ---
> > > > > > > Resending to 4.14 with confilcts [1] fixed.
> > > > > > > [1]
> > > > > >
> > > > > > You did not actually build your patch, as it breaks the build
> > > > > > :(
> > > > >
> > > > > Actually, I build the patch, but did not test it on target as I
> > > > > don't have the platform to test it.
> > > > >
> > > > > I got some issues while building modules which is unrelated to
> > > > > this
> > > change.
> > > > >
> > > > > Anyway, I will double check again and confirm.
> > > >
> > > > I confirm, there is an issue with this patch.
> > > >
> > > > I disabled building modules from my build script and it showed the
> > > > below
> > > error.
> > > > So I would like to drop this patch for 4.14 as this header file
> > > > does not
> > > exist for 4.14.
> > > >
> > > > drivers/tty/serial/sh-sci.c:40:10: fatal error: linux/minmax.h: No
> > > > such
> > > file or directory
> > > >    40 | #include <linux/minmax.h>
> > > >       |          ^~~~~~~~~~~~~~~~
> > >
> > > Yes, minmax is not there, but the function needed by that is there
> > > (hint, I had to remove that include in 4.19).  Remove it and see the
> > > next error you get :)
> > >
> >
> > OK got it, The SCIx_TEI_IRQ  is introduced after 4.18 by patch [1].
> >
> > [1]
> >
> > So, 4.14 does not require this patch, as it have combined interrupt.
> 
> Great, thanks for checking, it turns out that the Fixes: tag was wrong :(

I agree. It is my fault, next time I will take care this.

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index f7dd843a3eff..7cf95ffad4c9 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -37,6 +37,7 @@ 
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/major.h>
+#include <linux/minmax.h>
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/of.h>
@@ -2775,6 +2776,13 @@  static int sci_init_single(struct platform_device *dev,
 	for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i)
 		sci_port->irqs[i] = platform_get_irq(dev, i);
 
+	/*
+	 * The fourth interrupt on SCI port is transmit end interrupt, so
+	 * shuffle the interrupts.
+	 */
+	if (p->type == PORT_SCI)
+		swap(sci_port->irqs[SCIx_BRI_IRQ], sci_port->irqs[SCIx_TEI_IRQ]);
+
 	/* The SCI generates several interrupts. They can be muxed together or
 	 * connected to different interrupt lines. In the muxed case only one
 	 * interrupt resource is specified. In the non-muxed case three or four