linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts
@ 2019-10-01 18:07 Geert Uytterhoeven
  2019-10-02  4:49 ` Yoshihiro Shimoda
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-10-01 18:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Stephen Boyd, linux-renesas-soc, linux-serial, linux-kernel,
	Geert Uytterhoeven

As platform_get_irq() now prints an error when the interrupt does not
exist, scary warnings may be printed for optional interrupts:

    sh-sci e6550000.serial: IRQ index 1 not found
    sh-sci e6550000.serial: IRQ index 2 not found
    sh-sci e6550000.serial: IRQ index 3 not found
    sh-sci e6550000.serial: IRQ index 4 not found
    sh-sci e6550000.serial: IRQ index 5 not found

Fix this by calling platform_get_irq_optional() instead for all but the
first interrupts, which are optional.

Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is a fix for v5.4-rc1.
---
 drivers/tty/serial/sh-sci.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 4e754a4850e6db63..22e5d4e13714e863 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2894,8 +2894,12 @@ static int sci_init_single(struct platform_device *dev,
 	port->mapbase = res->start;
 	sci_port->reg_size = resource_size(res);
 
-	for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i)
-		sci_port->irqs[i] = platform_get_irq(dev, i);
+	for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) {
+		if (i)
+			sci_port->irqs[i] = platform_get_irq_optional(dev, i);
+		else
+			sci_port->irqs[i] = platform_get_irq(dev, i);
+	}
 
 	/* The SCI generates several interrupts. They can be muxed together or
 	 * connected to different interrupt lines. In the muxed case only one
-- 
2.17.1


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

* RE: [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts
  2019-10-01 18:07 [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts Geert Uytterhoeven
@ 2019-10-02  4:49 ` Yoshihiro Shimoda
  2019-10-02  9:52 ` kbuild test robot
  2019-10-03 16:10 ` Stephen Boyd
  2 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2019-10-02  4:49 UTC (permalink / raw)
  To: Geert Uytterhoeven, Greg Kroah-Hartman, Jiri Slaby
  Cc: Stephen Boyd, linux-renesas-soc, linux-serial, linux-kernel

Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Wednesday, October 2, 2019 3:08 AM
> 
> As platform_get_irq() now prints an error when the interrupt does not
> exist, scary warnings may be printed for optional interrupts:
> 
>     sh-sci e6550000.serial: IRQ index 1 not found
>     sh-sci e6550000.serial: IRQ index 2 not found
>     sh-sci e6550000.serial: IRQ index 3 not found
>     sh-sci e6550000.serial: IRQ index 4 not found
>     sh-sci e6550000.serial: IRQ index 5 not found
> 
> Fix this by calling platform_get_irq_optional() instead for all but the
> first interrupts, which are optional.
> 
> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This is a fix for v5.4-rc1.

Thank you for the patch!

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

And, I tested this patch on R-Car H3. So,

Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda


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

