[PATCH v3 02/13] dm: core: Add a helper to retrieve devices through graph endpoints