Many modern drivers employ the kernel's devres or managed APIs framework for various purposes. The managed APIs in modern Linux kernels give you the advantage of not having to worry about freeing up resources that you've allocated (we have covered a few of them already, including devm_k{m,z}alloc() and devm_ioremap{_resource}()). Of course, you must use them appropriately, typically in the probe method (or init code) of the driver.
It is recommended that, when writing drivers, you use this newer API style. Here, we'll show how you to employ the devm_request_irq() API in order to allocate (register) your hardware interrupt. Its signature is as follows:
#include <linux/interrupt.h>
int __must_check
devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
unsigned long irqflags, const char *devname, void *dev_id);
The first parameter is the...