* Re: [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts
  2019-10-01 18:07 [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts Geert Uytterhoeven
  2019-10-02  4:49 ` Yoshihiro Shimoda
@ 2019-10-02  9:52 ` kbuild test robot
  2019-10-02 11:28   ` Geert Uytterhoeven
  2019-10-03 16:10 ` Stephen Boyd
  2 siblings, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2019-10-02  9:52 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: kbuild-all, Greg Kroah-Hartman, Jiri Slaby, Stephen Boyd,
	linux-renesas-soc, linux-serial, linux-kernel,
	Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 5614 bytes --]

Hi Geert,

I love your patch! Yet something to improve:

[auto build test ERROR on tty/tty-testing]
[cannot apply to v5.4-rc1 next-20191001]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/serial-sh-sci-Use-platform_get_irq_optional-for-optional-interrupts/20191002-171547
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=sparc64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/tty/serial/sh-sci.c: In function 'sci_init_single':
>> drivers/tty/serial/sh-sci.c:2899:24: error: implicit declaration of function 'platform_get_irq_optional'; did you mean 'platform_get_irq_byname'? [-Werror=implicit-function-declaration]
       sci_port->irqs[i] = platform_get_irq_optional(dev, i);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~
                           platform_get_irq_byname
   cc1: some warnings being treated as errors

vim +2899 drivers/tty/serial/sh-sci.c

  2874	
  2875	static int sci_init_single(struct platform_device *dev,
  2876				   struct sci_port *sci_port, unsigned int index,
  2877				   const struct plat_sci_port *p, bool early)
  2878	{
  2879		struct uart_port *port = &sci_port->port;
  2880		const struct resource *res;
  2881		unsigned int i;
  2882		int ret;
  2883	
  2884		sci_port->cfg	= p;
  2885	
  2886		port->ops	= &sci_uart_ops;
  2887		port->iotype	= UPIO_MEM;
  2888		port->line	= index;
  2889	
  2890		res = platform_get_resource(dev, IORESOURCE_MEM, 0);
  2891		if (res == NULL)
  2892			return -ENOMEM;
  2893	
  2894		port->mapbase = res->start;
  2895		sci_port->reg_size = resource_size(res);
  2896	
  2897		for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) {
  2898			if (i)
> 2899				sci_port->irqs[i] = platform_get_irq_optional(dev, i);
  2900			else
  2901				sci_port->irqs[i] = platform_get_irq(dev, i);
  2902		}
  2903	
  2904		/* The SCI generates several interrupts. They can be muxed together or
  2905		 * connected to different interrupt lines. In the muxed case only one
  2906		 * interrupt resource is specified as there is only one interrupt ID.
  2907		 * In the non-muxed case, up to 6 interrupt signals might be generated
  2908		 * from the SCI, however those signals might have their own individual
  2909		 * interrupt ID numbers, or muxed together with another interrupt.
  2910		 */
  2911		if (sci_port->irqs[0] < 0)
  2912			return -ENXIO;
  2913	
  2914		if (sci_port->irqs[1] < 0)
  2915			for (i = 1; i < ARRAY_SIZE(sci_port->irqs); i++)
  2916				sci_port->irqs[i] = sci_port->irqs[0];
  2917	
  2918		sci_port->params = sci_probe_regmap(p);
  2919		if (unlikely(sci_port->params == NULL))
  2920			return -EINVAL;
  2921	
  2922		switch (p->type) {
  2923		case PORT_SCIFB:
  2924			sci_port->rx_trigger = 48;
  2925			break;
  2926		case PORT_HSCIF:
  2927			sci_port->rx_trigger = 64;
  2928			break;
  2929		case PORT_SCIFA:
  2930			sci_port->rx_trigger = 32;
  2931			break;
  2932		case PORT_SCIF:
  2933			if (p->regtype == SCIx_SH7705_SCIF_REGTYPE)
  2934				/* RX triggering not implemented for this IP */
  2935				sci_port->rx_trigger = 1;
  2936			else
  2937				sci_port->rx_trigger = 8;
  2938			break;
  2939		default:
  2940			sci_port->rx_trigger = 1;
  2941			break;
  2942		}
  2943	
  2944		sci_port->rx_fifo_timeout = 0;
  2945		sci_port->hscif_tot = 0;
  2946	
  2947		/* SCIFA on sh7723 and sh7724 need a custom sampling rate that doesn't
  2948		 * match the SoC datasheet, this should be investigated. Let platform
  2949		 * data override the sampling rate for now.
  2950		 */
  2951		sci_port->sampling_rate_mask = p->sampling_rate
  2952					     ? SCI_SR(p->sampling_rate)
  2953					     : sci_port->params->sampling_rate_mask;
  2954	
  2955		if (!early) {
  2956			ret = sci_init_clocks(sci_port, &dev->dev);
  2957			if (ret < 0)
  2958				return ret;
  2959	
  2960			port->dev = &dev->dev;
  2961	
  2962			pm_runtime_enable(&dev->dev);
  2963		}
  2964	
  2965		port->type		= p->type;
  2966		port->flags		= UPF_FIXED_PORT | UPF_BOOT_AUTOCONF | p->flags;
  2967		port->fifosize		= sci_port->params->fifosize;
  2968	
  2969		if (port->type == PORT_SCI) {
  2970			if (sci_port->reg_size >= 0x20)
  2971				port->regshift = 2;
  2972			else
  2973				port->regshift = 1;
  2974		}
  2975	
  2976		/*
  2977		 * The UART port needs an IRQ value, so we peg this to the RX IRQ
  2978		 * for the multi-IRQ ports, which is where we are primarily
  2979		 * concerned with the shutdown path synchronization.
  2980		 *
  2981		 * For the muxed case there's nothing more to do.
  2982		 */
  2983		port->irq		= sci_port->irqs[SCIx_RXI_IRQ];
  2984		port->irqflags		= 0;
  2985	
  2986		port->serial_in		= sci_serial_in;
  2987		port->serial_out	= sci_serial_out;
  2988	
  2989		return 0;
  2990	}
  2991	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 58676 bytes --]

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

