From: Heiner Kallweit <hkallweit1@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next 2/2] net: phy: aquantia: use new function strreplace_nonalnum
Date: Sun, 3 Mar 2019 18:21:53 +0100 [thread overview]
Message-ID: <42f2e064-181c-087e-68b1-64d2d6f13e0e@gmail.com> (raw)
In-Reply-To: <d92b7418-09bb-15bc-85f8-508f992ed2c6@gmail.com>
Use new function strreplace_nonalnum to simplify the code.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/aquantia_hwmon.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/net/phy/aquantia_hwmon.c b/drivers/net/phy/aquantia_hwmon.c
index 19c4c280a..d47b3ed16 100644
--- a/drivers/net/phy/aquantia_hwmon.c
+++ b/drivers/net/phy/aquantia_hwmon.c
@@ -226,20 +226,12 @@ int aqr_hwmon_probe(struct phy_device *phydev)
struct device *dev = &phydev->mdio.dev;
struct device *hwmon_dev;
char *hwmon_name;
- int i, j;
hwmon_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL);
if (!hwmon_name)
return -ENOMEM;
- for (i = j = 0; hwmon_name[i]; i++) {
- if (isalnum(hwmon_name[i])) {
- if (i != j)
- hwmon_name[j] = hwmon_name[i];
- j++;
- }
- }
- hwmon_name[j] = '\0';
+ strreplace_nonalnum(hwmon_name, 0);
hwmon_dev = devm_hwmon_device_register_with_info(dev, hwmon_name,
phydev, &aqr_hwmon_chip_info, NULL);
--
2.21.0
next prev parent reply other threads:[~2019-03-03 17:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-03 17:19 [PATCH net-next 0/2] lib: string: add strreplace_nonalnum Heiner Kallweit
2019-03-03 17:20 ` [PATCH net-next 1/2] " Heiner Kallweit
2019-03-03 17:21 ` Heiner Kallweit [this message]
2019-03-03 17:31 ` [PATCH net-next 2/2] net: phy: aquantia: use new function strreplace_nonalnum Andrew Lunn
2019-03-03 17:41 ` Heiner Kallweit
2019-03-03 17:34 ` [PATCH net-next 0/2] lib: string: add strreplace_nonalnum Andrew Lunn
2019-03-03 17:39 ` Heiner Kallweit
2019-03-03 18:36 ` Heiner Kallweit
2019-03-04 18:54 ` Heiner Kallweit
2019-03-04 19:22 ` David Miller
2019-03-04 19:27 ` Heiner Kallweit
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=42f2e064-181c-087e-68b1-64d2d6f13e0e@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).