Re: [U-Boot] [PATCH v3 30/72] dm: gpio: sandbox: Use dev_read...() functions to access DT

2017-05-24 Thread sjg
Use the new dev_read...() functions to access the device tree, so that a
live tree can be used.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 drivers/gpio/sandbox.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

Applied to u-boot-dm
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 30/72] dm: gpio: sandbox: Use dev_read...() functions to access DT

2017-05-18 Thread Simon Glass
Use the new dev_read...() functions to access the device tree, so that a
live tree can be used.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 drivers/gpio/sandbox.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
index 0f22acb0e6..4f7b62eba0 100644
--- a/drivers/gpio/sandbox.c
+++ b/drivers/gpio/sandbox.c
@@ -198,10 +198,8 @@ static int sandbox_gpio_ofdata_to_platdata(struct udevice 
*dev)
 {
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-   uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-"num-gpios", 0);
-   uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
-"gpio-bank-name", NULL);
+   uc_priv->gpio_count = dev_read_u32_default(dev, "num-gpios", 0);
+   uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name");
 
return 0;
 }
@@ -210,10 +208,9 @@ static int gpio_sandbox_probe(struct udevice *dev)
 {
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-   if (dev_of_offset(dev) == -1) {
+   if (!dev_of_valid(dev))
/* Tell the uclass how many GPIOs we have */
uc_priv->gpio_count = CONFIG_SANDBOX_GPIO_COUNT;
-   }
 
dev->priv = calloc(sizeof(struct gpio_state), uc_priv->gpio_count);
 
-- 
2.13.0.303.g4ebf302169-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot