i2c: simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
This commit is contained in:
parent
6c909b6e23
commit
84294c81a5
@ -109,15 +109,12 @@ EXPORT_SYMBOL_GPL(i2c_slave_event);
|
|||||||
bool i2c_detect_slave_mode(struct device *dev)
|
bool i2c_detect_slave_mode(struct device *dev)
|
||||||
{
|
{
|
||||||
if (IS_BUILTIN(CONFIG_OF) && dev->of_node) {
|
if (IS_BUILTIN(CONFIG_OF) && dev->of_node) {
|
||||||
struct device_node *child;
|
|
||||||
u32 reg;
|
u32 reg;
|
||||||
|
|
||||||
for_each_child_of_node(dev->of_node, child) {
|
for_each_child_of_node_scoped(dev->of_node, child) {
|
||||||
of_property_read_u32(child, "reg", ®);
|
of_property_read_u32(child, "reg", ®);
|
||||||
if (reg & I2C_OWN_SLAVE_ADDRESS) {
|
if (reg & I2C_OWN_SLAVE_ADDRESS)
|
||||||
of_node_put(child);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (IS_BUILTIN(CONFIG_ACPI) && ACPI_HANDLE(dev)) {
|
} else if (IS_BUILTIN(CONFIG_ACPI) && ACPI_HANDLE(dev)) {
|
||||||
dev_dbg(dev, "ACPI slave is not supported yet\n");
|
dev_dbg(dev, "ACPI slave is not supported yet\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user