drm/nouveau/devinit: Convert function disable() to be void
authorDeepak R Varma <drv@mailo.com>
Wed, 25 Jan 2023 15:07:14 +0000 (20:37 +0530)
committerLyude Paul <lyude@redhat.com>
Wed, 25 Jan 2023 21:50:31 +0000 (16:50 -0500)
The current design of callback function disable() of struct
nvkm_devinit_func is defined to return a u64 value. In its implementation
in the driver modules, the function always returns a fixed value 0. Hence
the design and implementation of this function should be enhanced to return
void instead of a fixed value. This change also eliminates untouched
return variables.

The change is identified using the returnvar.cocci Coccinelle semantic
patch script.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/Y9FFoooIXjlr+UP1@ubun2204.myguest.virtualbox.org
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g84.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g98.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gt215.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/mcp89.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/priv.h

index dd4981708fe40e90f1823a917d2e69f1bacc87b8..3d9319c319c647febcd24aa903306ddbfe7d91a1 100644 (file)
@@ -51,7 +51,8 @@ u64
 nvkm_devinit_disable(struct nvkm_devinit *init)
 {
        if (init && init->func->disable)
-               return init->func->disable(init);
+               init->func->disable(init);
+
        return 0;
 }
 
index c224702b7bedf5a19d0246e2d053329a9fe61a66..00df7811dd1060b68d529fe85ed3f9f484f02efd 100644 (file)
 #include <subdev/bios.h>
 #include <subdev/bios/init.h>
 
-static u64
+static void
 g84_devinit_disable(struct nvkm_devinit *init)
 {
        struct nvkm_device *device = init->subdev.device;
        u32 r001540 = nvkm_rd32(device, 0x001540);
        u32 r00154c = nvkm_rd32(device, 0x00154c);
-       u64 disable = 0ULL;
 
        if (!(r001540 & 0x40000000)) {
                nvkm_subdev_disable(device, NVKM_ENGINE_MPEG, 0);
@@ -47,8 +46,6 @@ g84_devinit_disable(struct nvkm_devinit *init)
                nvkm_subdev_disable(device, NVKM_ENGINE_BSP, 0);
        if (!(r00154c & 0x00000040))
                nvkm_subdev_disable(device, NVKM_ENGINE_CIPHER, 0);
-
-       return disable;
 }
 
 static const struct nvkm_devinit_func
index 8977483a9f42d86aacb82f0d19cb3b1ed5fc3964..54bee499b9826a8efd1ceb38d96afd2d815acd23 100644 (file)
@@ -26,7 +26,7 @@
 #include <subdev/bios.h>
 #include <subdev/bios/init.h>
 
-static u64
+static void
 g98_devinit_disable(struct nvkm_devinit *init)
 {
        struct nvkm_device *device = init->subdev.device;
@@ -45,8 +45,6 @@ g98_devinit_disable(struct nvkm_devinit *init)
                nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
        if (!(r00154c & 0x00000040))
                nvkm_subdev_disable(device, NVKM_ENGINE_SEC, 0);
-
-       return 0ULL;
 }
 
 static const struct nvkm_devinit_func
index 5b7cb1fe7897bcb785254a2e353e25eb1714490d..5368e705e7fd643908730d4ee22defb6e0e4c249 100644 (file)
@@ -63,7 +63,7 @@ gf100_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq)
        return ret;
 }
 
-static u64
+static void
 gf100_devinit_disable(struct nvkm_devinit *init)
 {
        struct nvkm_device *device = init->subdev.device;
@@ -85,8 +85,6 @@ gf100_devinit_disable(struct nvkm_devinit *init)
                nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
        if (r022500 & 0x00000200)
                nvkm_subdev_disable(device, NVKM_ENGINE_CE, 1);
-
-       return 0ULL;
 }
 
 void
index 8955af2704c77dd7a0d80d9442cc308a1f89e2f2..7bcbc4895ec22196acecfd46d0b29490d2c93ee2 100644 (file)
@@ -26,7 +26,7 @@
 #include <subdev/bios.h>
 #include <subdev/bios/init.h>
 
