From: Markus Elfring <Markus.Elfring@web.de>
To: Kevin Chen <kevin_chen@aspeedtech.com>,
linux-aspeed@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Conor Dooley <conor+dt@kernel.org>, Joel Stanley <joel@jms.id.au>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Rob Herring <robh@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
BMC-SW <BMC-SW@aspeedtech.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v3 2/2] irqchip/aspeed-intc: Add support for AST27XX INTC
Date: Fri, 11 Oct 2024 17:34:02 +0200 [thread overview]
Message-ID: <0b995a34-28c4-4ba6-8ad2-e8413c6a63f5@web.de> (raw)
In-Reply-To: <PSAPR06MB4949904D1FA95DBD3EF5288A89792@PSAPR06MB4949.apcprd06.prod.outlook.com>
>> …
>>> +++ b/drivers/irqchip/irq-aspeed-intc.c
>>> @@ -0,0 +1,139 @@
>> …
>>> +static void aspeed_intc_ic_irq_handler(struct irq_desc *desc)
>> +{
>>> + struct aspeed_intc_ic *intc_ic = irq_desc_get_handler_data(desc);
>>> + struct irq_chip *chip = irq_desc_get_chip(desc);
>>> + unsigned long bit, status;
>>
>> I suggest to reduce the scopes for three local variables.
> May I check the scopes of bit and status usage?
> Variables of bit and status are used in for_each_set_bit.
> How could I reduce the scopes?
I propose to move selected variable definitions into corresponding compound statements
(by using extra curly brackets).
https://refactoring.com/catalog/reduceScopeOfVariable.html
>> Would you become interested to collaborate with another scoped guard for
>> this programming interface?
>> https://elixir.bootlin.com/linux/v6.12-rc2/source/include/linux/irqchip/chained
>> _irq.h#L13
>
> Maybe like the change in the following?
>
> diff --git a/drivers/irqchip/irq-aspeed-intc.c b/drivers/irqchip/irq-aspeed-intc.c
> index ef1c095ad09e..54d1881c56c6 100644
> --- a/drivers/irqchip/irq-aspeed-intc.c
> +++ b/drivers/irqchip/irq-aspeed-intc.c
> @@ -32,7 +32,7 @@ static void aspeed_intc_ic_irq_handler(struct irq_desc *desc)
> struct irq_chip *chip = irq_desc_get_chip(desc);
> unsigned long bit, status;
>
> - chained_irq_enter(chip, desc);
> + guard(chained_irq)(desc);
>
> scoped_guard(raw_spinlock, &intc_ic->gic_lock) {
> status = readl(intc_ic->base + INTC_INT_STATUS_REG);
Perhaps.
> @@ -41,8 +41,6 @@ static void aspeed_intc_ic_irq_handler(struct irq_desc *desc)
> writel(BIT(bit), intc_ic->base + INTC_INT_STATUS_REG);
> }
> }
> -
> - chained_irq_exit(chip, desc);
> }
…
Probably, yes.
…
> +++ b/include/linux/irqchip/chained_irq.h
> @@ -38,4 +38,5 @@ static inline void chained_irq_exit(struct irq_chip *chip,
> chip->irq_unmask(&desc->irq_data);
> }
>
> +DEFINE_GUARD (chained_irq, struct irq_desc * , chained_irq_exit ( _T ->irq_data.chip, _T ), chained_irq_enter (_T->irq_data.chip, _T))
…
* Such a macro call looks promising.
Would you like to omit any space characters before open parentheses?
* Would you like to support scoped guard variants accordingly?
Regards,
Markus
next prev parent reply other threads:[~2024-10-11 15:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 11:58 [PATCH v3 0/2] Add support for AST2700 INTC driver Kevin Chen
2024-10-09 11:58 ` [PATCH v3 1/2] dt-bindings: interrupt-controller: Add support for ASPEED AST27XX INTC Kevin Chen
2024-10-09 12:56 ` Markus Elfring
2024-10-09 21:11 ` Rob Herring
2024-10-11 10:02 ` Kevin Chen
2024-10-09 11:58 ` [PATCH v3 2/2] irqchip/aspeed-intc: Add support for " Kevin Chen
2024-10-09 12:32 ` Markus Elfring
2024-10-11 10:06 ` Kevin Chen
2024-10-11 15:34 ` Markus Elfring [this message]
2024-10-14 2:00 ` Kevin Chen
2024-10-14 13:10 ` Markus Elfring
2024-10-15 10:19 ` Kevin Chen
2024-10-15 15:07 ` Markus Elfring
2024-10-15 21:42 ` Thomas Gleixner
2024-10-16 0:31 ` Kevin Chen
2024-10-16 9:54 ` [v3 " Markus Elfring
2024-10-11 13:06 ` [PATCH v3 " Dan Carpenter
2024-10-14 0:17 ` Kevin Chen
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=0b995a34-28c4-4ba6-8ad2-e8413c6a63f5@web.de \
--to=markus.elfring@web.de \
--cc=BMC-SW@aspeedtech.com \
--cc=andrew@codeconstruct.com.au \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=joel@jms.id.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=kevin_chen@aspeedtech.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=tglx@linutronix.de \
/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®