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: 516728 Delivered-To: patches@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp392920iml; Wed, 3 Nov 2021 02:03:05 -0700 (PDT) X-Received: by 2002:ac2:4835:: with SMTP id 21mr23350639lft.604.1635930185043; Wed, 03 Nov 2021 02:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635930185; cv=none; d=google.com; s=arc-20160816; b=bn8GEz4q/I1/t63OJXGksf3PF98J1BDVIy0sKnYkgrDkLeSZVF6n1Axg8i91xcbDFm MMYKgfoZM0e3Ma8+iB5lF0zLUiIPy1fJkzSe5sd19k6GAJKcQDHaOwWPvMcdfPYUPwVM zzdkY5EtE0aOmfE2RC04/AwCSMZic6/lPQCyzyRk6ADEwAz6prpJWbmY7uCccSF4UFYL oEcm7FU0GiywyjqKwVp3fTqBye9vc9etLKPdFfcJocq+orRpaV+FVxEQG/NCBmAlM0ls FhB198He5CNTOkH+mP944eCO0uImJMkvTpfXqBHD7j6IpW2cMHfL2TdgAviin2bfRB3C EsLQ== 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=Uu0GojA7iVM+cC4PX92tZZIaNF6pTxSNwkiN9StfQEWPQEVnu5YGdH5cYGheAgH3fZ XOCiAdDbb603bGF1vNfcRnjqxKZhtKY95onIWAcjDsS4NrJs3174srylCKNP1EUBD3h2 gea2MuF4FMqZE8ygO08jtPgu+VK++/5O6sDRi+Rhcs38AHKnJFwToaQ+es/Ju1zFq9E9 J36qNvLHKvVUNbqTK5kKgp64wcxDjlLsR3pW3apurYyYMJgYhh1Qy/THv83nquF5GvEW Pd90/4mj9hXfhphG23H2dKHAfIWmrwf8gAETy/Q9SPxHnnIQiyh+yWX1rnRNUDklVXLz K1TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LtXm3dA7; 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 t19sor334890lfr.161.2021.11.03.02.03.04 for (Google Transport Security); Wed, 03 Nov 2021 02:03:05 -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=LtXm3dA7; 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=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=OrfhiZrx0ReGIFyHJxUYdTmcjL/e6PKj495F8ZpmaPjnmbmGxAenHJkU8ETAHlCPDD 1FqY+UhWKrS1VK0j61YZt2a1Gvta6DIUOnvZVlInV+nwr3HrRW/qiqSIiR13srSTcLIA wut4zF9QvRym/3hO3Q7pVkEfNIcjtrlg7Wxpw6vw7wpSrG/2v2UZDXbu5muQSELaSIdj OZmXABY8MniceDwmuhv8Wdt2jNXk0nICGqMUYKcGyUgdKiAoDA67Ux7yk0xbdfg68l9i XtUC/Lnuzk+n5DuZ5A2rM+bvnai5oBOp+bqEq/JKojeTwbLlFoLPfgsSmGR2v/RE6kbb bbbQ== X-Gm-Message-State: AOAM5312jVbwQCAJUthS05LpjDIxifCbk5C7ARIgsas5XvQczPvXTRwN ZLiTVa/ir6SuttotI6YghDfTqwe8 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) 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 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 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*/