]> git.sur5r.net Git - u-boot/blobdiff - drivers/power/pmic/lp873x.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / drivers / power / pmic / lp873x.c
index 307f96bad1b8fefce8961ceaf1e83a840c2b2aa1..432ad4cecf62404bf80fa893e1e5eec1dbb5f987 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2016 Texas Instruments Incorporated, <www.ti.com>
  * Keerthy <j-keerthy@ti.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -15,8 +14,6 @@
 #include <power/lp873x.h>
 #include <dm/device.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 static const struct pmic_child_info pmic_children_info[] = {
        { .prefix = "ldo", .driver = LP873X_LDO_DRIVER },
        { .prefix = "buck", .driver = LP873X_BUCK_DRIVER },
@@ -27,7 +24,7 @@ static int lp873x_write(struct udevice *dev, uint reg, const uint8_t *buff,
                          int len)
 {
        if (dm_i2c_write(dev, reg, buff, len)) {
-               error("write error to device: %p register: %#x!", dev, reg);
+               pr_err("write error to device: %p register: %#x!", dev, reg);
                return -EIO;
        }
 
@@ -37,7 +34,7 @@ static int lp873x_write(struct udevice *dev, uint reg, const uint8_t *buff,
 static int lp873x_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 {
        if (dm_i2c_read(dev, reg, buff, len)) {
-               error("read error from device: %p register: %#x!", dev, reg);
+               pr_err("read error from device: %p register: %#x!", dev, reg);
                return -EIO;
        }
 
@@ -46,15 +43,13 @@ static int lp873x_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
 
 static int lp873x_bind(struct udevice *dev)
 {
-       int regulators_node;
-       const void *blob = gd->fdt_blob;
+       ofnode regulators_node;
        int children;
-       int node = dev->of_offset;
-
-       regulators_node = fdt_subnode_offset(blob, node, "regulators");
 
-       if (regulators_node <= 0) {
-               printf("%s: %s reg subnode not found!", __func__, dev->name);
+       regulators_node = dev_read_subnode(dev, "regulators");
+       if (!ofnode_valid(regulators_node)) {
+               debug("%s: %s regulators subnode not found!", __func__,
+                     dev->name);
                return -ENXIO;
        }