Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3943637iog; Tue, 21 Jun 2022 08:53:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t6gPzMqZ5KTwXDYkGdbL7++ogA9pGlVxLsMbvnE4qECOAkqxBpsBNLz0t+G2sCybFoYbhE X-Received: by 2002:a17:906:2086:b0:715:7983:a277 with SMTP id 6-20020a170906208600b007157983a277mr28394487ejq.386.1655826829913; Tue, 21 Jun 2022 08:53:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655826829; cv=none; d=google.com; s=arc-20160816; b=GbMJ4xS7uQOArA/PZu/SaP5zrESkRh1cedWMqZ9E5y4JRo0qNR08CcEeFvkPykXuwG L2KrV0E8DWaYoveOWf6ojviWt5pBtgJSuDxE+8W4NOiai4f3s4GPss9TLGyETIRwjpTb cfc5wL71xm62Sk5oWfhxZ9M90yt8i4RGJ7Cd0nMHfH5ee0zvPk6OBNH9DDNYz3QAZzHH befZDwf9uzJICQV1C3DGtWuAjXYHSb2WFOBYspXHUlZm8hjffD7ujJUW+yOjToKuEwvg WqJW5w5Sw3SuipAa6MTlYRbJ16R/+rNB5EaKuGdtCJtOQC4hBsAoAXH1BlGArtLeyyZC rT0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=Mq1i+1lTFYj4joU1C8uxIKUrJqP/C1jEFflEbOwme20=; b=oFzbVV5JROQgiQwu8ATrsag3/bX511zCfwiPT8lXjnJDtAmTEDRckbhlmvsY6v7wTK pdkaz9iLkX52i4q9ErOOvEWTw0Rx8kJP2lnXTnXAEIWaj9A55ZkWa0ELWMsHtGBDUYUS GPV2P0prfnwmMtPIyNGI+JxmtL2aeCiZEZJjL028az4alCSrplFndTM4cXYBlv4zKSmj bbj392I519L6/zb0Um0HkIj02nHFOMitknoh552ri0H247fxJCYDdhgTHGzPFvvGC0DB 1eGunAgdPav1UI7BiTFXK8oTxPoiS/UluxrbUZUsumcQ7YgJ20BLhAwD/hjFz1hCPPxA bQVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pvsA9YUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v30-20020a17090651de00b006f3b16423ebsi489370ejk.620.2022.06.21.08.53.21; Tue, 21 Jun 2022 08:53:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pvsA9YUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353121AbiFUPmK (ORCPT + 99 others); Tue, 21 Jun 2022 11:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353256AbiFUPl5 (ORCPT ); Tue, 21 Jun 2022 11:41:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 701182CDD0; Tue, 21 Jun 2022 08:41:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F1532617E3; Tue, 21 Jun 2022 15:41:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18D0DC341D0; Tue, 21 Jun 2022 15:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655826115; bh=VZ1aOhko6KQdmGVGgjGkXcxKKwEIKN4Fo0Q8ZpAvlkk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pvsA9YUJI0dpz1d+/HAGdq8ElXW6GJGaWcu0x3xMKvHk7AL82RjfVVXMEhEJso7/L nFiZA/3HeHxeN+9U1CnYW48JCShdZ+QcVlBjx22F/YAYThiJG+XD0bn6S0vgGTpycq 1Am6eZiWDRrwtzA/w5ddCzI/W1B2S5beindDKfqeU06Rlj3M0ALzPZnpeHMjQZ0ReZ /VGJQSey2EDEFq9j/12H9XdeuIzg6wcpB9lY8k2ZSFtv6qpoiek52UkiQ/mLs6cKgs g8G+a4kzfKmqqDCcrtSBp9Kq3KtWmDe7NapUm/ZeMO/53YR7dsSVZAX/jOEYRC7Iqk DqxhY2CzZTYew== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o3g0m-0025Go-Hj; Tue, 21 Jun 2022 16:41:52 +0100 Date: Tue, 21 Jun 2022 16:41:52 +0100 Message-ID: <87o7ym2fcv.wl-maz@kernel.org> From: Marc Zyngier To: Andy Shevchenko Cc: Bjorn Helgaas , Fabio Estevam , Marek Vasut , Ksenija Stanojevic , Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring Subject: Re: mxs_lradc_ts: Warning due to "0 is an invalid IRQ number" In-Reply-To: References: <20200701224145.GA3616172@bjorn-Precision-5520> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: andriy.shevchenko@intel.com, helgaas@kernel.org, festevam@gmail.com, marex@denx.de, ksenija.stanojevic@gmail.com, dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 Jun 2022 15:00:35 +0100, Andy Shevchenko wrote: > > +Cc: Marc in case I'm utterly wrong in my conclusion below. > > On Wed, Jul 01, 2020 at 05:41:45PM -0500, Bjorn Helgaas wrote: Two year old thread, not bad! ;-) > > On Wed, Jul 01, 2020 at 12:32:48PM -0300, Fabio Estevam wrote: > > > On Tue, Jun 16, 2020 at 8:52 PM Fabio Estevam wrote: > > > > I am seeing the following warning on a imx28-evk running linux-next: > > > > > > > > [ 7.625012] ------------[ cut here ]------------ > > > > [ 7.630111] WARNING: CPU: 0 PID: 1 at drivers/base/platform.c:317 > > > > __platform_get_irq_byname+0x74/0x90 > > > > [ 7.639692] 0 is an invalid IRQ number > > > > [ 7.643540] Modules linked in: > > > > [ 7.646961] CPU: 0 PID: 1 Comm: swapper Not tainted > > > > 5.8.0-rc1-next-20200616-dirty #92 > > > > [ 7.654896] Hardware name: Freescale MXS (Device Tree) > > > > [ 7.660434] [] (unwind_backtrace) from [] > > > > (show_stack+0x10/0x14) > > > > [ 7.668591] [] (show_stack) from [] (__warn+0xe4/0x108) > > > > [ 7.675941] [] (__warn) from [] > > > > (warn_slowpath_fmt+0x6c/0xb8) > > > > [ 7.683575] [] (warn_slowpath_fmt) from [] > > > > (__platform_get_irq_byname+0x74/0x90) > > > > [ 7.693101] [] (__platform_get_irq_byname) from > > > > [] (platform_get_irq_byname+0x10/0x48) > > > > [ 7.703154] [] (platform_get_irq_byname) from > > > > [] (mxs_lradc_ts_probe+0x190/0x384) > > > > [ 7.712771] [] (mxs_lradc_ts_probe) from [] > > > > (platform_drv_probe+0x48/0x98) > > > > [ 7.722806] [] (platform_drv_probe) from [] > > > > (really_probe+0x218/0x348) > > > > [ 7.731530] [] (really_probe) from [] > > > > (driver_probe_device+0x58/0xb4) > > > > [ 7.740189] [] (driver_probe_device) from [] > > > > (device_driver_attach+0x58/0x60) > > > > [ 7.749471] [] (device_driver_attach) from [] > > > > (__driver_attach+0x84/0xc0) > > > > [ 7.758394] [] (__driver_attach) from [] > > > > (bus_for_each_dev+0x70/0xb4) > > > > [ 7.766977] [] (bus_for_each_dev) from [] > > > > (bus_add_driver+0x154/0x1e0) > > > > [ 7.775385] [] (bus_add_driver) from [] > > > > (driver_register+0x74/0x108) > > > > [ 7.783872] [] (driver_register) from [] > > > > (do_one_initcall+0x68/0x268) > > > > [ 7.792467] [] (do_one_initcall) from [] > > > > (kernel_init_freeable+0x160/0x1f4) > > > > [ 7.801661] [] (kernel_init_freeable) from [] > > > > (kernel_init+0x8/0xf4) > > > > [ 7.810165] [] (kernel_init) from [] > > > > (ret_from_fork+0x14/0x24) > > > > [ 7.818101] Exception stack(0xc748dfb0 to 0xc748dff8) > > > > [ 7.823273] dfa0: 00000000 > > > > 00000000 00000000 00000000 > > > > [ 7.831815] dfc0: 00000000 00000000 00000000 00000000 00000000 > > > > 00000000 00000000 00000000 > > > > [ 7.840351] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 > > > > [ 7.847322] irq event stamp: 273303 > > > > [ 7.850940] hardirqs last enabled at (273311): [] > > > > console_unlock+0x390/0x534 > > > > [ 7.859314] hardirqs last disabled at (273328): [] > > > > console_unlock+0x44/0x534 > > > > [ 7.867605] softirqs last enabled at (273344): [] > > > > __do_softirq+0x2d4/0x450 > > > > [ 7.875817] softirqs last disabled at (273355): [] > > > > irq_exit+0x150/0x174 > > > > [ 7.883472] ---[ end trace ddb222ada5cbf5cd ]--- > > > > [ 7.900004] input: mxs-lradc-ts as > > > > /devices/soc0/80000000.apb/80040000.apbx/80050000.lradc/mxs-lradc-ts/input/input0 > > > > > > > > The touchscreen irq is defined as: > > > > > > > > enum mx28_lradc_irqs { > > > > MX28_LRADC_TS_IRQ = 0, > > > > > > > > Shouldn't we retrieve the IRQ number from the device tree instead? > > > > mxs_lradc_ts_probe() > > { > > ... > > irq = platform_get_irq_byname(pdev, mxs_lradc_ts_irq_names[i]); > > if (irq < 0) > > return irq; > > > > virq = irq_of_parse_and_map(node, irq); > > ... > > } > > > > That's not right, is it? irq_of_parse_and_map() takes an *index*, but > > we're passing an IRQ. > > > > mxs_lradc_adc_probe() also has the same pattern. > > Yeah, you are right. This code is broken by design. But the issue is that MFD > driver supplies _index_ and not vIRQ from proper IRQ domain. I dunno how it's > supposed to work without dirty tricks in the GIC (or whatever interrupt > controller is there). Not even close. This is totally broken, irrespective of the interrupt controller. platform_get_irq_byname() does the mapping already, mapping things *twice* is unlikely to lead to something useful. The core of the issue is that there seem to be a bunch of MFD using hardcoded resources (board-file style), and they randomly feed this into the DT code. > Since there is no response to this thread by the authors of the code, I would > mark it as BROKEN and perhaps remove from the kernel if no-one steps in to fix > this mess. Something like the hack below could potentially make things less broken, but I'm not holding my breath. If nobody cares, let's remove the code altogether. M. diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c index 9e36fee38d61..93f21f00388f 100644 --- a/drivers/input/touchscreen/mxs-lradc-ts.c +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -606,7 +606,7 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev) struct device_node *node = dev->parent->of_node; struct mxs_lradc *lradc = dev_get_drvdata(dev->parent); struct mxs_lradc_ts *ts; - int ret, irq, virq, i; + int ret, virq, i; u32 ts_wires = 0, adapt; ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); @@ -671,11 +671,16 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev) mxs_lradc_ts_hw_init(ts); for (i = 0; i < 3; i++) { - irq = platform_get_irq_byname(pdev, mxs_lradc_ts_irq_names[i]); - if (irq < 0) - return irq; + struct resource *r; - virq = irq_of_parse_and_map(node, irq); + r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, + mxs_lradc_ts_irq_names[i]); + if (!r) + return -ENXIO; + + virq = irq_of_parse_and_map(node, r->start); + if (!virq) + return -ENXIO; mxs_lradc_ts_stop(ts); -- Without deviation from the norm, progress is not possible.