From patchwork Thu Aug 22 06:29:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13772679 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA21A136643 for ; Thu, 22 Aug 2024 06:22:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307756; cv=none; b=BjgEZMmdfNyMBYdTzpn/S7czzGeg6h+YwgS/B0UHivksoEdAh7XKOsmo8iuKsSEtRpfeHyZtIqtEtg+OApIq7BVrRnT9ejuj7Tre7NS3AqjtKaUqtvzhN/GhMgW5RAmxrVHrBzMnUAlJ27IR/3wLJs5aLpRc7LBf6DvioUA4CJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307756; c=relaxed/simple; bh=iEENZbCtIGoSS5zb7tD/8mwivYf8UZvRQnGcpB7oN7o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DemEI6R59yyCjDNLdfYol3KFPYXbAf4wVtS7XIkuNRTKHbeIjISzxLz/nM7tpx4Upv9tySamE6G6N4SpDgB4mdVEExUAIELE7/64TX1bbgyTuMPmP31ShEOWJeeBktR/RVsAbkjvR+ylBa6b6iKN7A6EF+oVITuYQmRVz3O5yO4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.255 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4WqClf0QGqz13bv7; Thu, 22 Aug 2024 14:21:50 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 171EC1800FF; Thu, 22 Aug 2024 14:22:30 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 22 Aug 2024 14:22:29 +0800 From: Jinjie Ruan To: , , , , , , CC: Subject: [PATCH -next 1/8] hwmon: (aspeed-g6-pwm-tacho): Simplify with scoped for each OF child loop Date: Thu, 22 Aug 2024 14:29:49 +0800 Message-ID: <20240822062956.3490387-2-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822062956.3490387-1-ruanjinjie@huawei.com> References: <20240822062956.3490387-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemh500013.china.huawei.com (7.202.181.146) Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan Reviewed-by: Andrew Jeffery --- drivers/hwmon/aspeed-g6-pwm-tach.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/aspeed-g6-pwm-tach.c b/drivers/hwmon/aspeed-g6-pwm-tach.c index 08a2ded95e45..75eadda738ab 100644 --- a/drivers/hwmon/aspeed-g6-pwm-tach.c +++ b/drivers/hwmon/aspeed-g6-pwm-tach.c @@ -456,7 +456,6 @@ static int aspeed_pwm_tach_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev, *hwmon; int ret; - struct device_node *child; struct aspeed_pwm_tach_data *priv; struct pwm_chip *chip; @@ -498,10 +497,9 @@ static int aspeed_pwm_tach_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "Failed to add PWM chip\n"); - for_each_child_of_node(dev->of_node, child) { + for_each_child_of_node_scoped(dev->of_node, child) { ret = aspeed_create_fan_monitor(dev, child, priv); if (ret) { - of_node_put(child); dev_warn(dev, "Failed to create fan %d", ret); return 0; } From patchwork Thu Aug 22 06:29:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13772682 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E77C139D05 for ; Thu, 22 Aug 2024 06:22:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307758; cv=none; b=gtcOuVz8JYsJZH9JebuLudVsFzcb3kVmPrwd5Cehst7y4NfdfFi04J1Bz+UHhULgb5UARtUkldoDcA2hEWqc2vzWj9iAVhiu8k8ucCDzsIRxfxDrazrQ1FPFnpBl4qPPoMNo6kr55XN0UO6MozS64AByZRLZZrbxGu3EIrnlPo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307758; c=relaxed/simple; bh=knOvrWTLKjpl/DrSBIpkjIWgtit+HoutsLiwT9GII7w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n5XjyAm1Qlkbe3MZKEjWcVNUt8A8BT8gTIxykbJXxWCjW0ORRNkxLhmdS19NyzX+AcMBo1x0uPG/ntxNbf9V6CH+O6fLCdFtLGrq5cFRSH6EE05xYb6k3ghUJpAE/T5qVtpn88FGHdQoQBHSdPtzGgxSsLGqLm1bVXhD63+Ibe4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4WqChk5fRbz1HGxl; Thu, 22 Aug 2024 14:19:18 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id B94171400FD; Thu, 22 Aug 2024 14:22:31 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 22 Aug 2024 14:22:31 +0800 From: Jinjie Ruan To: , , , , , , CC: Subject: [PATCH -next 2/8] hwmon: (aspeed-pwm-tacho): Simplify with scoped for each OF child loop Date: Thu, 22 Aug 2024 14:29:50 +0800 Message-ID: <20240822062956.3490387-3-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822062956.3490387-1-ruanjinjie@huawei.com> References: <20240822062956.3490387-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemh500013.china.huawei.com (7.202.181.146) Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan Reviewed-by: Andrew Jeffery --- drivers/hwmon/aspeed-pwm-tacho.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c index 4acc1858d8ac..aa159bf158a3 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c @@ -907,7 +907,7 @@ static void aspeed_pwm_tacho_remove(void *data) static int aspeed_pwm_tacho_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np, *child; + struct device_node *np; struct aspeed_pwm_tacho_data *priv; void __iomem *regs; struct device *hwmon; @@ -951,12 +951,10 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev) aspeed_create_type(priv); - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = aspeed_create_fan(dev, child, priv); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } priv->groups[0] = &pwm_dev_group; From patchwork Thu Aug 22 06:29:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13772683 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07CD6136E09 for ; Thu, 22 Aug 2024 06:22:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307758; cv=none; b=VvVp56uinijnJ9gdps/F8m2TFCLd1BoHIDH6DNyKRkW3k4hT6IhtfgDxm+6apMrWUXe+6LYZA5RbFL9NKgL9wTZz6fpr83lRoRitH3PXS0DTo6KkPGCcCKHvXLN4KWuYHX+XW5nx8PYuw5QYx3lVBN23+56T4TBndRLmB/qG4PI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307758; c=relaxed/simple; bh=nChb9StTz+kD6AjhpdLfarKf5QitGFIU99nAVFWo9Yk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YWK59J8qjlQ6LFYGipXtjcwTXpLzbTL8zlOT5YSFd9uKUZMswP8uY3ToBPeq8jMLw/ejrDn21f+T+PKpto7AuRa3kLeTWxbFDY8JOdD7Qld3s779NV/F7TMbHmh1gClw7oniN9nvd1Wba9oUk9gyv9kSPto7oMnucTDSSe9VlRA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WqCk75YBRzhY63; Thu, 22 Aug 2024 14:20:31 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id B30A11800D3; Thu, 22 Aug 2024 14:22:32 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 22 Aug 2024 14:22:32 +0800 From: Jinjie Ruan To: , , , , , , CC: Subject: [PATCH -next 3/8] hwmon: (ina3221): Simplify with scoped for each OF child loop Date: Thu, 22 Aug 2024 14:29:51 +0800 Message-ID: <20240822062956.3490387-4-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822062956.3490387-1-ruanjinjie@huawei.com> References: <20240822062956.3490387-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemh500013.china.huawei.com (7.202.181.146) Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan --- drivers/hwmon/ina3221.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c index f0053f87e3e6..1bf479a0f793 100644 --- a/drivers/hwmon/ina3221.c +++ b/drivers/hwmon/ina3221.c @@ -813,7 +813,6 @@ static int ina3221_probe_child_from_dt(struct device *dev, static int ina3221_probe_from_dt(struct device *dev, struct ina3221_data *ina) { const struct device_node *np = dev->of_node; - struct device_node *child; int ret; /* Compatible with non-DT platforms */ @@ -822,12 +821,10 @@ static int ina3221_probe_from_dt(struct device *dev, struct ina3221_data *ina) ina->single_shot = of_property_read_bool(np, "ti,single-shot"); - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = ina3221_probe_child_from_dt(dev, child, ina); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } return 0; From patchwork Thu Aug 22 06:29:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13772680 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C91671386C0 for ; Thu, 22 Aug 2024 06:22:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307757; cv=none; b=KTlfYoKU3n6WpzCvwP3vfEVAg7NLhJ3KMnBblc4La5piO27IQVGGXYHWo0Iqrlj6EnCzMta0/Hv36DQWdWpMFHLKWt9EIoxAizE83z4c8e1o93TYjwVLK47zbdu43NCZlnFH6W1cUpAD4aL4/DDhgREqA4Kwe8BUQhbX8ukc4cA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307757; c=relaxed/simple; bh=pAeFk9Zwr4ucmpsg5GD41mE0oSnc9ndPpN5yufU+QiI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nvG9KZIrozuJH3M7x9uoZWQHHPC5b3xKA0DuIcsHCvZSj8FrQeHBz90sx8tqeE2kg3f+HS8zlGQxokXqe3YwqJRqeeOv+yAi0O4ipnFKtAxfcZqg1uOeAbsCwPF1JMWiRjqr+aGvzVvCa2lbFr1wOgYcMEhrf0iUZT5U/ava500= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WqCkj0NSZzpTbK; Thu, 22 Aug 2024 14:21:01 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id A4EA6180087; Thu, 22 Aug 2024 14:22:33 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 22 Aug 2024 14:22:33 +0800 From: Jinjie Ruan To: , , , , , , CC: Subject: [PATCH -next 4/8] hwmon: (lm90): Simplify with scoped for each OF child loop Date: Thu, 22 Aug 2024 14:29:52 +0800 Message-ID: <20240822062956.3490387-5-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822062956.3490387-1-ruanjinjie@huawei.com> References: <20240822062956.3490387-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemh500013.china.huawei.com (7.202.181.146) Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan --- drivers/hwmon/lm90.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index ca5c52b38c0f..511d95a0efb3 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -2674,19 +2674,16 @@ static int lm90_parse_dt_channel_info(struct i2c_client *client, struct lm90_data *data) { int err; - struct device_node *child; struct device *dev = &client->dev; const struct device_node *np = dev->of_node; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (strcmp(child->name, "channel")) continue; err = lm90_probe_channel_from_dt(client, child, data); - if (err) { - of_node_put(child); + if (err) return err; - } } return 0; From patchwork Thu Aug 22 06:29:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13772681 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 795F5139D09 for ; Thu, 22 Aug 2024 06:22:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307758; cv=none; b=GphtxRZ5BGJ7IVTibjgBnFMxHtCKZCGnis+xxkQyCqisixo8jb+W5ynBdIHiEJYSevAZozTpYWViYYrkIROCVTdbSDNAAQNQ9/Mlk+SNwtkmjnLB4d5qOCPCgiqktzpQ8BpaCcfiGJ7lZWp8qfKh2IejoMlKnULjAP8G3nfdt6o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307758; c=relaxed/simple; bh=5CYnxhI+wP8NNLcOtcK/jbWI/Gpq0JmtZoFxE8JekcY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Jovx3Y0h0G69GWbCOesNq93VkWhZi7B6AIyrltMkEYccSe17mDxuF0STFz7QN2w7VkBiqwnkyoCnlTsJ0YcotAW6BaTyKIrQgz8VeTatB1/ic6KSioVnG46hT+dEWsD4u+zr/yDDrVPCjM58doRjcycZbpbc8aeeKxUAWbZ6VX4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WqCkj6dn4zpTbW; Thu, 22 Aug 2024 14:21:01 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 87D7B1800FF; Thu, 22 Aug 2024 14:22:34 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 22 Aug 2024 14:22:33 +0800 From: Jinjie Ruan To: , , , , , , CC: Subject: [PATCH -next 5/8] hwmon: (nct7802): Simplify with scoped for each OF child loop Date: Thu, 22 Aug 2024 14:29:53 +0800 Message-ID: <20240822062956.3490387-6-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822062956.3490387-1-ruanjinjie@huawei.com> References: <20240822062956.3490387-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemh500013.china.huawei.com (7.202.181.146) Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan --- drivers/hwmon/nct7802.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c index 5e83504800a3..8c9351da12c6 100644 --- a/drivers/hwmon/nct7802.c +++ b/drivers/hwmon/nct7802.c @@ -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; - } } } From patchwork Thu Aug 22 06:29:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13772684 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFD1A1386C0 for ; Thu, 22 Aug 2024 06:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307759; cv=none; b=r3rGI/Hgo5c0cZPnF5N7tpGLiT5AmpvhRH75mBhn78Nt7j5t4RSBGEQMDZtBJT1774Zgs8klECCm3HSgU40otjDQumbgd1CJRO73S6xStxlVti/uh1zFnRqYvhy3WEJINPXQb6+c6l3dwn/lGwrGYAyCdLS90w3ttfTOgkhhBc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307759; c=relaxed/simple; bh=XopjOlyfP6aP/RCALuCBScnU2dKMvLx+0o4oiQICrN4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y4nNlwLfJsyAfF8Jm0IcHoSD0qPPHYkJ7bye7myNvWeiJsKGI5+U7a7eJWhZdMkIyAN5o2f5T3dpJtHlOFZc8uQJqI/sRrPXo6gMKQqr1RIMjggD27EfUFbpvIZPcxgq/IapbmNOA80RTGvIJ3JvJYc27oayB/QcbWpL4lpfu3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4WqCg43B7gz69Lt; Thu, 22 Aug 2024 14:17:52 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 6C573140360; Thu, 22 Aug 2024 14:22:35 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 22 Aug 2024 14:22:34 +0800 From: Jinjie Ruan To: , , , , , , CC: Subject: [PATCH -next 6/8] hwmon: (npcm750-pwm-fan): Simplify with scoped for each OF child loop Date: Thu, 22 Aug 2024 14:29:54 +0800 Message-ID: <20240822062956.3490387-7-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822062956.3490387-1-ruanjinjie@huawei.com> References: <20240822062956.3490387-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemh500013.china.huawei.com (7.202.181.146) Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan --- drivers/hwmon/npcm750-pwm-fan.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c index bc8db1dc595d..db3b551828eb 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -927,7 +927,7 @@ static int npcm7xx_en_pwm_fan(struct device *dev, static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np, *child; + struct device_node *np; struct npcm7xx_pwm_fan_data *data; struct resource *res; struct device *hwmon; @@ -1004,11 +1004,10 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) } } - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = npcm7xx_en_pwm_fan(dev, child, data); if (ret) { dev_err(dev, "enable pwm and fan failed\n"); - of_node_put(child); return ret; } } From patchwork Thu Aug 22 06:29:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13772686 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E1B61369B6 for ; Thu, 22 Aug 2024 06:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307766; cv=none; b=CW7NKqddpgFq+uWWsNt10ZrM64N98yQ3B+GZ5PekSpN0syLFPe4vrmJ/HUki/heGZ15Bb0Cw9Px+9FLGXSp3w8jJ1FfaGS/VRqZQ2CuTrBhWfLQWK+vEER1kvp6K0z+HGDZcgODMNzpgSLGhRWKQ+IPlNwfauIWSw3Sz8ImOmgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307766; c=relaxed/simple; bh=H1H02w5xu9s6cSoOuKyFMGByHhLzPLYGIMauSgcwB/s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aUrO/FVHygsN/ybNvj9ZoVQcAE8T3/vkSsvIdAo8PCLF0Bfp7+Q+whhGx+aYrtnsjOd0+95YUPBSdjHcfOcESDW8821/CveQ78FbYmrBnTtuWoyWoXLdpcgtErQn/nk1FzZ04P0gG6K6YTNmBFHVkkHaybb4tRsU+zauW/Zj9Lk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WqCmS6X73z2CnB3; Thu, 22 Aug 2024 14:22:32 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 446C41401F1; Thu, 22 Aug 2024 14:22:36 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 22 Aug 2024 14:22:35 +0800 From: Jinjie Ruan To: , , , , , , CC: Subject: [PATCH -next 7/8] hwmon: (tmp421): Simplify with scoped for each OF child loop Date: Thu, 22 Aug 2024 14:29:55 +0800 Message-ID: <20240822062956.3490387-8-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822062956.3490387-1-ruanjinjie@huawei.com> References: <20240822062956.3490387-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemh500013.china.huawei.com (7.202.181.146) Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan --- drivers/hwmon/tmp421.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 7a6f9532e594..9537727aad9a 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -410,18 +410,15 @@ static int tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *d { struct device *dev = &client->dev; const struct device_node *np = dev->of_node; - struct device_node *child; int err; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (strcmp(child->name, "channel")) continue; err = tmp421_probe_child_from_dt(client, child, data); - if (err) { - of_node_put(child); + if (err) return err; - } } return 0; From patchwork Thu Aug 22 06:29:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13772685 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78C41136E09 for ; Thu, 22 Aug 2024 06:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307761; cv=none; b=tMkv3atRJUrFHMkIIWxaE/NZSwosrwFR1Ldr4Th9rkG7lzk/LjJAual1yHsd//PNfuURmHlYlgtnvecClAWJwVLUUWzf/8MH0TS9HAKt2zjwZ6eXc9pRSWkXVzN7+lfRRrekOGRVZPobqs+ejcv1v4oy2eylheKNmsuqWFb75e8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724307761; c=relaxed/simple; bh=zc4krLjzbCKD0JA5aUjz4/uIZlWOB6pYn8GIZYxGK6E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A+C2XfLgK7pHic3nfP1584o9oek4jJIpQjM+27+/Ffd5AMxYEYuyaBEDE8MXBnlPVT8MMhRWpF6zPnNiyDw2hVqmAEeplUuXeLezCCp0ix09uabIulZZAAaV4QIhGTGr6KI7VZxI6VUEOGfPjQ7QH/wT+6xDWXKaLpbN0zQnumA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.255 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4WqCln3M4Yz13ZvZ; Thu, 22 Aug 2024 14:21:57 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 7CBC11402CF; Thu, 22 Aug 2024 14:22:37 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 22 Aug 2024 14:22:36 +0800 From: Jinjie Ruan To: , , , , , , CC: Subject: [PATCH -next 8/8] hwmon: (tmp464): Simplify with scoped for each OF child loop Date: Thu, 22 Aug 2024 14:29:56 +0800 Message-ID: <20240822062956.3490387-9-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822062956.3490387-1-ruanjinjie@huawei.com> References: <20240822062956.3490387-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemh500013.china.huawei.com (7.202.181.146) Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan --- drivers/hwmon/tmp464.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/tmp464.c b/drivers/hwmon/tmp464.c index 0a7c0448835b..0f629c6d7695 100644 --- a/drivers/hwmon/tmp464.c +++ b/drivers/hwmon/tmp464.c @@ -562,18 +562,15 @@ static int tmp464_probe_child_from_dt(struct device *dev, static int tmp464_probe_from_dt(struct device *dev, struct tmp464_data *data) { const struct device_node *np = dev->of_node; - struct device_node *child; int err; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (strcmp(child->name, "channel")) continue; err = tmp464_probe_child_from_dt(dev, child, data); - if (err) { - of_node_put(child); + if (err) return err; - } } return 0;