Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2352245pxb; Mon, 20 Sep 2021 19:49:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfqrtyzYf/cR7P21/CxpCeZ0f305wFYF9TCaJHaphjtJMMfmN3nT+7SRzdfdk8Jih2ynLM X-Received: by 2002:a17:907:7348:: with SMTP id dq8mr32814862ejc.174.1632192555572; Mon, 20 Sep 2021 19:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192555; cv=none; d=google.com; s=arc-20160816; b=QFEO3mQkGmAlCVh+dtDed9UAVqY8nYuafMaQ2zgDhowjbTMNDWhlSXATlqloUDXSTO 9NBFz+iD9Xy6VCYDG5ZQAPtyUdpo3pNWCwu9nqivk3/FgxllX7qJnsMvetCsjYE2QuQ7 fNCNO+M/bSDtyRWNhvsjUW+pg4e9oabBXcbS/SX2SetAZOqgJKtQBDgCXWIQ7P/u7ane asETrkWrAGq1IMvAPsmuYb2Myo+DQVTED4dLkJkvQxNXBLcWMh/H2/hOHTemuHgZ+5JP SV/ffgsAn3Sg3zBazIbgyKPw+ph72U2zJqCcWNkSYbw3j1SscGDk7Q5yy61nrlAkfAQD ZF/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GJl2uTzUkJ3opGsRuMExfNiTbQAIeMHiwc1kxw1Ungs=; b=TGhcnR0lkwTjOh6R5DZ9KSgnpJFFKCHxCLErrR5JrGcDW2h7oc+R6GQzADGrtdIA3A eUForChfhYRKu4lq1+gGFjXTJy6ybNG2LNmHvJwpAs4iWBZix+v/+/Zo9SwYW0sFnN86 ifhdQV3iMgz5DtgKuxWTblHBH2X8Eo1j4Dmkys64Vkb7JZmmAuvAlPNjLyCdMqZGZJ5e romzm5JjBYUH+CLIcvrKNVYVHHw5FDFzI4wRrJWucB/avpQY61efLlh4SKS/U6WwbktU //HrL0lbwl4M8WJHKADLvm+rDpYP8E1UnYj8y9hl0e5g9SSxbT0MjO9mYO887ltkJv5o isbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TkRvemvT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs3si20955603ejc.368.2021.09.20.19.48.51; Mon, 20 Sep 2021 19:49:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TkRvemvT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344372AbhITSaO (ORCPT + 99 others); Mon, 20 Sep 2021 14:30:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:43180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378267AbhITSYV (ORCPT ); Mon, 20 Sep 2021 14:24:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4E4A961A7E; Mon, 20 Sep 2021 17:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158686; bh=/1p7iBhADNAkoLnetj2OnEFIcoCVQK2JPIY4M1vP1y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TkRvemvT4o0c2Zx0H2M5pdGJxf4mSi22+HN2DFntWcbwrIEKpCsNClLWNf3znmSbV n6TUwEFAnDLQgwkWT0fUZOvfbBhTM7IGcOVYo2NLXukVMVv7rXJAN4wEZ8SdkrGcJ6 UxEY5JYM9mdqLKpuf+tRzp06AA5bWDc7nl+zVxxw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Michael Walle , Marek Vasut , Christian Gmeiner Subject: [PATCH 5.10 010/122] drm/etnaviv: return context from etnaviv_iommu_context_get Date: Mon, 20 Sep 2021 18:43:02 +0200 Message-Id: <20210920163916.106979942@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lucas Stach commit 78edefc05e41352099ffb8f06f8d9b2d091e29cd upstream. Being able to have the refcount manipulation in an assignment makes it much easier to parse the code. Cc: stable@vger.kernel.org # 5.4 Signed-off-by: Lucas Stach Tested-by: Michael Walle Tested-by: Marek Vasut Reviewed-by: Christian Gmeiner Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 3 +-- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 3 +-- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 3 +-- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 6 ++---- drivers/gpu/drm/etnaviv/etnaviv_mmu.h | 4 +++- 5 files changed, 8 insertions(+), 11 deletions(-) --- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c @@ -397,8 +397,7 @@ void etnaviv_buffer_queue(struct etnaviv if (switch_mmu_context) { struct etnaviv_iommu_context *old_context = gpu->mmu_context; - etnaviv_iommu_context_get(mmu_context); - gpu->mmu_context = mmu_context; + gpu->mmu_context = etnaviv_iommu_context_get(mmu_context); etnaviv_iommu_context_put(old_context); } --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c @@ -305,8 +305,7 @@ struct etnaviv_vram_mapping *etnaviv_gem list_del(&mapping->obj_node); } - etnaviv_iommu_context_get(mmu_context); - mapping->context = mmu_context; + mapping->context = etnaviv_iommu_context_get(mmu_context); mapping->use = 1; ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj, --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -532,8 +532,7 @@ int etnaviv_ioctl_gem_submit(struct drm_ goto err_submit_objects; submit->ctx = file->driver_priv; - etnaviv_iommu_context_get(submit->ctx->mmu); - submit->mmu_context = submit->ctx->mmu; + submit->mmu_context = etnaviv_iommu_context_get(submit->ctx->mmu); submit->exec_state = args->exec_state; submit->flags = args->flags; --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1353,12 +1353,10 @@ struct dma_fence *etnaviv_gpu_submit(str } if (!gpu->mmu_context) { - etnaviv_iommu_context_get(submit->mmu_context); - gpu->mmu_context = submit->mmu_context; + gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context); etnaviv_gpu_start_fe_idleloop(gpu); } else { - etnaviv_iommu_context_get(gpu->mmu_context); - submit->prev_mmu_context = gpu->mmu_context; + submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); } if (submit->nr_pmrs) { --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.h @@ -105,9 +105,11 @@ void etnaviv_iommu_dump(struct etnaviv_i struct etnaviv_iommu_context * etnaviv_iommu_context_init(struct etnaviv_iommu_global *global, struct etnaviv_cmdbuf_suballoc *suballoc); -static inline void etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) +static inline struct etnaviv_iommu_context * +etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) { kref_get(&ctx->refcount); + return ctx; } void etnaviv_iommu_context_put(struct etnaviv_iommu_context *ctx); void etnaviv_iommu_restore(struct etnaviv_gpu *gpu,