From patchwork Thu Jan 9 14:25:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe REYNES X-Patchwork-Id: 239323 List-Id: U-Boot discussion From: philippe.reynes at softathome.com (Philippe Reynes) Date: Thu, 9 Jan 2020 15:25:27 +0100 Subject: [PATCH 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> 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 Reviewed-by: Miquel Raynal Reviewed-by: Simon Glass --- include/tpm-common.h | 6 ++++++ 1 file changed, 6 insertions(+) Changelog: v2: - new patch, add an helper for tpm device (idea from Miquel) 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 */