aboutsummaryrefslogtreecommitdiff
path: root/drivers/clk/clk-uclass.c
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2019-08-01 19:12:55 +0530
committerTom Rini <trini@konsulko.com>2019-08-12 13:33:38 -0400
commitacbb7cd4d34caec36ff6d044a8f55325fa27459f (patch)
tree5e6a7ce2f65e365a906d16b702f9493535811242 /drivers/clk/clk-uclass.c
parent71cd80af863945e81f468c22e5e1afb06eba75cd (diff)
downloadu-boot-acbb7cd4d34caec36ff6d044a8f55325fa27459f.zip
u-boot-acbb7cd4d34caec36ff6d044a8f55325fa27459f.tar.gz
u-boot-acbb7cd4d34caec36ff6d044a8f55325fa27459f.tar.bz2
clk: add support for clk_is_match()
Add support for clk_is_match() which is required to know if two clock pointers point to the same exact physical clock. Also add a unit test for the new API. Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'drivers/clk/clk-uclass.c')
-rw-r--r--drivers/clk/clk-uclass.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index cee4d91..c66b6f3 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -518,6 +518,19 @@ int clk_get_by_id(ulong id, struct clk **clkp)
return -ENOENT;
}
+bool clk_is_match(const struct clk *p, const struct clk *q)
+{
+ /* trivial case: identical struct clk's or both NULL */
+ if (p == q)
+ return true;
+
+ /* same device, id and data */
+ if (p->dev == q->dev && p->id == q->id && p->data == q->data)
+ return true;
+
+ return false;
+}
+
UCLASS_DRIVER(clk) = {
.id = UCLASS_CLK,
.name = "clk",