[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210510095045.3299382-14-andy.shevchenko@gmail.com>
Date: Mon, 10 May 2021 12:50:30 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Pavel Machek <pavel@....cz>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Amireddy Mallikarjuna reddy
<mallikarjunax.reddy@...ux.intel.com>,
Linus Walleij <linus.walleij@...aro.org>,
Marek BehĂșn <marek.behun@....cz>,
Abanoub Sameh <abanoubsameh8@...il.com>,
Dan Murphy <dmurphy@...com>,
Krzysztof Kozlowski <krzk@...nel.org>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Andy Shevchenko <andy.shevchenko@...il.com>
Subject: [PATCH v1 13/28] leds: lgm-sso: Convert to use list_for_each_entry*() API
Convert to use list_for_each_entry*() API insted of open coded variants.
It saves few lines of code and makes iteasier to read and maintain.
Signed-off-by: Andy Shevchenko <andy.shevchenko@...il.com>
---
drivers/leds/blink/leds-lgm-sso.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/leds/blink/leds-lgm-sso.c b/drivers/leds/blink/leds-lgm-sso.c
index f44d6bf5a5b3..5505eda3c800 100644
--- a/drivers/leds/blink/leds-lgm-sso.c
+++ b/drivers/leds/blink/leds-lgm-sso.c
@@ -620,7 +620,6 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
struct device *dev = priv->dev;
struct sso_led_desc *desc;
struct sso_led *led;
- struct list_head *p;
const char *tmp;
u32 prop;
int ret;
@@ -706,10 +705,8 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
__dt_err:
fwnode_handle_put(fwnode_child);
/* unregister leds */
- list_for_each(p, &priv->led_list) {
- led = list_entry(p, struct sso_led, list);
+ list_for_each_entry(led, &priv->led_list, list)
sso_led_shutdown(led);
- }
return -EINVAL;
}
@@ -844,14 +841,12 @@ static int intel_sso_led_probe(struct platform_device *pdev)
static int intel_sso_led_remove(struct platform_device *pdev)
{
struct sso_led_priv *priv;
- struct list_head *pos, *n;
- struct sso_led *led;
+ struct sso_led *led, *n;
priv = platform_get_drvdata(pdev);
- list_for_each_safe(pos, n, &priv->led_list) {
- list_del(pos);
- led = list_entry(pos, struct sso_led, list);
+ list_for_each_entry_safe(led, n, &priv->led_list, list) {
+ list_del(&led->list);
sso_led_shutdown(led);
}
--
2.31.1
Powered by blists - more mailing lists