Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1117505pxb; Tue, 26 Oct 2021 03:07:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPfzgZAFC9jrU2338Py+dh4a51CaK7tz5Hv+Zo2W0SN/5whtwzDA23A9Kj/3NjeeXOfcG/ X-Received: by 2002:a17:906:3795:: with SMTP id n21mr25072049ejc.283.1635242870369; Tue, 26 Oct 2021 03:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635242870; cv=none; d=google.com; s=arc-20160816; b=vt4HyS5UzblWj8TTLSGXTrqOxRYbDAcc5TNUolZaPP6dz7SmTD7hhKTKk7e2/2UzgF 995qYpo9sV28C9PJAPhyS22lHvDhGflkR9tjjHNnhgwocFM9PHNPAGu5RazYd1ncT80s 7USz++jisHDFadKFP4465OGyTzj5BX2eDNoXCZdl2Lj4LFiaqKTo88wBpPhhEGwL9NWZ JyZPJMgyAtYjQaYuEdXIkoPrCMh/qZm0Pgm/ZJW+xGiEt1zNbrG0J8oDQfkRyeYLiCmD UyTsh26hfAWVhE+LKBX4KcYMAUNBwHRPrpZ5q5SOHN3iEc+WPJsaag9nIEvfALQuBBsF B3hA== 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 :dkim-signature; bh=VnwvHhRVfMlj7AENVrBuyzJTfXlbVoFinbin3zZfQAE=; b=kDMYk6xXDL5M5QtfYXcq1/mIYpVAOHZUZIN+l+SwJnwieUcj5v53GsSnQO1ukygap3 W41pQdi1SQ0Vk8jdnkD4ofD8A7fKwS/NPXVHUKfunLlu0ni2nb5wm/zfIF2nRrFcFCDu 7H24AwMhl0ijrZEb8+NFMUuMtXtjHpPYbj8uUNfaxTIRXsfH1mE4+ySS9kmXI6aMUT7A d9aC06PnWrsD2sq+VomwA1lywXVdgTwBVO/kpS7wBOSI74nTbIJRp+DKcsOV145tgpkf HjtInXM85UKjUQbB0dlOU8td/QYSKAi9AydCbb3gvmyr28UQ/dhjG7w9l5onEgfoldn0 cUEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HlhCbBvg; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id js9si5926399ejc.92.2021.10.26.03.07.27; Tue, 26 Oct 2021 03:07:50 -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=@linaro.org header.s=google header.b=HlhCbBvg; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234620AbhJZIef (ORCPT + 99 others); Tue, 26 Oct 2021 04:34:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234417AbhJZIeM (ORCPT ); Tue, 26 Oct 2021 04:34:12 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15640C061348 for ; Tue, 26 Oct 2021 01:31:49 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id j21so17391810lfe.0 for ; Tue, 26 Oct 2021 01:31:48 -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=HlhCbBvgrIkGCg1djRpWDkXzsRLtTYNU0f29cYtlhAZb//MvqQVuYdBTUlIX4qW0Bc 66vr73S8VKb4cRoAEdpQuTNyW1ARg7FO+tlqInkKrm0iCz/MZPDX3XE6MI6b+asXza0k kqjHyq4Wm2Sg/APuw6+N2zLxHTsfx4d+5Pv2A03T0A1ZDX1ZVa3nYvyXErVJVPdhf0PB Lr7bkjH8/Uxq9z2fzD/M76vPip9eAd+j7wTxJk5tBUqOR+DZsX/n92NZrafGWLOg6VTp lV21c0GG2IJXIlecWUpIJftdPUSgjNSIU/6dPuGKFHVGSVaK/cxVoL1LTUddogbspZmD u7jg== 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=RqsLeU+PNZpzWe8GNSeSzX6DjJBgf7bye3YV0fZmhH7KXmlrxTLwKHaYHK+blvWqiZ kaFIyqBEP1mrdw2N422Gs3YOqpEhwtlRgk/PaOG1/E0kqoC1BI9rpUcLC/A8qYXp3l3/ iewn++OSF9Mk71bWTWg2oVnaMu8S6SZKNio7Eox2ArsNg08IehK3rx5x/D8RqUzCUubW d53d0h79MIZCGqoG2kzKxRlL/C5MgyLx5pE10EqeRzGTMroVMZWDkQkrOwAQfnzkc4jh 0mK14KM9G7JF5YM/UCVTLcPPxXBtKRJiuJzDhMidjcFiM6he5iDyFsYu8Bhc0R81rnuk 9Slg== X-Gm-Message-State: AOAM533bLAAXSqoYNNsNlrAdBKToqIailhdvwt7P3jL4d9pu+uH4nuwf IHh2SbzGR0YMjpr2JUxYx9z7tKuroUXa9R79 X-Received: by 2002:ac2:5f5b:: with SMTP id 27mr5771459lfz.533.1635237107300; Tue, 26 Oct 2021 01:31:47 -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 e4sm1944598ljn.131.2021.10.26.01.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 01:31:47 -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 v7 4/6] tee: export teedev_open() and teedev_close_context() Date: Tue, 26 Oct 2021 10:31:36 +0200 Message-Id: <20211026083138.1818705-5-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211026083138.1818705-1-jens.wiklander@linaro.org> References: <20211026083138.1818705-1-jens.wiklander@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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*/ -- 2.31.1