| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * LED driver for Marvell 88PM860x |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2009 Marvell International Ltd. |
|---|
| 5 | 6 | * Haojian Zhuang <haojian.zhuang@marvell.com> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | | - * |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | |
|---|
| 13 | 9 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 122 | 118 | struct device_node *nproot, *np; |
|---|
| 123 | 119 | int iset = 0; |
|---|
| 124 | 120 | |
|---|
| 125 | | - if (!pdev->dev.parent->of_node) |
|---|
| 121 | + if (!dev_of_node(pdev->dev.parent)) |
|---|
| 126 | 122 | return -ENODEV; |
|---|
| 127 | | - nproot = of_get_child_by_name(pdev->dev.parent->of_node, "leds"); |
|---|
| 123 | + nproot = of_get_child_by_name(dev_of_node(pdev->dev.parent), "leds"); |
|---|
| 128 | 124 | if (!nproot) { |
|---|
| 129 | 125 | dev_err(&pdev->dev, "failed to find leds node\n"); |
|---|
| 130 | 126 | return -ENODEV; |
|---|
| 131 | 127 | } |
|---|
| 132 | | - for_each_child_of_node(nproot, np) { |
|---|
| 133 | | - if (!of_node_cmp(np->name, data->name)) { |
|---|
| 128 | + for_each_available_child_of_node(nproot, np) { |
|---|
| 129 | + if (of_node_name_eq(np, data->name)) { |
|---|
| 134 | 130 | of_property_read_u32(np, "marvell,88pm860x-iset", |
|---|
| 135 | 131 | &iset); |
|---|
| 136 | 132 | data->iset = PM8606_LED_CURRENT(iset); |
|---|