From 007abdcaf96b839ff03ceecbc13dfb5dd51b6db0 Mon Sep 17 00:00:00 2001 From: Jason Tang Date: Thu, 24 Aug 2017 23:01:12 -0400 Subject: [PATCH 3/3] x86: Add handler for CS421 HW1 This creates a new platform driver with an IRQ handler. It does nothing else. Signed-off-by: Jason Tang --- drivers/platform/x86/Kconfig | 8 ++++++++ drivers/platform/x86/Makefile | 1 + drivers/platform/x86/cs421_hw1.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 drivers/platform/x86/cs421_hw1.c diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 8489020..f0d6f33 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -1110,6 +1110,14 @@ config SILEAD_DMI with the OS-image for the device. This option supplies the missing information. Enable this for x86 tablets with Silead touchscreens. +config CS421_HW1 + tristate "CS421 Homework 1 Interrupt Handler" + default y + ---help--- + This driver adds a new interrupt handler to the kernel. When this + driver is installed, note the new line added to /proc/interrupts. In + your Part 4 response, say which IRQ corresponds to that new line. + endif # X86_PLATFORM_DEVICES config PMC_ATOM diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index 182a3ed..5b42100 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile @@ -80,3 +80,4 @@ obj-$(CONFIG_PMC_ATOM) += pmc_atom.o obj-$(CONFIG_MLX_PLATFORM) += mlx-platform.o obj-$(CONFIG_MLX_CPLD_PLATFORM) += mlxcpld-hotplug.o obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o +obj-$(CONFIG_CS421_HW1) += cs421_hw1.o diff --git a/drivers/platform/x86/cs421_hw1.c b/drivers/platform/x86/cs421_hw1.c new file mode 100644 index 0000000..b5a4d4e --- /dev/null +++ b/drivers/platform/x86/cs421_hw1.c @@ -0,0 +1,34 @@ +/* + * Copyright(c) 2016 Jason Tang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include + +#define HW1_IRQ 3 + +static irqreturn_t hw1_handler(int irq, void *dev) +{ + return IRQ_HANDLED; +} + +static int __init hw1_init(void) +{ + return request_irq(HW1_IRQ, hw1_handler, 0, "CS421 HW1", NULL); +} + +static void __exit hw1_exit(void) +{ + free_irq(HW1_IRQ, NULL); +} + +module_init(hw1_init); +module_exit(hw1_exit); + +MODULE_DESCRIPTION("CS421 HW1"); +MODULE_LICENSE("GPL"); -- 2.7.4