Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp563425lqh; Fri, 31 May 2024 09:23:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIXgS/0/uaMIGAeZqx4QbkfC5XoX6r8HAFn7TCTfB6N5Jb7hfJVssQYf4uCkpcozKTxiMxsA1QDUpjbFtEzBVTeGHwvY6TDGPS6W7Y+Q== X-Google-Smtp-Source: AGHT+IGozn4LTIJja8P6Eyz0zvWRyetdrvjV9mlzpZFnELZZx9ar42/R0yPM0L2yNilspJQIo6Fs X-Received: by 2002:a50:d61b:0:b0:57a:3114:7d04 with SMTP id 4fb4d7f45d1cf-57a361ceb04mr1869947a12.0.1717172590113; Fri, 31 May 2024 09:23:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717172590; cv=pass; d=google.com; s=arc-20160816; b=ulD/OzI6YU13uP4HKsUft6rGB6a0yIIkOQ2qM7WRzd8fP+3/9kiLV5UcSqhfArQlQt zcqG2dyRmHUm0ARfaLoyD1FLPFME4iVE2IAsiWUXCocyArmGgEZM2DD8dHGinIYyQYUL bHK2KRxmZxuCdHBxaFmSMFNCFjzxTlNvqEXfALwVZq1/sqNo/PyVDiMFwsjI7znCbq9t 2gwHSMTrD9J4OjiOT+TYNjsJqleXRUXxHVwE62hLggvm1FTEODtyRuZqXs3sAwbPmXVf ++3Eob5eqk5BexEVSsoCzRVYr7C1vRdIDTpZTVATUSwe88IsjBAajsEa3D8PhHbK8Nl1 Nm+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=WU9HOi116oLiCRDppMSgfPzQnRzV0fHJZl34KYHTbeo=; fh=fs0y8XQ1M19s+LH2vPYri9SWDKdiUXpnOQgYFEg1S6Q=; b=bxpVgW/n1mTPhjc2q4/9Z1FkjtVTnWeIb1kdB0NXQLtZAH3SKRv2MeQN5WSRYAqWUf vHG0EfqOSzJw5rXd6LFbfh4mJk1JeVIRMS2pQaKaE64ABhPoWC+D2KigMYAw0b2VBcRm kgBVDmpmlDlt08XxZXdvoaAyPDafqaDoz5/zTPXSMgqYgSd9tY5edlnSLNCbREzD/Prs k8iBEYmyXuFx3DwOhXs0vaaP83vP9N3D2vn2RL46YlG1gBMfgtgrFyNDiYVNJQANg0b3 WkQFwIAEQq9Dl7YVkp0CfG1J3ttBYIA+26YQLsNfz1Ey3ZBRJJQVLtTkw8v3sT+9Jex7 T6Nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b7vMdJSK; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-197140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31bad288si1118588a12.199.2024.05.31.09.23.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 09:23:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b7vMdJSK; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-197140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 C8BAC1F22C40 for ; Fri, 31 May 2024 16:23:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03E19158DD3; Fri, 31 May 2024 16:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="b7vMdJSK" Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BA65145328 for ; Fri, 31 May 2024 16:22:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717172577; cv=none; b=GbBD2w6XRyA0YG6XK8YxlIb2ULEptMhlRsUeRknzXG2a2vhwrk0fGX3J7HjnbF+QE9yReGXOUwNFHCceWHW6KcMrBupkfNKMEDlJCTTNax56DO5oxNGWyYv9KcopnWbl38OJkcdObL8MIMd8tAjP8Cn+x2jhzoIZH92oWncJ0fw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717172577; c=relaxed/simple; bh=wRuzukfHTuY9txqqlUqVEoBDYzEHtslcBcqDMPuKaD4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jWFrPTQVStVXhPiJXFLY2hx4p0C5TfpmZa+JplXGhNUjM7JkHlVlNdPxAMF+QlCcHqhsVa7dIGunGWZR3Fx6tjkCWZOwmyCjfqPzMIpD3dc/+UmWov7eib/R+2Yr+fGkJnUaMj112PTJemsdLx+p7s4t2XHAl3O4GFbvKty1xOQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=b7vMdJSK; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-52b03d66861so2476392e87.1 for ; Fri, 31 May 2024 09:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717172573; x=1717777373; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=WU9HOi116oLiCRDppMSgfPzQnRzV0fHJZl34KYHTbeo=; b=b7vMdJSKFvZpNoxy84XjSRcL1tNkGMKbKpvyS1mepLDzgMus7le6Y4/RQ25AmYTfMB wMvDr294PtddE75Ninc7+aoJBa2GUHHdEIT0Us38MKGE9iJ7BdwErHoJYZF00azHZd2t 3WQp82CNLCTm9kNZTeBFvrrnCYGBZXZT/Hb6s7BMc9R6ELzh0+NpuLiaK3jdXeDl0KQU F3B66cW2uadQ7XhCUyt1AH4ReuXvKKOkgKHn/IX6JAP6N7sC9nFa57yBxw1t0G6ncOsf sZZw6b5GbJBt3pKyEq7wk2kyTPGG2qqUDh0knIu/gbjadK/sM5YTWiWFoyhohSz2E9ls ziCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717172573; x=1717777373; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WU9HOi116oLiCRDppMSgfPzQnRzV0fHJZl34KYHTbeo=; b=a6yb7L8vc+rMkG9ZzZ19ZQdJ29A6gAebF5/DAOAN53zKvuDOyobnW8Jz3suJuvBZ42 N4OWtkyIffaxC2xcp0Q97vBZrc/8Y0Kv7jEch8Lhm1B4I9iZZzvAotifIH05MUB0c68b 6Yvga7mTZPzj2K0TKuIeg8IXFfXkK07UqPSpIUYt9DAFqcTZdHeKu/S1esQIQg9iyC75 SeOTxfkoriK7coQUOPf8Fb3X1IORvD5EZxPKGXVXhmxArQD95Jb9Yu1YmKW+2SG987/G XLHJBVVXV6V+83bmWofkX03EpRAp9ZK4DtGq2T34envGpk7UnONqfxyrV9Jf0T1bbX9w v4hw== X-Forwarded-Encrypted: i=1; AJvYcCXa0DkniMeFngNXH5fn/65DjTBOC0KdIlkx9dbBdooA1M7AX0yEhPosD+aTrINySM+Xt+VrbogyaYBHsasCnMinbqB1ONyOqVIHbRPl X-Gm-Message-State: AOJu0YxOEmERzPWOeYHPFtAeTFmINIcLLZQUboblHVFVrSvsI8ocKZAl SqyPC2mQqUpEaLQAWNJLDgtzI3AGA8n8NV24TJ9J8QzIxwyPfbuuImbzhZv4xR910pucYsxlAgY 6QDS/jA== X-Received: by 2002:ac2:4d90:0:b0:529:b6b4:7e3c with SMTP id 2adb3069b0e04-52b8970c17dmr1550674e87.45.1717172573230; Fri, 31 May 2024 09:22:53 -0700 (PDT) Received: from [192.168.0.3] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35dd064bba6sm2161697f8f.104.2024.05.31.09.22.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 May 2024 09:22:52 -0700 (PDT) Message-ID: <3f9e58f2-86e4-4ac4-bf48-22d12d5ae4e9@linaro.org> Date: Fri, 31 May 2024 17:22:51 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 02/14] mfd: pm8008: fix regmap irq chip initialisation To: Johan Hovold , Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson Cc: 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 References: <20240529162958.18081-1-johan+linaro@kernel.org> <20240529162958.18081-3-johan+linaro@kernel.org> Content-Language: en-US From: Bryan O'Donoghue In-Reply-To: <20240529162958.18081-3-johan+linaro@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 29/05/2024 17:29, 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 > --- > drivers/mfd/qcom-pm8008.c | 64 ++++++++++++++------------------------- > 1 file changed, 23 insertions(+), 41 deletions(-) > > diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c > index 3ac3742f438b..f71c490f25c8 100644 > --- a/drivers/mfd/qcom-pm8008.c > +++ b/drivers/mfd/qcom-pm8008.c > @@ -56,15 +56,25 @@ static unsigned int pm8008_config_regs[] = { > INT_POL_LOW_OFFSET, > }; > > -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), \ > + }, \ > + } > + > +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), > }; > > static const unsigned int pm8008_periph_base[] = { > @@ -143,38 +153,9 @@ static struct regmap_config qcom_mfd_regmap_cfg = { > .max_register = 0xFFFF, > }; > > -static int pm8008_probe_irq_peripherals(struct device *dev, > - struct regmap *regmap, > - int client_irq) > -{ > - int rc, i; > - struct regmap_irq_type *type; > - struct regmap_irq_chip_data *irq_data; > - > - for (i = 0; i < ARRAY_SIZE(pm8008_irqs); i++) { > - type = &pm8008_irqs[i].type; > - > - type->type_reg_offset = pm8008_irqs[i].reg_offset; > - > - if (type->type_reg_offset == PM8008_MISC) > - type->types_supported = IRQ_TYPE_EDGE_RISING; > - else > - type->types_supported = (IRQ_TYPE_EDGE_BOTH | > - IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW); > - } ick A no-brainer improvement. Reviewed-by: Bryan O'Donoghue