-u64
+void
 gm107_devinit_disable(struct nvkm_devinit *init)
 {
        struct nvkm_device *device = init->subdev.device;
@@ -39,8 +39,6 @@ gm107_devinit_disable(struct nvkm_devinit *init)
                nvkm_subdev_disable(device, NVKM_ENGINE_CE, 2);
        if (r021c04 & 0x00000001)
                nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
-
-       return 0ULL;
 }
 
 static const struct nvkm_devinit_func
index 3d0ab86c31158830336583d1caedde868345379a..dbca92318bafd2df46ea958efc624d541a453e03 100644 (file)
@@ -62,7 +62,7 @@ gt215_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq)
        return ret;
 }
 
-static u64
+static void
 gt215_devinit_disable(struct nvkm_devinit *init)
 {
        struct nvkm_device *device = init->subdev.device;
@@ -80,8 +80,6 @@ gt215_devinit_disable(struct nvkm_devinit *init)
                nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
        if (!(r00154c & 0x00000200))
                nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
-
-       return 0ULL;
 }
 
 static u32
index a9cdf2411187f7764aefb356f4569615e555972f..a24bd2e7d7ce5047d912668e053751608c5a8d15 100644 (file)
@@ -26,7 +26,7 @@
 #include <subdev/bios.h>
 #include <subdev/bios/init.h>
 
-static u64
+static void
 mcp89_devinit_disable(struct nvkm_devinit *init)
 {
        struct nvkm_device *device = init->subdev.device;
@@ -46,8 +46,6 @@ mcp89_devinit_disable(struct nvkm_devinit *init)
                nvkm_subdev_disable(device, NVKM_ENGINE_VIC, 0);
        if (!(r00154c & 0x00000200))
                nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
-
-       return 0;
 }
 
 static const struct nvkm_devinit_func
index 380995d398b1c8c0bbe36be93962a1c6876a45eb..07ed8fd778b2c6313bd886aca8e8d7325f2ba288 100644 (file)
@@ -77,17 +77,14 @@ nv50_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq)
        return 0;
 }
 
-static u64
+static void
 nv50_devinit_disable(struct nvkm_devinit *init)
 {
        struct nvkm_device *device = init->subdev.device;
        u32 r001540 = nvkm_rd32(device, 0x001540);
-       u64 disable = 0ULL;
 
        if (!(r001540 & 0x40000000))
                nvkm_subdev_disable(device, NVKM_ENGINE_MPEG, 0);
-
-       return disable;
 }
 
 void
index 987a7f478b84bb11368026780e4f75f0b35b4b1b..8de409c084c1536a6438d9ad04ef9b139b282815 100644 (file)
@@ -23,7 +23,7 @@ int  gf100_devinit_ctor(struct nvkm_object *, struct nvkm_object *,
 int  gf100_devinit_pll_set(struct nvkm_devinit *, u32, u32);
 void gf100_devinit_preinit(struct nvkm_devinit *);
 
-u64  gm107_devinit_disable(struct nvkm_devinit *);
+void  gm107_devinit_disable(struct nvkm_devinit *);
 
 int gm200_devinit_post(struct nvkm_devinit *, bool);
 void gm200_devinit_preos(struct nv50_devinit *, bool);
index dd8b038a8ceee402f85f6b5421dcbe50356fca09..a648482d06e912e0543ad55a1899d6bb2c8278d1 100644 (file)
@@ -12,7 +12,7 @@ struct nvkm_devinit_func {
        u32  (*mmio)(struct nvkm_devinit *, u32);
        void (*meminit)(struct nvkm_devinit *);
        int  (*pll_set)(struct nvkm_devinit *, u32 type, u32 freq);
-       u64  (*disable)(struct nvkm_devinit *);
+       void (*disable)(struct nvkm_devinit *);
 };
 
 void nvkm_devinit_ctor(const struct nvkm_devinit_func *, struct nvkm_device *,