summaryrefslogtreecommitdiff
path: root/include/linux/uio_driver.h
diff options
context:
space:
mode:
authorAlexandru Ardelean <alexandru.ardelean@analog.com>2020-03-06 19:18:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-18 14:34:10 +0300
commit86a78b1cfc78a6378c4ff3b30f822899c066dca5 (patch)
tree9e1a3b4bc4ba47ae135c38900c3f28ff11af9781 /include/linux/uio_driver.h
parent05d67ec3ca59627f2c1dd62538a345c4a9cdff44 (diff)
downloadlinux-86a78b1cfc78a6378c4ff3b30f822899c066dca5.tar.xz
uio: add resource managed devm_uio_register_device() function
This change adds a resource managed equivalent of uio_register_device(). Not adding devm_uio_unregister_device(), since the intent is to discourage it's usage. Having such a function may allow some bad driver designs. Most users of devm_*register*() functions rarely use the unregister equivalents. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20200306161853.25368-1-alexandru.ardelean@analog.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/uio_driver.h')
-rw-r--r--include/linux/uio_driver.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 461db05819f4..54bf6b118401 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -123,6 +123,15 @@ extern int __must_check
extern void uio_unregister_device(struct uio_info *info);
extern void uio_event_notify(struct uio_info *info);
+extern int __must_check
+ __devm_uio_register_device(struct module *owner,
+ struct device *parent,
+ struct uio_info *info);
+
+/* use a define to avoid include chaining to get THIS_MODULE */
+#define devm_uio_register_device(parent, info) \
+ __devm_uio_register_device(THIS_MODULE, parent, info)
+
/* defines for uio_info->irq */
#define UIO_IRQ_CUSTOM -1
#define UIO_IRQ_NONE 0