power-domain: Return 0 if ops unimplemented and remove empty functions
In case the ops is not implemented, return 0 in the core right away.
This is better than having multiple copies of functions which just
return 0 in each power domain driver. Drop all those empty functions.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Simon Glass <sjg@chromium.org>
diff --git a/drivers/power/domain/power-domain-uclass.c b/drivers/power/domain/power-domain-uclass.c
index 33f9206..0c5823c 100644
--- a/drivers/power/domain/power-domain-uclass.c
+++ b/drivers/power/domain/power-domain-uclass.c
@@ -71,7 +71,7 @@
return ret;
}
- ret = ops->request(power_domain);
+ ret = ops->request ? ops->request(power_domain) : 0;
if (ret) {
debug("ops->request() failed: %d\n", ret);
return ret;
@@ -91,7 +91,7 @@
debug("%s(power_domain=%p)\n", __func__, power_domain);
- return ops->rfree(power_domain);
+ return ops->rfree ? ops->rfree(power_domain) : 0;
}
int power_domain_on(struct power_domain *power_domain)
@@ -100,7 +100,7 @@
debug("%s(power_domain=%p)\n", __func__, power_domain);
- return ops->on(power_domain);
+ return ops->on ? ops->on(power_domain) : 0;
}
int power_domain_off(struct power_domain *power_domain)
@@ -109,7 +109,7 @@
debug("%s(power_domain=%p)\n", __func__, power_domain);
- return ops->off(power_domain);
+ return ops->off ? ops->off(power_domain) : 0;
}
#if CONFIG_IS_ENABLED(OF_REAL)