[PATCH 3/3] udmabuf: Use module_misc_device() to register this device
Andrew Davis
afd at ti.com
Tue Jan 23 22:12:27 UTC 2024
Now that we do not need to call dma_coerce_mask_and_coherent() on our
miscdevice device, use the module_misc_device() helper for registering
and module init/exit.
Signed-off-by: Andrew Davis <afd at ti.com>
---
drivers/dma-buf/udmabuf.c | 30 +-----------------------------
1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index ab6764322523c..3028ac3fd9f6a 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/drivers/dma-buf/udmabuf.c
@@ -392,34 +392,6 @@ static struct miscdevice udmabuf_misc = {
.name = "udmabuf",
.fops = &udmabuf_fops,
};
-
-static int __init udmabuf_dev_init(void)
-{
- int ret;
-
- ret = misc_register(&udmabuf_misc);
- if (ret < 0) {
- pr_err("Could not initialize udmabuf device\n");
- return ret;
- }
-
- ret = dma_coerce_mask_and_coherent(udmabuf_misc.this_device,
- DMA_BIT_MASK(64));
- if (ret < 0) {
- pr_err("Could not setup DMA mask for udmabuf device\n");
- misc_deregister(&udmabuf_misc);
- return ret;
- }
-
- return 0;
-}
-
-static void __exit udmabuf_dev_exit(void)
-{
- misc_deregister(&udmabuf_misc);
-}
-
-module_init(udmabuf_dev_init)
-module_exit(udmabuf_dev_exit)
+module_misc_device(udmabuf_misc);
MODULE_AUTHOR("Gerd Hoffmann <kraxel at redhat.com>");
--
2.39.2
More information about the dri-devel
mailing list