tpm: add a helper to iterate on all tpm devices
authorPhilippe Reynes <philippe.reynes@softathome.com>
Thu, 9 Jan 2020 17:45:45 +0000 (18:45 +0100)
committerSimon Glass <sjg@chromium.org>
Thu, 6 Feb 2020 02:33:46 +0000 (19:33 -0700)
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@softathome.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
include/tpm-common.h

index f9c2ca20539b96884bcfffa5950f6ce647024340..702cd6e93b8b5d2cd000b2edeb2c8f0bae6fa46a 100644 (file)
@@ -293,4 +293,7 @@ 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) uclass_foreach_dev_probe(UCLASS_TPM, (dev))
+
 #endif /* __TPM_COMMON_H */