linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tpm: sleep at least <...> ms in tpm_msleep()
@ 2022-05-10 11:29 Johannes Holland
  2022-05-11 15:16 ` Jarkko Sakkinen
  2022-05-11 20:12 ` James Bottomley
  0 siblings, 2 replies; 12+ messages in thread
From: Johannes Holland @ 2022-05-10 11:29 UTC (permalink / raw)
  To: jarkko, linux-integrity, linux-kernel; +Cc: peterhuewe, jgg, Johannes Holland

To comply with protocol requirements, minimum polling times must often
be adhered to. Therefore, a macro like tpm_msleep() should sleep at
least the given amount of time (not up to the given period). Have
tpm_msleep() sleep at least the given number of milliseconds.

Signed-off-by: Johannes Holland <johannes.holland@infineon.com>
---
 drivers/char/tpm/tpm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 2163c6ee0d36..0971b55fffe3 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -185,8 +185,8 @@ int tpm_pm_resume(struct device *dev);
 
 static inline void tpm_msleep(unsigned int delay_msec)
 {
-	usleep_range((delay_msec * 1000) - TPM_TIMEOUT_RANGE_US,
-		     delay_msec * 1000);
+	usleep_range(delay_msec * 1000, (delay_msec * 1000)
+		     + TPM_TIMEOUT_RANGE_US);
 };
 
 int tpm_chip_start(struct tpm_chip *chip);
-- 
2.34.1


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

end of thread, other threads:[~2022-06-20 15:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 11:29 [PATCH] tpm: sleep at least <...> ms in tpm_msleep() Johannes Holland
2022-05-11 15:16 ` Jarkko Sakkinen
2022-05-12 12:21   ` Mimi Zohar
2022-05-12 12:32     ` James Bottomley
2022-05-12 16:52       ` Mimi Zohar
2022-05-16 17:57       ` Jarkko Sakkinen
2022-05-18 19:26         ` Nayna
2022-05-18 20:21           ` James Bottomley
2022-05-27 21:37             ` Ken Goldman
2022-05-16 17:54     ` Jarkko Sakkinen
2022-06-20 15:58       ` Stefan Mahnke-Hartmann
2022-05-11 20:12 ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).