From patchwork Wed Jan 25 15:07:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 48183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp325291wrn; Wed, 25 Jan 2023 07:11:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXvNxIMKZCyy5rr+hIbDHXQiZAgsfXZlZpfPuZG5O0NMdFgTxq7VrHgxCDnT9t8Jho84ui3O X-Received: by 2002:a17:906:4094:b0:854:956:1438 with SMTP id u20-20020a170906409400b0085409561438mr79712515ejj.25.1674659502617; Wed, 25 Jan 2023 07:11:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674659502; cv=none; d=google.com; s=arc-20160816; b=X6lvpuZGlAkMFxqdGL/fpdif+ENbdEr7QXBotkO7t2q/SGq+bcW8y+ToVudjwv2mMo NuG/+3Vmh1vPLf9XYaUbZ46LEo/WFFi2e3jqg6zQJWqkU13M2bBcGhxD1QRHelvni9w6 SKVk7/nEUOJggQxE45fZIn6hK30S+/zKM3UmajreQq3VbFXeLpLewDNWa8DjzJdQZI1p isDU84B+XF/EIIyt51aGLJf04PkOy77EUXBWtOSKfZz0ueXDiz0Dzx2M2Jq34bXCN+wu Vu7vi1PZd942PYvPQbjjicQOGXJi+KXg02MjbTNSPHvrFZ5wm7wFSq69vN0GMpBH8fZm t8Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=luHILmpayWC+6v8dau2pLJT5kSC6ehZZmWEZBYxxT+0=; b=ODa1IwPU0kJQdMT6oVx2CfObRu59J2Vd+c1vjLoVn/XI9Ach/gAXkmblNLsrnaKfAg OXcCyvzm1KlT+iYwMrNC2aX5eo71QeVs9KMOz+QyR3/Hf9cm73pnrvUxalTn32yI3A2t QVhEhFK9vOg1C2gWaKKsoBQpqxEmvd5a14zpPYmsdnPZ806hB6rdJvwzQKyf4KiWZn4F H4rna2gtBZYJIiDNfuux9x/8/6Vl4RhcNrLfq59CPP/dDqa1jXHf4OdyRYhvBq8famjV a5jqc+GPRLI89eIkZqpgXGKjFaEIGC697tLLZ9FK83j27IMT7JuA3ZTKZp2TMQHotqDs nXrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=ijJPXqb9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ge13-20020a170907908d00b00871a4e8d7c2si6090032ejb.1007.2023.01.25.07.11.17; Wed, 25 Jan 2023 07:11:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=ijJPXqb9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235551AbjAYPHh (ORCPT + 99 others); Wed, 25 Jan 2023 10:07:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235059AbjAYPHf (ORCPT ); Wed, 25 Jan 2023 10:07:35 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14D8A23674 for ; Wed, 25 Jan 2023 07:07:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1674659245; bh=3kVFSj9F5r4zxQcKbBTyYKgIq05zuwPxG6KbVQ++e3g=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=ijJPXqb9T9rNuYug9wDmBjZNcoI7knQGv8uhpPu+63nu+Scs9p8fYO64+AHMrkdJw 2hMEv2cUyhkIYyYKWWdSmFP6WRIHhgWibdJ96z0Uzi+3QmMsPdDM1iwhLzm/ba//Yr 5e3iaPKb81ODwt4zzBRTTxWkaerko2Z6dcXhC0Zc= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Wed, 25 Jan 2023 16:07:24 +0100 (CET) X-EA-Auth: P9eRXJcvULD/LlNSEoxED6IvPVWZxGaHOnHgLK9K0jZ0NU4zvHdVexZOWXhZmyT1B6y9xTnZegI4FpF4U7FiqDfX7yUYLlBh Date: Wed, 25 Jan 2023 20:37:14 +0530 From: Deepak R Varma To: Ben Skeggs , Karol Herbst , Lyude Paul , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH] drm/nouveau/devinit: Convert function disable() to be void Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756007762612848589?= X-GMAIL-MSGID: =?utf-8?q?1756007762612848589?= 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 Reviewed-by: Lyude Paul --- Please note: The change is compile build tested only. drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c | 3 ++- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g84.c | 5 +---- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g98.c | 4 +--- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c | 4 +--- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c | 4 +--- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gt215.c | 4 +--- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/mcp89.c | 4 +--- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c | 5 +---- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/priv.h | 2 +- 10 files changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c index dd4981708fe4..3d9319c319c6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c @@ -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; } diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g84.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g84.c index c224702b7bed..00df7811dd10 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g84.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g84.c @@ -26,13 +26,12 @@ #include #include -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 diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g98.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g98.c index 8977483a9f42..54bee499b982 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g98.c @@ -26,7 +26,7 @@ #include #include -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 diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c index 5b7cb1fe7897..5368e705e7fd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c @@ -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 diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c index 8955af2704c7..7bcbc4895ec2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c @@ -26,7 +26,7 @@ #include #include -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 diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gt215.c index 3d0ab86c3115..dbca92318baf 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gt215.c @@ -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 diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/mcp89.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/mcp89.c index a9cdf2411187..a24bd2e7d7ce 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/mcp89.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/mcp89.c @@ -26,7 +26,7 @@ #include #include -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 diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c index 380995d398b1..07ed8fd778b2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c @@ -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 diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h index 987a7f478b84..8de409c084c1 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h @@ -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); diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/priv.h index dd8b038a8cee..a648482d06e9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/priv.h @@ -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 *,