[rtems commit] bsp/imx: Fix I2C registration with path
Sebastian Huber
sebh at rtems.org
Fri Oct 6 11:02:38 UTC 2017
Module: rtems
Branch: master
Commit: b39cda6ca4a55070078df5ff11256c20fd8bc6de
Changeset: http://git.rtems.org/rtems/commit/?id=b39cda6ca4a55070078df5ff11256c20fd8bc6de
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Oct 6 12:03:03 2017 +0200
bsp/imx: Fix I2C registration with path
Update #3090.
---
c/src/lib/libbsp/arm/imx/i2c/imx-i2c.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/c/src/lib/libbsp/arm/imx/i2c/imx-i2c.c b/c/src/lib/libbsp/arm/imx/i2c/imx-i2c.c
index eec1a2e..7633c7a 100644
--- a/c/src/lib/libbsp/arm/imx/i2c/imx-i2c.c
+++ b/c/src/lib/libbsp/arm/imx/i2c/imx-i2c.c
@@ -400,17 +400,23 @@ static int imx_i2c_init(imx_i2c_bus *bus)
return 0;
}
-int i2c_bus_register_imx(const char *bus_path, const char *alias)
+int i2c_bus_register_imx(const char *bus_path, const char *alias_or_path)
{
const void *fdt;
+ const char *path;
int node;
imx_i2c_bus *bus;
int eno;
fdt = bsp_fdt_get();
- alias = fdt_get_alias(fdt, alias);
+ path = fdt_get_alias(fdt, alias_or_path);
- if (alias == NULL) {
+ if (path == NULL) {
+ path = alias_or_path;
+ }
+
+ node = fdt_path_offset(fdt, path);
+ if (node < 0) {
rtems_set_errno_and_return_minus_one(ENXIO);
}
@@ -419,7 +425,6 @@ int i2c_bus_register_imx(const char *bus_path, const char *alias)
return -1;
}
- node = fdt_path_offset(fdt, alias);
bus->regs = imx_get_reg_of_node(fdt, node);
bus->irq = imx_get_irq_of_node(fdt, node, 0);
More information about the vc
mailing list