From patchwork Tue Oct 26 08:31:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 516172 Delivered-To: patches@linaro.org Received: by 2002:ac0:c404:0:0:0:0:0 with SMTP id t4csp50598imj; Tue, 26 Oct 2021 01:31:47 -0700 (PDT) X-Received: by 2002:ac2:4191:: with SMTP id z17mr21205933lfh.15.1635237107632; Tue, 26 Oct 2021 01:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635237107; cv=none; d=google.com; s=arc-20160816; b=FKoDHq5H2YTa4K/nbj0ihnXuC/IOReh7X2Hl/NmEIcoyVU0eTeZ+oHo4SO7MulqZJA n/iQrHouJd6MUmhxafgp/PzU0magWbg9T34xJkgCx53MsuzQohZ6coQyNrqCZuKgGPWo YOTgT8rignu79wMC/vTf69kTKwdcQ0sHAYoraRUwZJ/NmpIObFAz0nT4/YZPpySQiNiZ FNZxQd7zSIDTAZf0JRqyfhYo7DoiGvTl8V0Nig8sB6cWDqJpgKOeBibQhBF1dNxlDRpE y6u4Or8w4MGwZiXFfReAaBaNEqsrVLIx/m6/eqhFXQG7kTde123b7vtqChwnMkLvyxnh puiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=VnwvHhRVfMlj7AENVrBuyzJTfXlbVoFinbin3zZfQAE=; b=xN186Sof3jEP49EMZVYUGntZiu2vOOApoaqdGR7AHV/6cpM1rugYM+5dBn7X/RIZui JXGm7fzpyGUNUaqCQbmMNh7BDmAyMneYufxVDrrfc/UDWBXeMLcCCiKtmx2RmdFwYDgJ Y1//de3G+k2bIN2JXNi9uKBeg/63+iZniH8ZJGz9x/eS2HLv5oHWJ5uKTV6zGIKMY/SD FexkT4rGC+DS6ey1XF1ivMZZ+K+HMKxBzEa9l9pY6Lz8zNx8DtKMtub4P8SwkzGfaK4e WzD4oryVcvvarb9hCFXlOShB/rzc7hF41FoW7dMsE4XHsU9S1K1G/1z4N9MLEVJGCFzZ OCRA== 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 jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id bt14sor4706965lfb.83.2021.10.26.01.31.47 for (Google Transport Security); Tue, 26 Oct 2021 01:31:47 -0700 (PDT) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HlhCbBvg; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=KRHBiWhHaNEkQAPV0NNk1hB8Mm6tlPP1qNu8Hgv6dZfyG7mFXk8JGWmgX+UKTlHgro qWn00V0S9wSubm0nviWewr57tJ7XN28MiSIw0vD2uVcFLfm6lzYY3oLNrKfoeG+vkDA2 dpml/AWx7aPE0d0NwEbsojTTD+EgdfqkW4aw1WDyMbOaHvcz1Kgt3GxqysU+PprztK5m e7e/RQsv+g/Fjv2sm3/5qGaYGW0dFNmVLQir4xbGhqP0R4/Ex+zJDI3gjp/bEJgxBa6J DIMj8vbF31C0lYD66DS35G/9cY1J1T8LMXHRLSchG6ZrMiSo6UfN/q+3ohxBS+E/YlFT UuXg== X-Gm-Message-State: AOAM533V5l7+dXpZHeN5DwSXI/FylHW3Tv44NasNLba8cCQPhAXq5eV/ Vp4pgCk1s7UMmZUAnmaz691PGW7g X-Google-Smtp-Source: ABdhPJy1V5ePLyFsEykRiNDIva60ljVqUxt+Vxrkc1XfzFeV0fwu7COBhYLYbfWLdc5pxmhknEqrVw== X-Received: by 2002:ac2:5f5b:: with SMTP id 27mr5771459lfz.533.1635237107300; Tue, 26 Oct 2021 01:31:47 -0700 (PDT) Return-Path: 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 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(-) -- 2.31.1 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*/