From: Lars-Peter Clausen <lars@metafoo.de>
To: Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>
Cc: "Michal Simek" <michal.simek@xilinx.com>,
"Harini Katakam" <harini.katakam@xilinx.com>,
"Sören Brinkmann" <soren.brinkmann@xilinx.com>,
linux-gpio@vger.kernel.org,
"Lars-Peter Clausen" <lars@metafoo.de>
Subject: [PATCH 1/2] gpio: zynq: Reduce level of indention in zynq_gpio_irqhandler()
Date: Mon, 18 Aug 2014 11:54:55 +0200 [thread overview]
Message-ID: <1408355696-9998-1-git-send-email-lars@metafoo.de> (raw)
zynq_gpio_irqhandler() uses up to 7 tabs of indention in some parts. Refactor
things to use a helper function for the inner loop to reduce the indention to a
sane level.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
drivers/gpio/gpio-zynq.c | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index 31ad5df..f440317 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -457,6 +457,24 @@ static struct irq_chip zynq_gpio_edge_irqchip = {
.irq_set_wake = zynq_gpio_set_wake,
};
+static void zynq_gpio_handle_bank_irq(struct zynq_gpio *gpio,
+ unsigned int bank_num,
+ unsigned long pending)
+{
+ struct irq_domain *irqdomain = gpio->chip.irqdomain;
+ int offset;
+
+ if (!pending)
+ return;
+
+ for_each_set_bit(offset, &pending, 32) {
+ unsigned int gpio_irq;
+
+ gpio_irq = irq_find_mapping(irqdomain, offset);
+ generic_handle_irq(gpio_irq);
+ }
+}
+
/**
* zynq_gpio_irqhandler - IRQ handler for the gpio banks of a gpio device
* @irq: irq number of the gpio bank where interrupt has occurred
@@ -482,18 +500,7 @@ static void zynq_gpio_irqhandler(unsigned int irq, struct irq_desc *desc)
ZYNQ_GPIO_INTSTS_OFFSET(bank_num));
int_enb = readl_relaxed(gpio->base_addr +
ZYNQ_GPIO_INTMASK_OFFSET(bank_num));
- int_sts &= ~int_enb;
- if (int_sts) {
- int offset;
- unsigned long pending = int_sts;
-
- for_each_set_bit(offset, &pending, 32) {
- unsigned int gpio_irq =
- irq_find_mapping(gpio->chip.irqdomain,
- offset);
- generic_handle_irq(gpio_irq);
- }
- }
+ zynq_gpio_handle_bank_irq(gpio, bank_num, int_sts & ~int_enb);
}
chained_irq_exit(irqchip, desc);
--
1.8.0
next reply other threads:[~2014-08-18 9:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-18 9:54 Lars-Peter Clausen [this message]
2014-08-18 9:54 ` [PATCH v2 2/2] gpio: zynq: Take bank offset into account when reporting a IRQ Lars-Peter Clausen
2014-08-18 16:28 ` Alexandre Courbot
2014-08-18 18:54 ` Sören Brinkmann
2014-08-18 19:04 ` Harini Katakam
2014-08-21 12:40 ` Linus Walleij
2014-08-21 13:30 ` Lars-Peter Clausen
2014-08-29 7:20 ` Linus Walleij
2014-08-29 7:34 ` Lars-Peter Clausen
2014-08-29 9:33 ` Michal Simek
2014-09-03 11:57 ` Linus Walleij
2014-08-29 6:33 ` [PATCH 1/2] gpio: zynq: Reduce level of indention in zynq_gpio_irqhandler() Linus Walleij
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=1408355696-9998-1-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=gnurou@gmail.com \
--cc=harini.katakam@xilinx.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=soren.brinkmann@xilinx.com \
/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;
as well as URLs for NNTP newsgroup(s).