.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * LEDs driver for Freescale MC13783/MC13892/MC34708 |
---|
3 | 4 | * |
---|
.. | .. |
---|
9 | 10 | * |
---|
10 | 11 | * Copyright (C) 2006-2008 Marvell International Ltd. |
---|
11 | 12 | * Eric Miao <eric.miao@marvell.com> |
---|
12 | | - * |
---|
13 | | - * This program is free software; you can redistribute it and/or modify |
---|
14 | | - * it under the terms of the GNU General Public License version 2 as |
---|
15 | | - * published by the Free Software Foundation. |
---|
16 | 13 | */ |
---|
17 | 14 | |
---|
18 | 15 | #include <linux/module.h> |
---|
.. | .. |
---|
124 | 121 | if (!pdata) |
---|
125 | 122 | return ERR_PTR(-ENOMEM); |
---|
126 | 123 | |
---|
127 | | - parent = of_get_child_by_name(dev->parent->of_node, "leds"); |
---|
| 124 | + parent = of_get_child_by_name(dev_of_node(dev->parent), "leds"); |
---|
128 | 125 | if (!parent) |
---|
129 | 126 | goto out_node_put; |
---|
130 | 127 | |
---|
.. | .. |
---|
134 | 131 | if (ret) |
---|
135 | 132 | goto out_node_put; |
---|
136 | 133 | |
---|
137 | | - pdata->num_leds = of_get_child_count(parent); |
---|
| 134 | + pdata->num_leds = of_get_available_child_count(parent); |
---|
138 | 135 | |
---|
139 | 136 | pdata->led = devm_kcalloc(dev, pdata->num_leds, sizeof(*pdata->led), |
---|
140 | 137 | GFP_KERNEL); |
---|
.. | .. |
---|
143 | 140 | goto out_node_put; |
---|
144 | 141 | } |
---|
145 | 142 | |
---|
146 | | - for_each_child_of_node(parent, child) { |
---|
| 143 | + for_each_available_child_of_node(parent, child) { |
---|
147 | 144 | const char *str; |
---|
148 | 145 | u32 tmp; |
---|
149 | 146 | |
---|
.. | .. |
---|
195 | 192 | leds->master = mcdev; |
---|
196 | 193 | platform_set_drvdata(pdev, leds); |
---|
197 | 194 | |
---|
198 | | - if (dev->parent->of_node) { |
---|
| 195 | + if (dev_of_node(dev->parent)) { |
---|
199 | 196 | pdata = mc13xxx_led_probe_dt(pdev); |
---|
200 | 197 | if (IS_ERR(pdata)) |
---|
201 | 198 | return PTR_ERR(pdata); |
---|