]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
comedi: add comedi_check_request_region()
authorIan Abbott <abbotti@mev.co.uk>
Fri, 30 Jan 2026 16:47:26 +0000 (16:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Apr 2026 13:49:36 +0000 (15:49 +0200)
commit241cb8dee0f83856c728f4fe2c29e331386c92f2
tree3ce78c4aea703b632dcd22299ba9bc12ddac4e76
parent8f3481028b05e3418b6fe7119428ab44a5b2eb20
comedi: add comedi_check_request_region()

There is an existing comedi_request_region(dev, start, len) function
used by COMEDI drivers for legacy devices to request an I/O port region
starting at a specified base address (which must be non-zero) and with a
specified length.  It uses request_region().  On success, it sets
dev->iobase and dev->iolen and returns 0.  There is a alternative
function __comedi_request_region(dev, start, len) which does the same
thing without setting dev->iobase and dev->iolen.

Most hardware devices have restrictions on the allowed I/O port base
address and alignment, so add new functions
comedi_check_request_region(dev, start, len, minstart, maxend, minalign)
and __comedi_check_request_region(dev, start, len, minstart, maxend,
minalign) to perform these additional checks.  Turn the original
functions into static inline wrapper functions that call the new
functions.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://patch.msgid.link/20260130170416.49994-2-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/comedi/drivers.c
include/linux/comedi/comedidev.h