From patchwork Wed Nov 3 09:02:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 12600441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 873F4C433F5 for ; Wed, 3 Nov 2021 09:05:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B052610FC for ; Wed, 3 Nov 2021 09:05:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5B052610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5beSQiNzLvtKQ+og1PJ/Otd9GDZYEEN7F0s0GVN76lU=; b=WgyLQJyKSFudxD KbvHNieTSryrO6iXka8+BpphIctM4V27DrM1ODAcs7hsW8NdI86hGF/gotC1Kr66AIrPcLeNxuqlX BvcoHTDd746m7ifGerCPO0jZcHRt3yZLv57mL59sROq7anbiS9XCv1sITp9UjDcUVYhhpHUGwXB3w i860MuoZb4LYXqZdA2r3iLiS5l3TKZ4cXGE6cWiKIbXSs9GRTgaOPHcjWqJuPpIVjzOfDbDy9SaHL n9wVqELK4aDDcr5vr4DmwFWcI6b9pz778cQpgzkn9+0hCRpPLUvEw6AeS7SweCi7VZpxDzEFSIaCL vC4aYTD3SBD2nF7rwqPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miCBg-004cpU-H6; Wed, 03 Nov 2021 09:04:04 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1miCAk-004cOy-Mn for linux-arm-kernel@lists.infradead.org; Wed, 03 Nov 2021 09:03:08 +0000 Received: by mail-lf1-x129.google.com with SMTP id p16so3822697lfa.2 for ; Wed, 03 Nov 2021 02:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VnwvHhRVfMlj7AENVrBuyzJTfXlbVoFinbin3zZfQAE=; b=LtXm3dA7MQ6dUNvqq9edcqNrUoFg9/UAnmZ1CHv6+aujdVvSNJYsxYlqkNAWJnjFDu EuMwqGhcM2uwOWPAWym7ZlX2vNC196HRZJGPCmEv3YJdpFkmNguTHtCWf6SUo0OQ4itT ie9vQdfMVF91b5xD78Ql3AJmxrj7Gk2oisFYjqhN64yCjQpbX5E96on+mHhvN7K1JaBx f/FV3HmS7701JBzt0/RnV25Xi5cmuKr2h5FsvTd+ja0W2A1/GzYKXxSeBryXo4NF59yR iBm7v4ASoe+OG4Eh10bk7A7xK4BfO8fdJQxp1zcleOfExezfIxXJYSh8FIRqGKAOukxf tOXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VnwvHhRVfMlj7AENVrBuyzJTfXlbVoFinbin3zZfQAE=; b=Uh1LhDmL6f/cay/lM1guprimVfPIFK8ziiWEZiUe68f3YBlht2oJa0iYUFPSqG2Ncb Kuw7K4MmOq3BJ4neDXn6z7RKFunTj4v01dg6a8ivIcedJJu05gmaMxwKkQZaz4NIUIRC 9FgkwmPerG1q+9ynJG8n90I0STQQFeE0AGDgD4IFmZI8SA4VWV8hPosBwEuwoyQ27Nqc 6DKmgTq9bM6CxvQA+ohNCQZ1qBWDM5qh+eYZPP9W2sbD2S4xcnDBBqMxC0T9+I5Qwtu5 jmhZRKtFNOA02CPcuiEslTBSKKCSaH5tskB2yUzvmw/au2+Xm260wjdEmrTI2sY9tz31 SpGw== X-Gm-Message-State: AOAM530j8SmcCuSNJuB6kzylYeCh9ymt2gmqvE1lAPqsXNep0gHk9JWq DgDGl726T2a14wdi68ModSUiyA== X-Google-Smtp-Source: ABdhPJyAVI+qjX3kgLD2yOVvS/SSMgrb3OQm3fGGTr4NZa/pynv4ZVDjFADk2PIC4TobgYqrWzCJBg== X-Received: by 2002:a05:6512:31d2:: with SMTP id j18mr19318412lfe.229.1635930184683; Wed, 03 Nov 2021 02:03:04 -0700 (PDT) Received: from jade.urgonet (h-94-254-48-165.A175.priv.bahnhof.se. [94.254.48.165]) by smtp.gmail.com with ESMTPSA id w16sm124373lfr.233.2021.11.03.02.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 02:03:04 -0700 (PDT) From: Jens Wiklander To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org Cc: Jerome Forissier , Etienne Carriere , Sumit Garg , Vincent Guittot , Rob Herring , Jonathan Corbet , Ard Biesheuvel , Marc Zyngier , jens.vankeirsbilck@kuleuven.be, Jens Wiklander Subject: [PATCH v8 4/6] tee: export teedev_open() and teedev_close_context() Date: Wed, 3 Nov 2021 10:02:53 +0100 Message-Id: <20211103090255.998070-5-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211103090255.998070-1-jens.wiklander@linaro.org> References: <20211103090255.998070-1-jens.wiklander@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211103_020306_791042_372F2CA5 X-CRM114-Status: GOOD ( 15.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Exports the two functions teedev_open() and teedev_close_context() in order to make it easier to create a driver internal struct tee_context. Reviewed-by: Sumit Garg Signed-off-by: Jens Wiklander --- drivers/tee/tee_core.c | 6 ++++-- include/linux/tee_drv.h | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 85102d12d716..3fc426dad2df 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -43,7 +43,7 @@ static DEFINE_SPINLOCK(driver_lock); static struct class *tee_class; static dev_t tee_devt; -static struct tee_context *teedev_open(struct tee_device *teedev) +struct tee_context *teedev_open(struct tee_device *teedev) { int rc; struct tee_context *ctx; @@ -70,6 +70,7 @@ static struct tee_context *teedev_open(struct tee_device *teedev) return ERR_PTR(rc); } +EXPORT_SYMBOL_GPL(teedev_open); void teedev_ctx_get(struct tee_context *ctx) { @@ -96,13 +97,14 @@ void teedev_ctx_put(struct tee_context *ctx) kref_put(&ctx->refcount, teedev_ctx_release); } -static void teedev_close_context(struct tee_context *ctx) +void teedev_close_context(struct tee_context *ctx) { struct tee_device *teedev = ctx->teedev; teedev_ctx_put(ctx); tee_device_put(teedev); } +EXPORT_SYMBOL_GPL(teedev_close_context); static int tee_open(struct inode *inode, struct file *filp) { diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h index a1f03461369b..468a7d83dc6c 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -587,4 +587,18 @@ struct tee_client_driver { #define to_tee_client_driver(d) \ container_of(d, struct tee_client_driver, driver) +/** + * teedev_open() - Open a struct tee_device + * @teedev: Device to open + * + * @return a pointer to struct tee_context on success or an ERR_PTR on failure. + */ +struct tee_context *teedev_open(struct tee_device *teedev); + +/** + * teedev_close_context() - closes a struct tee_context + * @ctx: The struct tee_context to close + */ +void teedev_close_context(struct tee_context *ctx); + #endif /*__TEE_DRV_H*/