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: 12584161 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 D0373C433EF for ; Tue, 26 Oct 2021 08:34:44 +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 A04ED60E75 for ; Tue, 26 Oct 2021 08:34:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A04ED60E75 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=K2maR4Wa9sqrdE I8I/xmO3qOZimed8whawKIW2CB1+vxXskVcfQUmkTvu6XPrnQA+1CaYxpz/v+60AxAAsdNNSugdSV rz0r+eDx4xGXqqbDiZd4/ZbsMJ1iSZ4opKOxR/kxE9bG7E7g65M5mxeqlpynWNfqJvkS8DdgzuytI gN8FJg5QX2ZXrYdZ+XIi1gm9uVZkt8zz0k3qfa+JOfKoloahcfo6MA+1pwG4ZWmydfJYYAMVC4ZHN JBOctlXUik3vx26gLnT9V1b8bY7nAyTetdj7JkBIfgD8KNhl8CkTkY8Wlr+O6+mDi/9/eRZphD5dY mh5tdTEqLzJGqq3o6Lhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfHt4-0012tF-2v; Tue, 26 Oct 2021 08:32:50 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfHs5-0012WA-DF for linux-arm-kernel@lists.infradead.org; Tue, 26 Oct 2021 08:31:50 +0000 Received: by mail-lf1-x12d.google.com with SMTP id y26so15460970lfa.11 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=uWCxMXa6V0GGZCksdu8/7ZTXOUsR/xU9DgRmUPtsd9yDuV+3a/SGiz1yPQ0qu3XKWP ePFbSeIjP6SKanOgP0wbnmRfKR0z2nbL800Y9VAkhD1r0QoIOGVutqXJFgGm07dPP4D0 Gdwo5EJwGRKauX0tOs5IPL5V+0ZYMjNILNTCT4mhzlqjfDB0TD/+4yWhINO4imVvNlQh +8b6pUHyLYMXdESMprDpakDqdktTOHt09Dk4fdAQePFxRmwTuE6RZ8SMR7TqI/NazpkY kYM28UWX1DdL0SayCIh/NoQ/xVzXSvgK1B/V047xrcrLLIHpgzRBRHuztCdYUiLV3YHS hMaQ== X-Gm-Message-State: AOAM530YJ2WhIqgoAGw1gXJ1DS+atg6OQPCRWVqkDmA7J9oTt5UvqvjY RyOFsb1XvqFmX2LYMaFqbNnTxw== 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) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211026_013149_509103_6DF01460 X-CRM114-Status: GOOD ( 15.48 ) 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*/