Commit 3dd34dfb authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Pavel Machek

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: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent c31ef700
...@@ -621,7 +621,6 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled) ...@@ -621,7 +621,6 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
struct device *dev = priv->dev; struct device *dev = priv->dev;
struct sso_led_desc *desc; struct sso_led_desc *desc;
struct sso_led *led; struct sso_led *led;
struct list_head *p;
const char *tmp; const char *tmp;
u32 prop; u32 prop;
int ret; int ret;
...@@ -707,10 +706,8 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled) ...@@ -707,10 +706,8 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
__dt_err: __dt_err:
fwnode_handle_put(fwnode_child); fwnode_handle_put(fwnode_child);
/* unregister leds */ /* unregister leds */
list_for_each(p, &priv->led_list) { list_for_each_entry(led, &priv->led_list, list)
led = list_entry(p, struct sso_led, list);
sso_led_shutdown(led); sso_led_shutdown(led);
}
return -EINVAL; return -EINVAL;
} }
...@@ -841,14 +838,12 @@ static int intel_sso_led_probe(struct platform_device *pdev) ...@@ -841,14 +838,12 @@ static int intel_sso_led_probe(struct platform_device *pdev)
static int intel_sso_led_remove(struct platform_device *pdev) static int intel_sso_led_remove(struct platform_device *pdev)
{ {
struct sso_led_priv *priv; struct sso_led_priv *priv;
struct list_head *pos, *n; struct sso_led *led, *n;
struct sso_led *led;
priv = platform_get_drvdata(pdev); priv = platform_get_drvdata(pdev);
list_for_each_safe(pos, n, &priv->led_list) { list_for_each_entry_safe(led, n, &priv->led_list, list) {
list_del(pos); list_del(&led->list);
led = list_entry(pos, struct sso_led, list);
sso_led_shutdown(led); sso_led_shutdown(led);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment