From 10d84a2d542acf227c76c2a96c4e8ba985743d0d Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sun, 9 Jul 2017 11:31:37 +0100 Subject: [PATCH] dummy-irq --- kernel_config_fragment | 20 ++++++++++++++++++-- kernel_module/platform_device.c | 4 ++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/kernel_config_fragment b/kernel_config_fragment index 53c5433..17de866 100644 --- a/kernel_config_fragment +++ b/kernel_config_fragment @@ -1,5 +1,5 @@ -# Changes to this file are automatically used in the new kernel -# after ./run, no need to do anything different. +# Changes to this file are automatically trigger kernel reconfigures +# even without using the linux-reconfigure target. CONFIG_DEBUG_FS=y CONFIG_DEBUG_INFO=y @@ -108,3 +108,19 @@ CONFIG_ARM_AMBA=y CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_PL061=y + +# run -a arm +# +# In target: +# +# modprobe dummy-irq irq=34 +# insmod /platform_device.ko +# +# Outcome: +# +# lkmc_platform_device_write offset=0 value=12345678 size=4 +# dummy-irq: interrupt occurred on IRQ 34 +# +# When the device generates an IRQ, +# the dummy module also snoops it. +CONFIG_DUMMY_IRQ=m diff --git a/kernel_module/platform_device.c b/kernel_module/platform_device.c index e7972b6..a7ecdab 100644 --- a/kernel_module/platform_device.c +++ b/kernel_module/platform_device.c @@ -55,9 +55,9 @@ static int lkmc_platform_device_probe(struct platform_device *pdev) return -EINVAL; } - /* IRQ. */ + /* IRQ. Shared so that other test modules may snoop it. */ irq = irq_of_parse_and_map(dev->of_node, 0); - if (request_irq(irq, lkmc_irq_handler, 0, "lkmc_platform_device", dev) < 0) { + if (request_irq(irq, lkmc_irq_handler, IRQF_SHARED, "lkmc_platform_device", dev) < 0) { dev_err(dev, "request_irq"); return -EINVAL; }