* Re: [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts
  2019-10-02  9:52 ` kbuild test robot
@ 2019-10-02 11:28   ` Geert Uytterhoeven
  2019-10-02 14:20     ` [kbuild-all] " Chen, Rong A
  0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-10-02 11:28 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Geert Uytterhoeven, kbuild-all, Greg Kroah-Hartman, Jiri Slaby,
	Stephen Boyd, Linux-Renesas, open list:SERIAL DRIVERS,
	Linux Kernel Mailing List

Hi Kbuild test robot,

On Wed, Oct 2, 2019 at 11:53 AM kbuild test robot <lkp@intel.com> wrote:
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on tty/tty-testing]
> [cannot apply to v5.4-rc1 next-20191001]

Strange, this patch applies to all of v5.4-rc1, tty/tty-testing, and
next-20191001?

> url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/serial-sh-sci-Use-platform_get_irq_optional-for-optional-interrupts/20191002-171547

Oh, this is still the old tty/tty-testing before it was rebased to v5.4-rc1,
i.e. still based on v5.3-rc4.  That explains the build failure.

That does not explain why you couldn't apply this patch to v5.4-rc1 and
next-20191001, though.

> base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
> config: sparc64-allmodconfig (attached as .config)
> compiler: sparc64-linux-gcc (GCC) 7.4.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         GCC_VERSION=7.4.0 make.cross ARCH=sparc64
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>    drivers/tty/serial/sh-sci.c: In function 'sci_init_single':
> >> drivers/tty/serial/sh-sci.c:2899:24: error: implicit declaration of function 'platform_get_irq_optional'; did you mean 'platform_get_irq_byname'? [-Werror=implicit-function-declaration]
>        sci_port->irqs[i] = platform_get_irq_optional(dev, i);
>                            ^~~~~~~~~~~~~~~~~~~~~~~~~
>                            platform_get_irq_byname
>    cc1: some warnings being treated as errors

FTR, not reproducible on sparc on v5.4-rc1, current tty/tty-testing, and
next-20191001.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [kbuild-all] Re: [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts
  2019-10-02 11:28   ` Geert Uytterhoeven
@ 2019-10-02 14:20     ` Chen, Rong A
  0 siblings, 0 replies; 6+ messages in thread
From: Chen, Rong A @ 2019-10-02 14:20 UTC (permalink / raw)
  To: Geert Uytterhoeven, kbuild test robot
  Cc: Geert Uytterhoeven, kbuild-all, Greg Kroah-Hartman, Jiri Slaby,
	Stephen Boyd, Linux-Renesas, open list:SERIAL DRIVERS,
	Linux Kernel Mailing List

Hi Geert,

Thanks for your clarification. we are on vacation this week, and we'll 
take a look asap.

Best Regards,
Rong Chen

On 10/2/2019 7:28 PM, Geert Uytterhoeven wrote:
> Hi Kbuild test robot,
>
> On Wed, Oct 2, 2019 at 11:53 AM kbuild test robot <lkp@intel.com> wrote:
>> I love your patch! Yet something to improve:
>>
>> [auto build test ERROR on tty/tty-testing]
>> [cannot apply to v5.4-rc1 next-20191001]
> Strange, this patch applies to all of v5.4-rc1, tty/tty-testing, and
> next-20191001?
>
>> url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/serial-sh-sci-Use-platform_get_irq_optional-for-optional-interrupts/20191002-171547
> Oh, this is still the old tty/tty-testing before it was rebased to v5.4-rc1,
> i.e. still based on v5.3-rc4.  That explains the build failure.
>
> That does not explain why you couldn't apply this patch to v5.4-rc1 and
> next-20191001, though.
>
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
>> config: sparc64-allmodconfig (attached as .config)
>> compiler: sparc64-linux-gcc (GCC) 7.4.0
>> reproduce:
>>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>          chmod +x ~/bin/make.cross
>>          # save the attached .config to linux build tree
>>          GCC_VERSION=7.4.0 make.cross ARCH=sparc64
>>
>> If you fix the issue, kindly add following tag
>> Reported-by: kbuild test robot <lkp@intel.com>
>>
>> All errors (new ones prefixed by >>):
>>
>>     drivers/tty/serial/sh-sci.c: In function 'sci_init_single':
>>>> drivers/tty/serial/sh-sci.c:2899:24: error: implicit declaration of function 'platform_get_irq_optional'; did you mean 'platform_get_irq_byname'? [-Werror=implicit-function-declaration]
>>         sci_port->irqs[i] = platform_get_irq_optional(dev, i);
>>                             ^~~~~~~~~~~~~~~~~~~~~~~~~
>>                             platform_get_irq_byname
>>     cc1: some warnings being treated as errors
> FTR, not reproducible on sparc on v5.4-rc1, current tty/tty-testing, and
> next-20191001.
>
> Gr{oetje,eeting}s,
>
>                          Geert
>


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

* Re: [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts
  2019-10-01 18:07 [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts Geert Uytterhoeven
  2019-10-02  4:49 ` Yoshihiro Shimoda
  2019-10-02  9:52 ` kbuild test robot
@ 2019-10-03 16:10 ` Stephen Boyd
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2019-10-03 16:10 UTC (permalink / raw)
  To: Geert Uytterhoeven, Greg Kroah-Hartman, Jiri Slaby
  Cc: linux-renesas-soc, linux-serial, linux-kernel, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2019-10-01 11:07:43)
> As platform_get_irq() now prints an error when the interrupt does not
> exist, scary warnings may be printed for optional interrupts:
> 
>     sh-sci e6550000.serial: IRQ index 1 not found
>     sh-sci e6550000.serial: IRQ index 2 not found
>     sh-sci e6550000.serial: IRQ index 3 not found
>     sh-sci e6550000.serial: IRQ index 4 not found
>     sh-sci e6550000.serial: IRQ index 5 not found
> 
> Fix this by calling platform_get_irq_optional() instead for all but the
> first interrupts, which are optional.
> 
> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>


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

end of thread, other threads:[~2019-10-03 16:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 18:07 [PATCH] serial: sh-sci: Use platform_get_irq_optional() for optional interrupts Geert Uytterhoeven
2019-10-02  4:49 ` Yoshihiro Shimoda
2019-10-02  9:52 ` kbuild test robot
2019-10-02 11:28   ` Geert Uytterhoeven
2019-10-02 14:20     ` [kbuild-all] " Chen, Rong A
2019-10-03 16:10 ` Stephen Boyd

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