diff mbox series

[v2] tpm/tpm_ftpm_tee: add shutdown call back

Message ID 20191014202135.429009-1-pasha.tatashin@soleen.com (mailing list archive)
State New, archived
Headers show
Series [v2] tpm/tpm_ftpm_tee: add shutdown call back | expand

Commit Message

Pasha Tatashin Oct. 14, 2019, 8:21 p.m. UTC
add shutdown call back to close existing session with fTPM TA
to support kexec scenario.

Signed-off-by: Thirupathaiah Annapureddy <thiruan@microsoft.com>
Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
---
 drivers/char/tpm/tpm_ftpm_tee.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Jarkko Sakkinen Oct. 16, 2019, 3:12 p.m. UTC | #1
On Mon, Oct 14, 2019 at 04:21:35PM -0400, Pavel Tatashin wrote:
> add shutdown call back to close existing session with fTPM TA
> to support kexec scenario.

Sentences start in English with a capital letter :-)

> 
> Signed-off-by: Thirupathaiah Annapureddy <thiruan@microsoft.com>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
> ---
>  drivers/char/tpm/tpm_ftpm_tee.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
> index 6640a14dbe48..ad16ea555e97 100644
> --- a/drivers/char/tpm/tpm_ftpm_tee.c
> +++ b/drivers/char/tpm/tpm_ftpm_tee.c
> @@ -328,6 +328,19 @@ static int ftpm_tee_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +/**
> + * ftpm_tee_shutdown - shutdown the TPM device

A function name has to have parentheses in kdoc. I know this not
consistently done in the subsystem ATM but this is what is documented
here:

https://www.kernel.org/doc/Documentation/kernel-doc-nano-HOWTO.txt

/Jarkko
Pasha Tatashin Oct. 16, 2019, 4:31 p.m. UTC | #2
On Wed, Oct 16, 2019 at 11:12 AM Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:
>
> On Mon, Oct 14, 2019 at 04:21:35PM -0400, Pavel Tatashin wrote:
> > add shutdown call back to close existing session with fTPM TA
> > to support kexec scenario.
>
> Sentences start in English with a capital letter :-)
>

OK

*
> > + * ftpm_tee_shutdown - shutdown the TPM device
>
> A function name has to have parentheses in kdoc. I know this not
> consistently done in the subsystem ATM but this is what is documented
> here:
>
> https://www.kernel.org/doc/Documentation/kernel-doc-nano-HOWTO.txt
>

OK.

A new version is sent out.

Pasha
diff mbox series

Patch

diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
index 6640a14dbe48..ad16ea555e97 100644
--- a/drivers/char/tpm/tpm_ftpm_tee.c
+++ b/drivers/char/tpm/tpm_ftpm_tee.c
@@ -328,6 +328,19 @@  static int ftpm_tee_remove(struct platform_device *pdev)
 	return 0;
 }
 
+/**
+ * ftpm_tee_shutdown - shutdown the TPM device
+ * @pdev: the platform_device description.
+ */
+static void ftpm_tee_shutdown(struct platform_device *pdev)
+{
+	struct ftpm_tee_private *pvt_data = dev_get_drvdata(&pdev->dev);
+
+	tee_shm_free(pvt_data->shm);
+	tee_client_close_session(pvt_data->ctx, pvt_data->session);
+	tee_client_close_context(pvt_data->ctx);
+}
+
 static const struct of_device_id of_ftpm_tee_ids[] = {
 	{ .compatible = "microsoft,ftpm" },
 	{ }
@@ -341,6 +354,7 @@  static struct platform_driver ftpm_tee_driver = {
 	},
 	.probe = ftpm_tee_probe,
 	.remove = ftpm_tee_remove,
+	.shutdown = ftpm_tee_shutdown,
 };
 
 module_platform_driver(ftpm_tee_driver);