Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp915694pxb; Thu, 28 Jan 2021 03:39:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzoShtOhRAwaAQSSEcnR47/TGY9qf81NzLg86CEzQotQBCzy1bSiLmTkUHF+IEKd17oHXv X-Received: by 2002:a17:906:8410:: with SMTP id n16mr10893824ejx.551.1611833960005; Thu, 28 Jan 2021 03:39:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611833959; cv=none; d=google.com; s=arc-20160816; b=CbKeuGT7BmpELEPiiAoN7xF5XjdHKfg1oo1XzOhq6bXfaH8j5hDWagB51RMACm8w1B 87FsKYpO0+eoAtofhFhUZJALNdrMGs1sDC3YKHx+0CyKmbSh3KvIpRumNkisudHrKudN OxKBBVKyzG+4nIet20cZVloFPmAf+SLd3+7w0mGXy1fC6QWjzIM8NsCeTixHKKV7lOKB ezeGX1/ZT/ecahBd8+1ZqIecB4A5gyMmFG+aZ5WZGLUy/qQZF61OwZXjc9IOEWkMwsJs r7K4GMGTewd4RsjIuwI/z2ibqexyNft4fKK35GrtHIppZfWpe1GFCexi1OvPw/ybvKrG lfsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=a1pl4yZDX8FPvw3cpwyHg1r7e84wJZBNZdKVzm8x6K4=; b=SC8HzFW/E7MnMn3b7mdpN42Iul/vR2sicaaoN5oPXIKbuLDwUM42oZE/I1OxJsDIlR 8uZHBO1wayark0KwC5tC82Jg5Q9hQt4+pEZVEs9v/VxJ3Eq0i933hh036XahTvEwXZo7 ZkRh/8/IFVBl9BfTulut+2DTwg5qO37oooyQ/GKLZ9I3+ohWO4KYfOIHiL8oVB2tzRqQ bUph2GIsG4Q+u29xFUKf/38CfgZt3oJbV3YfSbDbM6QBTqI9PDWA1h65rEILBc3A9fyN 0/cnDQeH1ntRjGlqPLGUkG8pHX352kMifzXt2UBgbjiUZ2OITUil/4djqzRf1ho4fhtU BdHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TUC2K8gP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si2817563edn.168.2021.01.28.03.38.52; Thu, 28 Jan 2021 03:39:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TUC2K8gP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231245AbhA1Lh2 (ORCPT + 99 others); Thu, 28 Jan 2021 06:37:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:44168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbhA1Lh1 (ORCPT ); Thu, 28 Jan 2021 06:37:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B53D964DDA; Thu, 28 Jan 2021 11:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611833806; bh=a1pl4yZDX8FPvw3cpwyHg1r7e84wJZBNZdKVzm8x6K4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TUC2K8gPUvmnzKZQzzuf+PemNlviY14vMimTRMCzM4brTI0nQP4x5OIE9V9p5ZxvU xZZscGYS89XTN/DIus3DgPKThBI9XoePeCP0qIvrD5uBj81hBq7RmjxtgTJNMw2Ryv PnUdUOLca2rxgHqu3hfq3iTkLjw6+WfJJVHRG1Ls8P7ZaQv1uOGJQp7OdtYVK3+Bak +al6UiQEUNoE6Q4mXGnVZ/SDO9Nok/gFL/q0RFKAc5N8dYiuL9kcyBSx7lurwNk1a3 JOINsJRXSKTq4OIu0d7NY0w600qY0OtFV5diGt4tc82qeGvumhmgb9dkq59naSCJGa 7AfUi6VWUindQ== Date: Thu, 28 Jan 2021 11:36:01 +0000 From: Mark Brown To: Andre Przywara Cc: Dmitry Torokhov , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Icenowy Zheng , Rob Herring , =?iso-8859-1?Q?Cl=E9ment_P=E9ron?= , Shuosheng Huang , Yangtao Li , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Lee Jones , linux-input@vger.kernel.org Subject: Re: [PATCH v5 05/20] Input: axp20x-pek: Bail out if AXP has no interrupt line connected Message-ID: <20210128113601.GA4537@sirena.org.uk> References: <20210127172500.13356-1-andre.przywara@arm.com> <20210127172500.13356-6-andre.przywara@arm.com> <20210128104627.76b35a5c@slackpad.fritz.box> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cNdxnHkX5QqsyA0e" Content-Disposition: inline In-Reply-To: <20210128104627.76b35a5c@slackpad.fritz.box> X-Cookie: Do not pick the flowers. User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --cNdxnHkX5QqsyA0e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 28, 2021 at 11:11:28AM +0000, Andre Przywara wrote: > Dmitry Torokhov wrote: > > On Wed, Jan 27, 2021 at 05:24:45PM +0000, Andre Przywara wrote: > > > Check for the regmap_irqc member to be not NULL before proceeding with > > > probe. This gets normally filled by the call to regmap_add_irq_chip(), > > > which we allow to skip now, when the DT node lacks an interrupt > > > property. =20 It sounds like you're trying to register an IRQ chip with a somehow bogus configuration? > > No, the driver is not the right place to patch this; regmap should be > > fixed so it does not crash instead. > I am not sure this is the right approach, those regmap functions look > more like an internal interface to me, with lots of wrapper functions > happily dereferencing pointers and reaching into structs. Moving > NULL checks into those does not sound like the right thing. CC:ing Mark > for more opinions on this. Without having seen the actual issue if you're trying to register an interrupt controller with a known broken hardware configuration that does seem like something the caller just shouldn't be doing, it's not something that's going to transiently happen at runtime and we're very much trusting that the caller got things right. > A more general solution would be to not instantiate this driver here > at all, when we don't have an interrupt line. > However at the moment the AXP MFD driver uses a const struct to hold > all MFD cells, so there is no easy way of omitting the power key > device dynamically. And even then it would hard code the requirement > for an interrupt into the MFD driver, when this could be considered an > implementation detail of the axp20x-pek driver. Another approach is to just register the optional device separately. --cNdxnHkX5QqsyA0e Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmASoaEACgkQJNaLcl1U h9AQ/gf+MpX0pegJATN0VStaUHumZY023d5JzzKt3eqw1qf+/tSf8NdJGJTV9CZa +91FikW/5M23AyOw2SxaT3waW9sm7ruTRIv0koHv3/G+XKzxrO9EUvulpDElhyHz qTXmW1e8JXWhyGji473Ki4e/1CaBRbTpSj440I6gc0ZiY4DVNE2/uJPeDPOJ4ijG gCk6s8H915DkQZnmHHzwbrXhz7uFXu3rXtq5PQ3ActDMJK1qQuPJW/KVq1mnpSLo G3U1+ydOhvHZ2jd68kfP12TKXDKEP8h+oGF+YBMVJYUWvNh1swtlFNwNsP6qrnq/ aStCaC8z4Kf+6B3v0jksH+nUjXFFUw== =ODfU -----END PGP SIGNATURE----- --cNdxnHkX5QqsyA0e--