diff mbox series

[U-Boot] dm: device: make power domain calls optional

Message ID 20190714191101.30467-1-agust@denx.de
State Accepted
Commit 44e02e39a91cd91aae5a28d90259d3a6996010bf
Delegated to: Simon Glass
Headers show
Series [U-Boot] dm: device: make power domain calls optional | expand

Commit Message

Anatolij Gustschin July 14, 2019, 7:11 p.m. UTC
Reduce power domain calls when CONFIG_POWER_DOMAIN is disabled.
With gcc v8.2, this change saves 104 bytes.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/core/device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Peng Fan July 15, 2019, 2:58 a.m. UTC | #1
> Subject: [PATCH] dm: device: make power domain calls optional
> 
> Reduce power domain calls when CONFIG_POWER_DOMAIN is disabled.
> With gcc v8.2, this change saves 104 bytes.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  drivers/core/device.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/core/device.c b/drivers/core/device.c index
> 0d15e5062b..8ec0f02bde 100644
> --- a/drivers/core/device.c
> +++ b/drivers/core/device.c
> @@ -388,7 +388,8 @@ int device_probe(struct udevice *dev)
>  	if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
>  		pinctrl_select_state(dev, "default");
> 
> -	if (dev->parent && device_get_uclass_id(dev) !=
> UCLASS_POWER_DOMAIN) {
> +	if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
> +	    device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
>  		if (!power_domain_get(dev, &pd))
>  			power_domain_on(&pd);

Reviewed-by: Peng Fan <peng.fan@nxp.com>

>  	}
> --
> 2.17.1
Simon Glass July 21, 2019, 1:50 a.m. UTC | #2
> Subject: [PATCH] dm: device: make power domain calls optional
>
> Reduce power domain calls when CONFIG_POWER_DOMAIN is disabled.
> With gcc v8.2, this change saves 104 bytes.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  drivers/core/device.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 0d15e5062b..8ec0f02bde 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -388,7 +388,8 @@  int device_probe(struct udevice *dev)
 	if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
 		pinctrl_select_state(dev, "default");
 
-	if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
+	if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
+	    device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
 		if (!power_domain_get(dev, &pd))
 			power_domain_on(&pd);
 	}