Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp127212lqp; Sat, 8 Jun 2024 08:48:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWd1hlHwrqLE2N4RWeqPbQibwg5dn0xyEEaTYZ2w+BsdpfptzYMb8lJ2bxXevxmcKvj7Nu2V50C3kpU+RuoZ5aEKq6ovOHIRj9miWyIZg== X-Google-Smtp-Source: AGHT+IE3wKgcnlil1BurhHTnfd2qzM2fBBghAzMNr8XL06KDRyTAVK+ETkv1ymyhfZPzk3IGF5mq X-Received: by 2002:a05:6512:1593:b0:52b:8344:5610 with SMTP id 2adb3069b0e04-52bb9f66d4dmr5265659e87.7.1717861734518; Sat, 08 Jun 2024 08:48:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717861734; cv=pass; d=google.com; s=arc-20160816; b=tntB2hJ4deBvqRhFcnQDoeanSDaOPOJ/XWaT6XzoREhEFD+L8EkN1Wubi4ACnj0PMC 5rCGLoFZEf3OrmRCNKtZk22F73g2wDSkZ5AbMAw+edrkirarCd6P77M1S4KkWgeyYHog J3tEHABLjkSDh1002hJYRN+0Fb3TYrdgViPncAI6FL11IQycWRKmcFMvTIuKxP8PqTeV KiLyEquUtqeoLM076QCYIiYo39D9iSmalfVFWWVuxAiW+jgMgfXMoRYXTtpyBP5KCy0p HkMesSeYKuwahquuF1PaMb7adpsElevr5K86OT37cobbzNEkM9jUi+GDmPa6RaHfJGfz c0lQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=y8abd1tA+tlFEa1K9Sn0faA57f3K5JGSGcnE9i4rT4k=; fh=bUs2aj4gSPzeTyGxZgMdhF7I8KoOYJbvQn2lurkurvc=; b=MtjPmQdmvQwNiaw2JkpHm2nAIYdPjybArYBQlUKmgLZWodCzqIfXZPJaVw/bUgS70B jMYMnou+xce5iEFIiylXpysTBlFj3ka/H1fdwqonvv5dCduHiAjVCtBA2EwbBzxQAA2n 2LojQrwLXklB8zhEIeISC9L84q0GYoVB4Lqy0qMEAzcLCC2awrfcl4KvATdNigshss4+ ln3ydwAhx/MiFMiKs24u/M1Xiv9HZJF/em7C05CVFTQebx+MvLt7OxIB3G0UGjkunCrW pEUiDQsYkooHpG7quGMLzPqjQ5EeYyydgYhxkNiONvJngTTjDPcP+37nCet816q8HGDH XGEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SCxojzbv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207101-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6efc1c107csi94268266b.948.2024.06.08.08.48.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 08:48:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SCxojzbv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207101-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0C2F61F2217D for ; Sat, 8 Jun 2024 15:48:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9855217B40C; Sat, 8 Jun 2024 15:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SCxojzbv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B04791E888; Sat, 8 Jun 2024 15:48:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717861722; cv=none; b=Xp3acWZV8HP1vFxtjRYLkNawOpcnOZxu4NFxSaM5F7UzkeTqGf5Ehaci6EcG6DgxeEiL8YAwfjySSGAI6Y2nVrTis/NZ9GXbEbRa5rD0aEgL5BMAossolwwm2aoPNrsjoHg7qOOUOeFtq4uYZ4e94o0jW6pftgjZc84JVfHmEeo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717861722; c=relaxed/simple; bh=F6G10TvIr1xk/bTQReGFkBEnFiIvv8ayWvgKRiPGwd4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PB+fQbPl4cbjjQgMs1WcyWi1q5SF7rUKGz+bvgxNHVBgQAflG/hsbTNBrmzqb7RM7dnuaQttngt+URSRAib4b1EqCpg/deXJjWEmVMFp2bc6GXv20hqwzR23l7bb6xAp/ceYSWqcPo0x0dzxIkOPYdo4sXuSeJv7TYn7WEct0NE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SCxojzbv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 250B5C2BD11; Sat, 8 Jun 2024 15:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717861721; bh=F6G10TvIr1xk/bTQReGFkBEnFiIvv8ayWvgKRiPGwd4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SCxojzbvL9nMzgK7dtOPD2e5Em0HDmEJU/hSWbVBrXqQnG0EPP9qQcE485nXFbuzo H8tCfZQOecPU+RWidiZmWXQBAVLNrJqedn/30YrViuqG0UCJfv+vh1k4Z4dcGFgR8G KpZBw4qSzvlb1IKTupLAHS52aBOVy9S+JQoQyAWGrO82bpO/kamPR668sHoeGrS9YX oPhLhs5tDioJr42P3SZv5tzgvJA39ATd6E4KDJSsKoIoJLSqRdi/v9wsEypxtGrrTk KE2BBWj6DqA6x4nI2RefVV56L90jQ+1x6i0pBEMulgjyQqWwxHmNO69HEGBaNZLwoF pmWNxxGc3yreg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sFyJ5-000000003GJ-1CTP; Sat, 08 Jun 2024 17:48:40 +0200 Date: Sat, 8 Jun 2024 17:48:39 +0200 From: Johan Hovold To: Lee Jones Cc: Johan Hovold , Mark Brown , Linus Walleij , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya Kakitapalli , Stephen Boyd , Bryan O'Donoghue , Andy Shevchenko , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [PATCH v2 02/14] mfd: pm8008: fix regmap irq chip initialisation Message-ID: References: <20240529162958.18081-1-johan+linaro@kernel.org> <20240529162958.18081-3-johan+linaro@kernel.org> <20240531170353.GB1204315@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240531170353.GB1204315@google.com> On Fri, May 31, 2024 at 06:03:53PM +0100, Lee Jones wrote: > On Wed, 29 May 2024, Johan Hovold wrote: > > > The regmap irq array is potentially shared between multiple PMICs and > > should only contain static data. > > > > Use a custom macro to initialise also the type fields and drop the > > unnecessary updates on each probe. > > > > Fixes: 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC") > > Signed-off-by: Johan Hovold > > -static struct regmap_irq pm8008_irqs[] = { > > - REGMAP_IRQ_REG(PM8008_IRQ_MISC_UVLO, PM8008_MISC, BIT(0)), > > - REGMAP_IRQ_REG(PM8008_IRQ_MISC_OVLO, PM8008_MISC, BIT(1)), > > - REGMAP_IRQ_REG(PM8008_IRQ_MISC_OTST2, PM8008_MISC, BIT(2)), > > - REGMAP_IRQ_REG(PM8008_IRQ_MISC_OTST3, PM8008_MISC, BIT(3)), > > - REGMAP_IRQ_REG(PM8008_IRQ_MISC_LDO_OCP, PM8008_MISC, BIT(4)), > > - REGMAP_IRQ_REG(PM8008_IRQ_TEMP_ALARM, PM8008_TEMP_ALARM, BIT(0)), > > - REGMAP_IRQ_REG(PM8008_IRQ_GPIO1, PM8008_GPIO1, BIT(0)), > > - REGMAP_IRQ_REG(PM8008_IRQ_GPIO2, PM8008_GPIO2, BIT(0)), > > +#define _IRQ(_irq, _off, _mask, _types) \ > > + [_irq] = { \ > > + .reg_offset = (_off), \ > > + .mask = (_mask), \ > > + .type = { \ > > + .type_reg_offset = (_off), \ > > + .types_supported = (_types), \ > > + }, \ > > + } > > Any reason why this can't be generic and be tucked away somewhere in a > header file? These macros tend to be quite driver specific so not sure it makes sense to try to generalise beyond the basic ones already provided by regmap. Either way, I don't think that should be a prerequisite for fixing this driver. I'm also considering replacing the current irq chip implementation as part of unifying with the SPMI implementation. > > +static const struct regmap_irq pm8008_irqs[] = { > > + _IRQ(PM8008_IRQ_MISC_UVLO, PM8008_MISC, BIT(0), IRQ_TYPE_EDGE_RISING), > > + _IRQ(PM8008_IRQ_MISC_OVLO, PM8008_MISC, BIT(1), IRQ_TYPE_EDGE_RISING), > > + _IRQ(PM8008_IRQ_MISC_OTST2, PM8008_MISC, BIT(2), IRQ_TYPE_EDGE_RISING), > > + _IRQ(PM8008_IRQ_MISC_OTST3, PM8008_MISC, BIT(3), IRQ_TYPE_EDGE_RISING), > > + _IRQ(PM8008_IRQ_MISC_LDO_OCP, PM8008_MISC, BIT(4), IRQ_TYPE_EDGE_RISING), > > + _IRQ(PM8008_IRQ_TEMP_ALARM, PM8008_TEMP_ALARM,BIT(0), IRQ_TYPE_SENSE_MASK), > > + _IRQ(PM8008_IRQ_GPIO1, PM8008_GPIO1, BIT(0), IRQ_TYPE_SENSE_MASK), > > + _IRQ(PM8008_IRQ_GPIO2, PM8008_GPIO2, BIT(0), IRQ_TYPE_SENSE_MASK), > > }; Johan