From: Markus Elfring <Markus.Elfring@web.de>
To: linux-hwmon@vger.kernel.org, openbmc@lists.ozlabs.org,
"Avi Fishman" <avifishman70@gmail.com>,
"Benjamin Fair" <benjaminfair@google.com>,
"Günter Röck" <linux@roeck-us.net>,
"Jean Delvare" <jdelvare@suse.com>,
"Nancy Yuen" <yuenn@google.com>,
"Patrick Venture" <venture@google.com>,
"Tali Perry" <tali.perry1@gmail.com>,
"Tomer Maimon" <tmaimon77@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org, Rosen Penev <rosenp@gmail.com>
Subject: [PATCH] hwmon: (npcm750-pwm-fan) Use devm_platform_ioremap_resource_byname() in npcm7xx_pwm_fan_probe()
Date: Fri, 15 Nov 2024 13:45:56 +0100 [thread overview]
Message-ID: <945b113c-516d-4d35-9d45-224c03a344e4@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Nov 2024 13:30:58 +0100
* Reuse existing functionality from devm_platform_ioremap_resource_byname()
instead of keeping duplicate source code.
This issue was transformed by using the Coccinelle software.
* Omit the local variable “res” which became unnecessary
with this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/hwmon/npcm750-pwm-fan.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c
index db3b551828eb..d66edb184bca 100644
--- a/drivers/hwmon/npcm750-pwm-fan.c
+++ b/drivers/hwmon/npcm750-pwm-fan.c
@@ -929,7 +929,6 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct device_node *np;
struct npcm7xx_pwm_fan_data *data;
- struct resource *res;
struct device *hwmon;
char name[20];
int ret, cnt;
@@ -948,14 +947,7 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
data->pwm_modules = data->info->pwm_max_channel / NPCM7XX_PWM_MAX_CHN_NUM_IN_A_MODULE;
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm");
- if (!res) {
- dev_err(dev, "pwm resource not found\n");
- return -ENODEV;
- }
-
- data->pwm_base = devm_ioremap_resource(dev, res);
- dev_dbg(dev, "pwm base resource is %pR\n", res);
+ data->pwm_base = devm_platform_ioremap_resource_byname(pdev, "pwm");
if (IS_ERR(data->pwm_base))
return PTR_ERR(data->pwm_base);
@@ -965,14 +957,7 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
return PTR_ERR(data->pwm_clk);
}
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fan");
- if (!res) {
- dev_err(dev, "fan resource not found\n");
- return -ENODEV;
- }
-
- data->fan_base = devm_ioremap_resource(dev, res);
- dev_dbg(dev, "fan base resource is %pR\n", res);
+ data->fan_base = devm_platform_ioremap_resource_byname(pdev, "fan");
if (IS_ERR(data->fan_base))
return PTR_ERR(data->fan_base);
--
2.47.0
reply other threads:[~2024-11-15 12:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=945b113c-516d-4d35-9d45-224c03a344e4@web.de \
--to=markus.elfring@web.de \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=jdelvare@suse.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=openbmc@lists.ozlabs.org \
--cc=rosenp@gmail.com \
--cc=tali.perry1@gmail.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=yuenn@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®