RE: [PATCH 3/3] udmabuf: Use module_misc_device() to register this device

2024-01-24 Thread Kasireddy, Vivek
Acked-by: Vivek Kasireddy 

> 
> 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 
> ---
>  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   = _fops,
>  };
> -
> -static int __init udmabuf_dev_init(void) -{
> - int ret;
> -
> - ret = misc_register(_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(_misc);
> - return ret;
> - }
> -
> - return 0;
> -}
> -
> -static void __exit udmabuf_dev_exit(void) -{
> - misc_deregister(_misc);
> -}
> -
> -module_init(udmabuf_dev_init)
> -module_exit(udmabuf_dev_exit)
> +module_misc_device(udmabuf_misc);
> 
>  MODULE_AUTHOR("Gerd Hoffmann ");
> --
> 2.39.2



[PATCH 3/3] udmabuf: Use module_misc_device() to register this device

2024-01-23 Thread Andrew Davis
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 
---
 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   = _fops,
 };
-
-static int __init udmabuf_dev_init(void)
-{
-   int ret;
-
-   ret = misc_register(_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(_misc);
-   return ret;
-   }
-
-   return 0;
-}
-
-static void __exit udmabuf_dev_exit(void)
-{
-   misc_deregister(_misc);
-}
-
-module_init(udmabuf_dev_init)
-module_exit(udmabuf_dev_exit)
+module_misc_device(udmabuf_misc);
 
 MODULE_AUTHOR("Gerd Hoffmann ");
-- 
2.39.2