diff mbox series

[V2,1/2] tpm: add a helper to iterate on all tpm devices

Message ID 1578579928-21160-1-git-send-email-philippe.reynes@softathome.com
State New
Headers show
Series [V2,1/2] tpm: add a helper to iterate on all tpm devices | expand

Commit Message

Philippe REYNES Jan. 9, 2020, 2:25 p.m. UTC
This add a helper for_each_tpm_device that run
through all the tpm (1.x and 2.0) devices.

Signed-off-by: Philippe Reynes <philippe.reynes at softathome.com>
---
 include/tpm-common.h | 6 ++++++
 1 file changed, 6 insertions(+)

Changelog:
v2:
- new patch, add an helper for tpm device (idea from Miquel)

Comments

Miquel Raynal Jan. 9, 2020, 2:32 p.m. UTC | #1
Hi Philippe,

Philippe Reynes <philippe.reynes at softathome.com> wrote on Thu,  9 Jan
2020 15:25:27 +0100:

> This add a helper for_each_tpm_device that run

I think it is either "This adds a helper" or "Add a helper". I think
the later is preferred.

                                             runs?

> through all the tpm (1.x and 2.0) devices.
> 
> Signed-off-by: Philippe Reynes <philippe.reynes at softathome.com>

With the above corrected,

Reviewed-by: Miquel Raynal <miquel.raynal at bootlin.com>

Thanks,
Miquèl
Simon Glass Jan. 10, 2020, 9:39 a.m. UTC | #2
On Fri, 10 Jan 2020 at 03:25, Philippe Reynes
<philippe.reynes at softathome.com> wrote:
>
> This add a helper for_each_tpm_device that run
> through all the tpm (1.x and 2.0) devices.
>
> Signed-off-by: Philippe Reynes <philippe.reynes at softathome.com>
> ---
>  include/tpm-common.h | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> Changelog:
> v2:
> - new patch, add an helper for tpm device (idea from Miquel)
>

Reviewed-by: Simon Glass <sjg at chromium.org>
diff mbox series

Patch

diff --git a/include/tpm-common.h b/include/tpm-common.h
index f9c2ca2..5b33f47 100644
--- a/include/tpm-common.h
+++ b/include/tpm-common.h
@@ -293,4 +293,10 @@  static inline cmd_tbl_t *get_tpm2_commands(unsigned int *size)
  */
 enum tpm_version tpm_get_version(struct udevice *dev);
 
+/* Iterate on all TPM devices */
+#define for_each_tpm_device(dev)			\
+	for (uclass_first_device(UCLASS_TPM, &(dev));	\
+	     (dev);					\
+	     uclass_next_device(&(dev)))
+
 #endif /* __TPM_COMMON_H */