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=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 44BC5C433DF for ; Wed, 1 Jul 2020 16:18:18 +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 167F5207BB for ; Wed, 1 Jul 2020 16:18:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y5eoE5WM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mZQaUluV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 167F5207BB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net 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:References: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:List-Owner; bh=vslEO8JuAQkXYq3anyMGR0JbMK9MlF0w4E1vOUun4gw=; b=Y5eoE5WMY5uBGDGzA/D46VY5n lqlWJQpxSgYDy5U6AcarcQvjGLyuoW6qyS9tZs03HjEwBX5lHpVo6UjfbYZVQ9YbwFDeANSt/ro4u FbUKBkM3iIJzULBNncamf6JmvsUThN2fviL0cC0XF31E8H4DOtvfGX2JD/V60zgxkN6rhLqJgdA+E 4u9Q8I95qRwe3j5Kz3X5Im0jweNEyZviMgIwkwmNXj9Am2aWmCgAUxza7qavVMB42SQ8NtjKC1VGe Fma6XOIVJ8VeGdOucgbT9stfQd2mE8zKd5gC6V8eYNDB0hvJE3mCGqtMxmwBYR5wVB/Y8aIAlSzVd sGOpTry/w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqfPw-0004ZO-22; Wed, 01 Jul 2020 16:17:00 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqfPt-0004Yf-Bo for linux-arm-kernel@lists.infradead.org; Wed, 01 Jul 2020 16:16:58 +0000 Received: by mail-pg1-x544.google.com with SMTP id z5so11946977pgb.6 for ; Wed, 01 Jul 2020 09:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=o1Sgg7IbU0gFvYtpKCHy7d7xGloLfRV101IO9faOPqc=; b=mZQaUluVZJrQmCmxAheRzLIcByPqK9nRZcGyBB7kaBDAUfszeNFlAhNfZDOHCH/AJz c0q6LZnsasW2Uhfx92rULySeKConzrsCsG8ViqtxqWqTMSWxPsRL27myOnBxWfscWnZz My4ntOdcAy9cyFbhXVWanxTTu3Bqm3lXNjXg537acWlPdbqgtlALGSVYpzHhSBUpQkfv 8SUWe1KwKkGvx9ylSCso0N4McxkKP/B2mPlMcjurvQuwCowLE8jWdcciWmORjM0E8W68 EX2yHQOvqxZKqkLEF4ccknJKE9OkiMeejTrEMmJ9CJinGCIP3GdrwLWA9bF2QS+YLvLh rk7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=o1Sgg7IbU0gFvYtpKCHy7d7xGloLfRV101IO9faOPqc=; b=rbXoI5/NeuFdZhoQuhPAAKbAw7V26+H8naO/XmVXnnwFpLFA2KqC+dRB6c2IzkNITl jbSit0jzqiN8t+UWB0VT4gXsdY0JwzWulEq3Uv1tRkMimRSlssgdPxAIL6BFKqjp1fBW Qr4dIcGNf4Eg12S7NUaGnRvthw21Ta898zngZhKFpyL9aTNsLVNOUgctd6RqOafz7hf/ ftXjs/Rkyfc+WgbU8buXQnfow2HyET7vbn4yI5d7Sg6xwUykuQXyKbR/smyqB99oU6Au JckeJ8qOt0cxXY7kiiTmbakdZ5HgXLBrbY3JoQn8HR3XakcixwUYM4AHFFbnXWXCHAvE GHAg== X-Gm-Message-State: AOAM530TDEuTkimuvuxipFazUVY8wZotgMIgKOQzY2gsh8jW2xPjvWFA irfwCCVmUeJgsel5sWBXM0o= X-Google-Smtp-Source: ABdhPJxqXrd7+6NKgupFNcaoMAekFm1PPcNCYnQgtjiGWEoV7BMnozWDtcYBFRYbo7rY/9gBsqivSw== X-Received: by 2002:aa7:8ac3:: with SMTP id b3mr26201793pfd.45.1593620215406; Wed, 01 Jul 2020 09:16:55 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id n1sm5759327pjn.24.2020.07.01.09.16.53 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Jul 2020 09:16:54 -0700 (PDT) Date: Wed, 1 Jul 2020 09:16:53 -0700 From: Guenter Roeck To: Bjorn Helgaas Subject: Re: [PATCH] imx: Provide correct number of resources when registering gpio devices Message-ID: <20200701161653.GA72983@roeck-us.net> References: <20200701032651.12420-1-linux@roeck-us.net> <20200701152442.GA3609842@bjorn-Precision-5520> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200701152442.GA3609842@bjorn-Precision-5520> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200701_121657_443467_A23DF4D5 X-CRM114-Status: GOOD ( 30.26 ) 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 Wed, Jul 01, 2020 at 10:24:42AM -0500, Bjorn Helgaas wrote: > 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. The traceback below is the only one I have seen in my test system. Qemu doesn't support any of the architectures calling imx_add_imx_dma. I have not looked at or searched for any others. Guenter > > > 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