All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown
@ 2017-01-14  0:09 ` Andrey Pronin
  0 siblings, 0 replies; 28+ messages in thread
From: Andrey Pronin @ 2017-01-14  0:09 UTC (permalink / raw)
  To: Peter Huewe, Marcel Selhorst, Jarkko Sakkinen
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	semenzato-F7+t8E8rja9g9hUCZPvPmw,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	groeck-F7+t8E8rja9g9hUCZPvPmw

Resetting TPM while processing a command may lead to issues
on the next boot. Ensure that we don't have any ongoing
commands, and that no further commands can be sent to the chip
by unregistering the device in the shutdown handler.
tpm_chip_unregister() waits for the completion of an ongoing
command, if any, and then clears out chip->ops and unregisters
sysfs entities.

Signed-off-by: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 drivers/char/tpm/tpm_i2c_infineon.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
index 62ee44e57ddc..0c829fe26561 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -689,14 +689,18 @@ static int tpm_tis_i2c_probe(struct i2c_client *client,
 	return rc;
 }
 
-static int tpm_tis_i2c_remove(struct i2c_client *client)
+static void tpm_tis_i2c_shutdown(struct i2c_client *client)
 {
 	struct tpm_chip *chip = tpm_dev.chip;
 
 	tpm_chip_unregister(chip);
 	release_locality(chip, tpm_dev.locality, 1);
 	tpm_dev.client = NULL;
+}
 
+static int tpm_tis_i2c_remove(struct i2c_client *client)
+{
+	tpm_tis_i2c_shutdown(client);
 	return 0;
 }
 
@@ -704,6 +708,7 @@ static struct i2c_driver tpm_tis_i2c_driver = {
 	.id_table = tpm_tis_i2c_table,
 	.probe = tpm_tis_i2c_probe,
 	.remove = tpm_tis_i2c_remove,
+	.shutdown = tpm_tis_i2c_shutdown,
 	.driver = {
 		   .name = "tpm_i2c_infineon",
 		   .pm = &tpm_tis_i2c_ops,
-- 
2.11.0.483.g087da7b7c-goog


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi

^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2017-01-25 18:59 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-14  0:09 [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown Andrey Pronin
2017-01-14  0:09 ` Andrey Pronin
     [not found] ` <20170114000954.17728-1-apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2017-01-14  0:28   ` Jason Gunthorpe
2017-01-14  0:28     ` Jason Gunthorpe
2017-01-14  0:42     ` Andrey Pronin
2017-01-16  9:33       ` Jarkko Sakkinen
2017-01-25 18:59         ` [tpmdd-devel] " Jarkko Sakkinen
2017-01-16 16:19       ` Jason Gunthorpe
     [not found]         ` <20170116161919.GA20238-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-17 17:58           ` Andrey Pronin
2017-01-17 17:58             ` Andrey Pronin
2017-01-17 19:27             ` Jason Gunthorpe
2017-01-17 19:27               ` Jason Gunthorpe
     [not found]               ` <20170117192728.GF27528-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-17 20:13                 ` Andrey Pronin
2017-01-17 20:13                   ` Andrey Pronin
2017-01-17 20:59                   ` Jason Gunthorpe
2017-01-17 20:59                     ` Jason Gunthorpe
     [not found]                     ` <20170117205933.GA9604-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-17 23:00                       ` Andrey Pronin
2017-01-17 23:00                         ` Andrey Pronin
2017-01-17 23:22                         ` Jason Gunthorpe
2017-01-17 23:22                           ` Jason Gunthorpe
     [not found]                           ` <20170117232207.GA12127-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-23 20:02                             ` Andrey Pronin
2017-01-23 20:02                               ` Andrey Pronin
2017-01-23 20:16                               ` [tpmdd-devel] " Andrey Pronin
2017-01-23 20:39                               ` Jason Gunthorpe
2017-01-23 20:39                                 ` Jason Gunthorpe
2017-01-23 22:19                                 ` Andrey Pronin
2017-01-23 22:57                                   ` Jason Gunthorpe
2017-01-23 22:57                                     ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.