From patchwork Tue Apr 21 14:08:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 238199 List-Id: U-Boot discussion From: patrice.chotard at st.com (Patrice Chotard) Date: Tue, 21 Apr 2020 16:08:38 +0200 Subject: [PATCH v1 1/2] dm: core: give access to driver_check_compatible() In-Reply-To: <20200421140840.25729-1-patrice.chotard@st.com> References: <20200421140840.25729-1-patrice.chotard@st.com> Message-ID: <20200421140840.25729-2-patrice.chotard@st.com> driver_check_compatible() can be useful in particular case, give access to this primitive Signed-off-by: Patrice Chotard Cc: Jean-Jacques Hiblot --- drivers/core/lists.c | 6 +++--- include/dm/lists.h | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/core/lists.c b/drivers/core/lists.c index 68204c303f..c807cf8698 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -106,9 +106,9 @@ int device_bind_driver_to_node(struct udevice *parent, const char *drv_name, * @param compat: The compatible string to search for * @return 0 if there is a match, -ENOENT if no match */ -static int driver_check_compatible(const struct udevice_id *of_match, - const struct udevice_id **of_idp, - const char *compat) +int driver_check_compatible(const struct udevice_id *of_match, + const struct udevice_id **of_idp, + const char *compat) { if (!of_match) return -ENOENT; diff --git a/include/dm/lists.h b/include/dm/lists.h index 810e244d9e..7615f0ab38 100644 --- a/include/dm/lists.h +++ b/include/dm/lists.h @@ -44,6 +44,18 @@ struct uclass_driver *lists_uclass_lookup(enum uclass_id id); */ int lists_bind_drivers(struct udevice *parent, bool pre_reloc_only); +/** + * driver_check_compatible() - Check if a driver matches a compatible string + * + * @param of_match: List of compatible strings to match + * @param of_idp: Returns the match that was found + * @param compat: The compatible string to search for + * @return 0 if there is a match, -ENOENT if no match + */ +int driver_check_compatible(const struct udevice_id *of_match, + const struct udevice_id **of_idp, + const char *compat); + /** * lists_bind_fdt() - bind a device tree node *