Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1974102rwe; Fri, 2 Sep 2022 06:50:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR4YTycWos69BnsWHCyO7wNnMUaPDAlTXrsdBaq7f0Er/tmcpQ+p6hS1oqZeheuXMQCqTiHU X-Received: by 2002:a63:fb56:0:b0:429:983f:b91e with SMTP id w22-20020a63fb56000000b00429983fb91emr30992361pgj.399.1662126645943; Fri, 02 Sep 2022 06:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662126645; cv=none; d=google.com; s=arc-20160816; b=0uf07p9SWrbL2MW1s3gnsxXMSFZPfxL0bB80F+xAPEmVI/F8raPXs6aiflAf+CWwgy sXJFarlZTJOUGFrO5aCg+HvZDJ0mHSgusSrT4eEBqNQLTMFELONXzVwoXF15ozmGdgcF o37pqIQl06lBWSOX9szvrOWoPItWHypFIk+fZeT4Ai74ZR9/i1eyjfltdhlk9qMFVGK0 H168F0s+g8BmKphq4VsI3etRmAVtL7lBOcRQ7LBcg4GTdzSd702CFqLLuSMdqL0QT92h Phfe4JpxtOgYUvmbYAhQieB1AMyrEifagpK7s7X0CALVOXipdT5uJTdS5j2Oyv3K7rAn p6uQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HjgTomXaSeGEK+wcQnRR6PHxtriTDb6W5C1GPzzicjo=; b=CowcbC7qEAlVdn4Y/rr710MY4e050H/yfhqf1r56AX1G1NNVGHfT/+gbaEvVk0AjGY tewaMtyE5VXpu1oW8l5v8Taf08CORjEOWtPF/iTaDWx9XqeoAFdcSdBW/APmMvfTym9Z wfZJbVWWuxB6aU54y5S7s2ebpxevKVmlhjky2O3FFR7anMzvnj9tBhyV9WkjjUi0Gt+8 HGZEfaFzr4cJBxsSVq1OnlzXuMW7lKN7L3SYnLYGPmyvz7LO7wRdPfD4eb0crKTlkovm rK7m3jHgvS8JaXCUx6CKOu2lZavm4o8OumGtxlriPR/aj4IN8EBLwRI884TS6TuR3Orr wZMw== ARC-Authentication-Results: i=1; mx.google.com; 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=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a17090322c400b0016bf0216b67si2248007plg.401.2022.09.02.06.50.13; Fri, 02 Sep 2022 06:50:45 -0700 (PDT) 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; 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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238718AbiIBNFn (ORCPT + 99 others); Fri, 2 Sep 2022 09:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238670AbiIBNDW (ORCPT ); Fri, 2 Sep 2022 09:03:22 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CAC9710853B for ; Fri, 2 Sep 2022 05:41:56 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8CC1C1515; Fri, 2 Sep 2022 05:40:51 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EA7493F766; Fri, 2 Sep 2022 05:40:43 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org Cc: Sudeep Holla , Marc Bonnici , Achin Gupta , Jens Wiklander , Valentin Laurent , Lukas Hanel , Coboy Chen , Sumit Garg Subject: [PATCH v2 02/10] tee: optee: Drop ffa_ops in optee_ffa structure using ffa_dev->ops directly Date: Fri, 2 Sep 2022 13:40:24 +0100 Message-Id: <20220902124032.788488-3-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902124032.788488-1-sudeep.holla@arm.com> References: <20220902124032.788488-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Now that the ffa_device structure holds the pointer to ffa_dev_ops, there is no need to obtain the same through ffa_dev_ops_get(). Just use the ffa_dev->ops directly. Since the ffa_device itself carries ffa_dev_ops now, there is no need to keep a copy in optee_ffa structure. Drop ffa_ops in the optee_ffa structure as it is not needed anymore. Reviewed-by: Jens Wiklander Reviewed-by: Sumit Garg Signed-off-by: Sudeep Holla --- drivers/tee/optee/ffa_abi.c | 15 +++++---------- drivers/tee/optee/optee_private.h | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c index 7ab31740cff8..3d4079575ccd 100644 --- a/drivers/tee/optee/ffa_abi.c +++ b/drivers/tee/optee/ffa_abi.c @@ -271,8 +271,8 @@ static int optee_ffa_shm_register(struct tee_context *ctx, struct tee_shm *shm, unsigned long start) { struct optee *optee = tee_get_drvdata(ctx->teedev); - const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops; struct ffa_device *ffa_dev = optee->ffa.ffa_dev; + const struct ffa_dev_ops *ffa_ops = ffa_dev->ops; struct ffa_mem_region_attributes mem_attr = { .receiver = ffa_dev->vm_id, .attrs = FFA_MEM_RW, @@ -314,8 +314,8 @@ static int optee_ffa_shm_unregister(struct tee_context *ctx, struct tee_shm *shm) { struct optee *optee = tee_get_drvdata(ctx->teedev); - const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops; struct ffa_device *ffa_dev = optee->ffa.ffa_dev; + const struct ffa_dev_ops *ffa_ops = ffa_dev->ops; u64 global_handle = shm->sec_world_id; struct ffa_send_direct_data data = { .data0 = OPTEE_FFA_UNREGISTER_SHM, @@ -342,7 +342,7 @@ static int optee_ffa_shm_unregister_supp(struct tee_context *ctx, struct tee_shm *shm) { struct optee *optee = tee_get_drvdata(ctx->teedev); - const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops; + const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_dev->ops; u64 global_handle = shm->sec_world_id; int rc; @@ -529,8 +529,8 @@ static int optee_ffa_yielding_call(struct tee_context *ctx, struct optee_msg_arg *rpc_arg) { struct optee *optee = tee_get_drvdata(ctx->teedev); - const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops; struct ffa_device *ffa_dev = optee->ffa.ffa_dev; + const struct ffa_dev_ops *ffa_ops = ffa_dev->ops; struct optee_call_waiter w; u32 cmd = data->data0; u32 w4 = data->data1; @@ -793,11 +793,7 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev) u32 sec_caps; int rc; - ffa_ops = ffa_dev_ops_get(ffa_dev); - if (!ffa_ops) { - pr_warn("failed \"method\" init: ffa\n"); - return -ENOENT; - } + ffa_ops = ffa_dev->ops; if (!optee_ffa_api_is_compatbile(ffa_dev, ffa_ops)) return -EINVAL; @@ -821,7 +817,6 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev) optee->ops = &optee_ffa_ops; optee->ffa.ffa_dev = ffa_dev; - optee->ffa.ffa_ops = ffa_ops; optee->rpc_param_count = rpc_param_count; teedev = tee_device_alloc(&optee_ffa_clnt_desc, NULL, optee->pool, diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h index a33d98d17cfd..04ae58892608 100644 --- a/drivers/tee/optee/optee_private.h +++ b/drivers/tee/optee/optee_private.h @@ -111,7 +111,6 @@ struct optee_smc { */ struct optee_ffa { struct ffa_device *ffa_dev; - const struct ffa_dev_ops *ffa_ops; /* Serializes access to @global_ids */ struct mutex mutex; struct rhashtable global_ids; -- 2.37.3