From: Daniel Scheller <d.scheller.oss@gmail.com>
To: linux-media@vger.kernel.org, mchehab@kernel.org,
mchehab@s-opensource.com
Subject: [PATCH v2 08/19] [media] ddbridge: add macros to handle IRQs in nibble and byte blocks
Date: Mon, 9 Apr 2018 18:47:41 +0200 [thread overview]
Message-ID: <20180409164752.641-9-d.scheller.oss@gmail.com> (raw)
In-Reply-To: <20180409164752.641-1-d.scheller.oss@gmail.com>
From: Daniel Scheller <d.scheller@gmx.net>
Currently, each IRQ requires one IRQ_HANDLE() line to call each IRQ
handler that was set up. Add a IRQ_HANDLE_NIBBLE() and IRQ_HANDLE_BYTE()
macro to call all handlers in blocks of four (_NIBBLE) or eight (_BYTE)
handlers at a time, to make this construct more compact.
Picked up from the upstream dddvb-0.9.33 release.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
---
drivers/media/pci/ddbridge/ddbridge-core.c | 67 ++++++++++++------------------
1 file changed, 27 insertions(+), 40 deletions(-)
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c
index be6935bd0cb5..5fbb0996a12c 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -2403,54 +2403,41 @@ void ddb_ports_release(struct ddb *dev)
dev->link[0].irq[_nr].handler(dev->link[0].irq[_nr].data); } \
while (0)
+#define IRQ_HANDLE_NIBBLE(_shift) { \
+ if (s & (0x0000000f << ((_shift) & 0x1f))) { \
+ IRQ_HANDLE(0 + (_shift)); \
+ IRQ_HANDLE(1 + (_shift)); \
+ IRQ_HANDLE(2 + (_shift)); \
+ IRQ_HANDLE(3 + (_shift)); \
+ } \
+}
+
+#define IRQ_HANDLE_BYTE(_shift) { \
+ if (s & (0x000000ff << ((_shift) & 0x1f))) { \
+ IRQ_HANDLE(0 + (_shift)); \
+ IRQ_HANDLE(1 + (_shift)); \
+ IRQ_HANDLE(2 + (_shift)); \
+ IRQ_HANDLE(3 + (_shift)); \
+ IRQ_HANDLE(4 + (_shift)); \
+ IRQ_HANDLE(5 + (_shift)); \
+ IRQ_HANDLE(6 + (_shift)); \
+ IRQ_HANDLE(7 + (_shift)); \
+ } \
+}
+
static void irq_handle_msg(struct ddb *dev, u32 s)
{
dev->i2c_irq++;
- IRQ_HANDLE(0);
- IRQ_HANDLE(1);
- IRQ_HANDLE(2);
- IRQ_HANDLE(3);
+ IRQ_HANDLE_NIBBLE(0);
}
static void irq_handle_io(struct ddb *dev, u32 s)
{
dev->ts_irq++;
- if ((s & 0x000000f0)) {
- IRQ_HANDLE(4);
- IRQ_HANDLE(5);
- IRQ_HANDLE(6);
- IRQ_HANDLE(7);
- }
- if ((s & 0x0000ff00)) {
- IRQ_HANDLE(8);
- IRQ_HANDLE(9);
- IRQ_HANDLE(10);
- IRQ_HANDLE(11);
- IRQ_HANDLE(12);
- IRQ_HANDLE(13);
- IRQ_HANDLE(14);
- IRQ_HANDLE(15);
- }
- if ((s & 0x00ff0000)) {
- IRQ_HANDLE(16);
- IRQ_HANDLE(17);
- IRQ_HANDLE(18);
- IRQ_HANDLE(19);
- IRQ_HANDLE(20);
- IRQ_HANDLE(21);
- IRQ_HANDLE(22);
- IRQ_HANDLE(23);
- }
- if ((s & 0xff000000)) {
- IRQ_HANDLE(24);
- IRQ_HANDLE(25);
- IRQ_HANDLE(26);
- IRQ_HANDLE(27);
- IRQ_HANDLE(28);
- IRQ_HANDLE(29);
- IRQ_HANDLE(30);
- IRQ_HANDLE(31);
- }
+ IRQ_HANDLE_NIBBLE(4);
+ IRQ_HANDLE_BYTE(8);
+ IRQ_HANDLE_BYTE(16);
+ IRQ_HANDLE_BYTE(24);
}
irqreturn_t ddb_irq_handler0(int irq, void *dev_id)
--
2.16.1
next prev parent reply other threads:[~2018-04-09 16:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-09 16:47 [PATCH v2 00/19] dddvb/ddbridge-0.9.33 Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 01/19] [media] dvb-frontends/stv0910: add init values for TSINSDELM/L Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 02/19] [media] dvb-frontends/stv0910: fix CNR reporting in read_snr() Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 03/19] [media] ddbridge: move modparams to ddbridge-core.c Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 04/19] [media] ddbridge: move ddb_wq and the wq+class initialisation to -core Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 05/19] [media] ddbridge: move MSI IRQ cleanup to a helper function Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 06/19] [media] ddbridge: request/free_irq using pci_irq_vector, enable MSI-X Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 07/19] [media] ddbridge: add helper for IRQ handler setup Daniel Scheller
2018-04-09 16:47 ` Daniel Scheller [this message]
2018-04-09 16:47 ` [PATCH v2 09/19] [media] ddbridge: improve separated MSI IRQ handling Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 10/19] [media] ddbridge: use spin_lock_irqsave() in output_work() Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 11/19] [media] ddbridge: fix output buffer check Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 12/19] [media] ddbridge: set devid entry for link 0 Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 13/19] [media] ddbridge: make DMA buffer count and size modparam-configurable Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 14/19] [media] ddbridge: support dummy tuners with 125MByte/s dummy data stream Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 15/19] [media] ddbridge: initial support for MCI-based MaxSX8 cards Daniel Scheller
2018-05-04 14:47 ` Mauro Carvalho Chehab
2018-04-09 16:47 ` [PATCH v2 16/19] [media] ddbridge/max: implement MCI/MaxSX8 attach function Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 17/19] [media] ddbridge: add hardware defs and PCI IDs for MCI cards Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 18/19] [media] ddbridge: recognize and attach the MaxSX8 cards Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 19/19] [media] ddbridge: set driver version to 0.9.33-integrated Daniel Scheller
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=20180409164752.641-9-d.scheller.oss@gmail.com \
--to=d.scheller.oss@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mchehab@s-opensource.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