From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18F3EC433E0 for ; Wed, 1 Jul 2020 15:26:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E144A20760 for ; Wed, 1 Jul 2020 15:26:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bIojv8ah"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="hRRtBxKW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E144A20760 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID:Subject:To:From: Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References:List-Owner; bh=MTAVaEqd1zfueb2hNUyAzgIA9YSqpv5qgkXmGXcqMk4=; b=bIojv8ahgPNmMZVcdXmAIHbo5 Hb/41Xkn39w0i5iVMTUTsNaHXMtuJLTs/BWYF7enZr6mjuxlzgXvQ1zV0voqQli598h2ZjGN+XWPq Dm7Ky/klOf1SnRTFtM/3/embGyOasSIVe2/QTwSXqOtV6G6wVMqR9vEFeQwoLgl+w9RMlyZpgX8fF 7PHakpEIV2/lK5FJbFlMwX/GMgYh/4UJbSeV0PEQ5dnP5S6g2XfnDzA7b4cOrSmNIYID9BoqQeSDa eMvLbPNwRKE147Nehe5NQdgaXIQy4A7H/r64wYpDtGcE/nfL7jNNlN0PnLWRgPh0eLmPJdxl6DXOS enXqBz9mg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqebP-0008Ts-DL; Wed, 01 Jul 2020 15:24:47 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqebM-0008TK-R6 for linux-arm-kernel@lists.infradead.org; Wed, 01 Jul 2020 15:24:45 +0000 Received: from localhost (mobile-166-175-191-139.mycingular.net [166.175.191.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CCE87207D0; Wed, 1 Jul 2020 15:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593617084; bh=TNhnAXLOrs6P3AxBeCi1PWlWoiyWdfBQ1xHhTM7Aifw=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=hRRtBxKW+0bAz9/Mry9OVMvDVCjEX1BGycmdYpyn2pJMFr2fBKwPpxcgHzrSAZS4A LjvquEZ94VCnxQlVXiFlcdO4BDoN60V4nJPwDyQgTuZAaaPtSnWMkt/MY7LFRboDRL kdn20Oa6858bavMCD0VaZDwZR7Kahc1lzQUP9Uis= Date: Wed, 1 Jul 2020 10:24:42 -0500 From: Bjorn Helgaas To: Guenter Roeck Subject: Re: [PATCH] imx: Provide correct number of resources when registering gpio devices Message-ID: <20200701152442.GA3609842@bjorn-Precision-5520> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200701032651.12420-1-linux@roeck-us.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200701_112445_021878_3FED78E0 X-CRM114-Status: GOOD ( 23.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shawn Guo , Sascha Hauer , Russell King , linux-kernel@vger.kernel.org, NXP Linux Team , Pengutronix Kernel Team , Bjorn Helgaas , Fabio Estevam , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 30, 2020 at 08:26:51PM -0700, Guenter Roeck wrote: > Since commit a85a6c86c25be ("driver core: platform: Clarify that IRQ 0 is > invalid"), the kernel is a bit touchy when it encounters interrupt 0. > As a result, there are lots of warnings such as the following when booting > systems such as 'kzm'. Thanks for the fix. If there are others like this, I'd be glad to help fix them since I made the kernel grumpier about this. Just point me at the info. I looked at other callers of platform_device_register_resndata(). It looks like imx_add_imx_dma() and vm_cmdline_set() have the same problem. I'll fix those unless you're already doing it. > WARNING: CPU: 0 PID: 1 at drivers/base/platform.c:224 platform_get_irq_optional+0x118/0x128 > 0 is an invalid IRQ number > Modules linked in: > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.8.0-rc3 #1 > Hardware name: Kyoto Microcomputer Co., Ltd. KZM-ARM11-01 > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (dump_stack+0xe8/0x120) > [] (dump_stack) from [] (__warn+0xe4/0x108) > [] (__warn) from [] (warn_slowpath_fmt+0x74/0xbc) > [] (warn_slowpath_fmt) from [] (platform_get_irq_optional+0x118/0x128) > [] (platform_get_irq_optional) from [] (platform_irq_count+0x20/0x3c) > [] (platform_irq_count) from [] (mxc_gpio_probe+0x8c/0x494) > [] (mxc_gpio_probe) from [] (platform_drv_probe+0x48/0x98) > [] (platform_drv_probe) from [] (really_probe+0x214/0x344) > [] (really_probe) from [] (driver_probe_device+0x58/0xb4) > [] (driver_probe_device) from [] (device_driver_attach+0x58/0x60) > [] (device_driver_attach) from [] (__driver_attach+0x84/0xc0) > [] (__driver_attach) from [] (bus_for_each_dev+0x78/0xb8) > [] (bus_for_each_dev) from [] (bus_add_driver+0x154/0x1e0) > [] (bus_add_driver) from [] (driver_register+0x74/0x108) > [] (driver_register) from [] (do_one_initcall+0x80/0x3b4) > [] (do_one_initcall) from [] (kernel_init_freeable+0x170/0x208) > [] (kernel_init_freeable) from [] (kernel_init+0x8/0x11c) > [] (kernel_init) from [] (ret_from_fork+0x14/0x20) > > As it turns out, mxc_register_gpio() is a bit lax when setting the > number of resources: it registers a resource with interrupt 0 when in > reality there is no such interrupt. Fix the problem by not declaring > the second interrupt resource if there is no second interrupt. > > Fixes: a85a6c86c25be ("driver core: platform: Clarify that IRQ 0 is invalid") > Cc: Bjorn Helgaas > Signed-off-by: Guenter Roeck > --- > arch/arm/mach-imx/devices/platform-gpio-mxc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/mach-imx/devices/platform-gpio-mxc.c b/arch/arm/mach-imx/devices/platform-gpio-mxc.c > index 78628ef12672..355de845224c 100644 > --- a/arch/arm/mach-imx/devices/platform-gpio-mxc.c > +++ b/arch/arm/mach-imx/devices/platform-gpio-mxc.c > @@ -24,7 +24,8 @@ struct platform_device *__init mxc_register_gpio(char *name, int id, > .flags = IORESOURCE_IRQ, > }, > }; > + unsigned int nres; > > - return platform_device_register_resndata(&mxc_aips_bus, > - name, id, res, ARRAY_SIZE(res), NULL, 0); > + nres = irq_high ? ARRAY_SIZE(res) : ARRAY_SIZE(res) - 1; > + return platform_device_register_resndata(&mxc_aips_bus, name, id, res, nres, NULL, 0); > } > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel