mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
hwmon: (nct7802): 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: Jinjie Ruan <ruanjinjie@huawei.com> Message-ID: <20240822062956.3490387-6-ruanjinjie@huawei.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
bf0b61f0aa
commit
1d20db6b54
@ -1129,17 +1129,14 @@ static int nct7802_configure_channels(struct device *dev,
|
||||
{
|
||||
/* Enable local temperature sensor by default */
|
||||
u8 mode_mask = MODE_LTD_EN, mode_val = MODE_LTD_EN;
|
||||
struct device_node *node;
|
||||
int err;
|
||||
|
||||
if (dev->of_node) {
|
||||
for_each_child_of_node(dev->of_node, node) {
|
||||
for_each_child_of_node_scoped(dev->of_node, node) {
|
||||
err = nct7802_get_channel_config(dev, node, &mode_mask,
|
||||
&mode_val);
|
||||
if (err) {
|
||||
of_node_put(node);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user