Skip to content

Commit 1760eb6

Browse files
soleenJarkko Sakkinen
authored andcommitted
tpm/tpm_ftpm_tee: add shutdown call back
Add shutdown call back to close existing session with fTPM TA to support kexec scenario. Add parentheses to function names in comments as specified in kdoc. Signed-off-by: Thirupathaiah Annapureddy <[email protected]> Signed-off-by: Pavel Tatashin <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Tested-by: Sasha Levin <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent a9920d3 commit 1760eb6

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

drivers/char/tpm/tpm_ftpm_tee.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static const uuid_t ftpm_ta_uuid =
3232
0x82, 0xCB, 0x34, 0x3F, 0xB7, 0xF3, 0x78, 0x96);
3333

3434
/**
35-
* ftpm_tee_tpm_op_recv - retrieve fTPM response.
35+
* ftpm_tee_tpm_op_recv() - retrieve fTPM response.
3636
* @chip: the tpm_chip description as specified in driver/char/tpm/tpm.h.
3737
* @buf: the buffer to store data.
3838
* @count: the number of bytes to read.
@@ -61,7 +61,7 @@ static int ftpm_tee_tpm_op_recv(struct tpm_chip *chip, u8 *buf, size_t count)
6161
}
6262

6363
/**
64-
* ftpm_tee_tpm_op_send - send TPM commands through the TEE shared memory.
64+
* ftpm_tee_tpm_op_send() - send TPM commands through the TEE shared memory.
6565
* @chip: the tpm_chip description as specified in driver/char/tpm/tpm.h
6666
* @buf: the buffer to send.
6767
* @len: the number of bytes to send.
@@ -208,7 +208,7 @@ static int ftpm_tee_match(struct tee_ioctl_version_data *ver, const void *data)
208208
}
209209

210210
/**
211-
* ftpm_tee_probe - initialize the fTPM
211+
* ftpm_tee_probe() - initialize the fTPM
212212
* @pdev: the platform_device description.
213213
*
214214
* Return:
@@ -298,7 +298,7 @@ static int ftpm_tee_probe(struct platform_device *pdev)
298298
}
299299

300300
/**
301-
* ftpm_tee_remove - remove the TPM device
301+
* ftpm_tee_remove() - remove the TPM device
302302
* @pdev: the platform_device description.
303303
*
304304
* Return:
@@ -328,6 +328,19 @@ static int ftpm_tee_remove(struct platform_device *pdev)
328328
return 0;
329329
}
330330

331+
/**
332+
* ftpm_tee_shutdown() - shutdown the TPM device
333+
* @pdev: the platform_device description.
334+
*/
335+
static void ftpm_tee_shutdown(struct platform_device *pdev)
336+
{
337+
struct ftpm_tee_private *pvt_data = dev_get_drvdata(&pdev->dev);
338+
339+
tee_shm_free(pvt_data->shm);
340+
tee_client_close_session(pvt_data->ctx, pvt_data->session);
341+
tee_client_close_context(pvt_data->ctx);
342+
}
343+
331344
static const struct of_device_id of_ftpm_tee_ids[] = {
332345
{ .compatible = "microsoft,ftpm" },
333346
{ }
@@ -341,6 +354,7 @@ static struct platform_driver ftpm_tee_driver = {
341354
},
342355
.probe = ftpm_tee_probe,
343356
.remove = ftpm_tee_remove,
357+
.shutdown = ftpm_tee_shutdown,
344358
};
345359

346360
module_platform_driver(ftpm_tee_driver);

0 commit comments

Comments
 (0)