From patchwork Wed Oct 6 07:15:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 515302 Delivered-To: patches@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp232074imy; Wed, 6 Oct 2021 00:16:01 -0700 (PDT) X-Received: by 2002:ac2:5fe3:: with SMTP id s3mr2656694lfg.385.1633504560799; Wed, 06 Oct 2021 00:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633504560; cv=none; d=google.com; s=arc-20160816; b=ydGQugliyIdwFFVtb1cgxJRnG5ug12nc8zFGhCHTArXRRvu0W/C6YiUFBZep5yMkpv nXGzTy3EE2EU0tdBK+tQClm6UQqzbkSMOQ6HRwBGmTrAb4JIcPMmX1UWYMvWM9p8xf2P jw7DFKlV7nzeGMGR0f/xqz80TMb0S6hxV9+IJuBm1rpeMnlkP2Z/fNdYP4vzbg41DZds 7e/zy+UbFCZoTX2ZaV3kkjZgq0F5+jJbrIMRUWgi8BO0U4ZtOQxcE/DqwAbz60Pkk2mV lGKATFNOflD0OZoMSMWhXKW6f5yes2k1vU53XptuBp8kPVZHsva5dt2mPVvfaSLPrPXL mgYw== 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=G+uudF1elXgj2CYRAAhjhZzuZ2zqS9rHSGsbl2nlFFY=; b=Fg6zL/QWTMbqjus3jRNjCWjo9/szwJrUkWA3vSaDKVR8MaHy/DGB4kN4Z/cTDdkCkM czeEnuftMRB2GNDHScxfI419aEfFGQaFaUJvaXvLn7IAW481rZyfj+Q6G+SmwKxiLHoS y5w+C5Iom7ci9zvYhNb9YYwFpmHWPP62D2DBUxpONlg3jURrmYsm5rkI8zYpOsURxOV0 kyRj/hTumNp4O+i1PmnDRQfMV4ydq5pus//C74gSmqgWdZD7rKct3+223YfWKzaNy3kN P019UcjzDDH2iqnq2AbTcuoS7U3jBZ4KCXT7G21GsxDnJFoUvrpJ4Kn8ELzUvgiiK/7I Y/xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RlM9lc7C; 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 k6sor7152860ljq.68.2021.10.06.00.16.00 for (Google Transport Security); Wed, 06 Oct 2021 00:16:00 -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=RlM9lc7C; 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=G+uudF1elXgj2CYRAAhjhZzuZ2zqS9rHSGsbl2nlFFY=; b=RlM9lc7CB9JdOyTQ4MpXfKSPDtGKS7wFz07culpDMMYoAgsdu5TTGdBFAeBRwSyUCG LmRMkPZx4wKMMiZf5EDQvcgc3fLPj5mddxFnmakv9nn5aUpsMZNtxZaHemqAvkyWYWzt UWXjxQUZl7A0FVdws0zCpBxPtuHQOA5BhL4FHOXrqM9vWKK9lFpA6HqYwTHtwLlzAZD7 YCMDlm/XgTs6xmlJqFo3UJF567VMi5q7267KLROyK0Q/SFsToG8Rue7mDEhVnOYW89R5 ZIYb1RXmcao6GHNGHfXQHTt1HJC0hYLH2ME6DAWwk77ORxAKqzo/I2GrxuUI5qm5ujNk /61g== 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=G+uudF1elXgj2CYRAAhjhZzuZ2zqS9rHSGsbl2nlFFY=; b=dAh6oBRVi63ggVP9JDtykaT5QsNMXNzLmgrBopeRksV2yxbTisTI+fpcsd9iHS4jld 4VJi8A4TqT0xywusnadm2USz+2gQFQ8GAQuoZ3+cMdZ1MFJFloXz1LPyjAnffEVp3JrG Lv/meFzckyDCkInMo3FvTzZ74dTNn5FifvGF1iedIV8834LtDG29zPx3d/suWoZ5fzl2 XFBaAqKNjYC+EF0Si8z2Q6HSmhhv4+J4OAPoPrHVLGmCBtVuXlpwrtJVtmBaa5fzu4rD T16kN0hY9zc+TWeUkuZZtspWiuBo0ZzG7yNE3teslvk9yATwHzB1aS9oyrmZGACfH+4P 39pg== X-Gm-Message-State: AOAM533btynFEyGvx7J3ThZGCqlGYcoA7H0SYULfVT0POgf6xOCqduHi HdBl9JwriO0Jl6lvj/PJ1j4SrLjg X-Google-Smtp-Source: ABdhPJwf2FRNpTOXAY89XLRF5kXnJJw701ler3rWnJUuAKx7wE4mqyW0rOll/wLKeBRqtPuTgFgqEA== X-Received: by 2002:a2e:a791:: with SMTP id c17mr26518748ljf.509.1633504560446; Wed, 06 Oct 2021 00:16:00 -0700 (PDT) Return-Path: Received: from jade.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id y7sm960376lfk.143.2021.10.06.00.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 00:16:00 -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 Wiklander Subject: [PATCH v6 4/6] tee: export teedev_open() and teedev_close_context() Date: Wed, 6 Oct 2021 09:15:44 +0200 Message-Id: <20211006071546.2540920-5-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211006071546.2540920-1-jens.wiklander@linaro.org> References: <20211006071546.2540920-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. 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 3ebfea0781f1..26f42c4cd7a1 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -582,4 +582,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*/