mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Mukesh Ojha" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>,
	Thomas Gleixner <tglx@kernel.org>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: irq/drivers] irqchip/qcom-pdc: Use FIELD_GET() to extract bank index and bit position
Date: Wed, 03 Jun 2026 16:29:22 -0000	[thread overview]
Message-ID: <178050416209.710.13233344380148714274.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260527095426.2324504-5-mukesh.ojha@oss.qualcomm.com>

The following commit has been merged into the irq/drivers branch of tip:

Commit-ID:     8766c87e9bb499b5e2b04b9f51f9e525d41c5b46
Gitweb:        https://git.kernel.org/tip/8766c87e9bb499b5e2b04b9f51f9e525d41c5b46
Author:        Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
AuthorDate:    Wed, 27 May 2026 15:24:26 +05:30
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Wed, 03 Jun 2026 18:27:06 +02:00

irqchip/qcom-pdc: Use FIELD_GET() to extract bank index and bit position

The IRQ_ENABLE_BANK register is a bank of 32-bit words where each bit
represents one PDC pin. The bank index and bit position within the bank
are encoded in the flat pin number as bits [31:5] and [4:0] respectively.

Replace the open-coded division and modulo with FIELD_GET() and GENMASK()
to make the bit extraction self-documenting and consistent with the
FIELD_PREP() style already used in the PDC_VERSION() macro.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260527095426.2324504-5-mukesh.ojha@oss.qualcomm.com
---
 drivers/irqchip/qcom-pdc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c
index 08eec00..2014dbb 100644
--- a/drivers/irqchip/qcom-pdc.c
+++ b/drivers/irqchip/qcom-pdc.c
@@ -27,6 +27,8 @@
 /* Valid only on HW version < 3.2 */
 #define IRQ_ENABLE_BANK		0x10
 #define IRQ_ENABLE_BANK_MAX	(IRQ_ENABLE_BANK + BITS_TO_BYTES(PDC_MAX_GPIO_IRQS))
+#define IRQ_ENABLE_BANK_INDEX_MASK	GENMASK(31, 5)
+#define IRQ_ENABLE_BANK_BIT_MASK	GENMASK(4, 0)
 #define IRQ_i_CFG		0x110
 
 /* Valid only on HW version >= 3.2 */
@@ -109,8 +111,8 @@ static void pdc_enable_intr_bank(int pin_out, bool on)
 	unsigned long enable;
 	u32 index, mask;
 
-	index = pin_out / 32;
-	mask = pin_out % 32;
+	index = FIELD_GET(IRQ_ENABLE_BANK_INDEX_MASK, pin_out);
+	mask = FIELD_GET(IRQ_ENABLE_BANK_BIT_MASK, pin_out);
 
 	enable = pdc_reg_read(IRQ_ENABLE_BANK, index);
 	__assign_bit(mask, &enable, on);

      reply	other threads:[~2026-06-03 16:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27  9:54 [PATCH v2 0/4] irqchip/qcom-pdc: Misc. changes Mukesh Ojha
2026-05-27  9:54 ` [PATCH v2 1/4] irqchip/qcom-pdc: Split __pdc_enable_intr() into per-version helpers Mukesh Ojha
2026-06-03 16:29   ` [tip: irq/drivers] " tip-bot2 for Mukesh Ojha
2026-05-27  9:54 ` [PATCH v2 2/4] irqchip/qcom-pdc: Tighten ioremap clamp to single DRV region size Mukesh Ojha
2026-06-03 16:29   ` [tip: irq/drivers] " tip-bot2 for Mukesh Ojha
2026-06-11 10:40   ` [PATCH v2 2/4] " Konrad Dybcio
2026-05-27  9:54 ` [PATCH v2 3/4] irqchip/qcom-pdc: Add PDC_VERSION() macro to describe version register fields Mukesh Ojha
2026-06-03 16:29   ` [tip: irq/drivers] " tip-bot2 for Mukesh Ojha
2026-05-27  9:54 ` [PATCH v2 4/4] irqchip/qcom-pdc: Use FIELD_GET() to extract bank index and bit position Mukesh Ojha
2026-06-03 16:29   ` tip-bot2 for Mukesh Ojha [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178050416209.710.13233344380148714274.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mukesh.ojha@oss.qualcomm.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®