Skip to content

Commit 3dd34df

Browse files
andy-shevpavelmachek
authored andcommitted
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@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
1 parent c31ef70 commit 3dd34df

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/leds/blink/leds-lgm-sso.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,6 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
621621
struct device *dev = priv->dev;
622622
struct sso_led_desc *desc;
623623
struct sso_led *led;
624-
struct list_head *p;
625624
const char *tmp;
626625
u32 prop;
627626
int ret;
@@ -707,10 +706,8 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
707706
__dt_err:
708707
fwnode_handle_put(fwnode_child);
709708
/* unregister leds */
710-
list_for_each(p, &priv->led_list) {
711-
led = list_entry(p, struct sso_led, list);
709+
list_for_each_entry(led, &priv->led_list, list)
712710
sso_led_shutdown(led);
713-
}
714711

715712
return -EINVAL;
716713
}
@@ -841,14 +838,12 @@ static int intel_sso_led_probe(struct platform_device *pdev)
841838
static int intel_sso_led_remove(struct platform_device *pdev)
842839
{
843840
struct sso_led_priv *priv;
844-
struct list_head *pos, *n;
845-
struct sso_led *led;
841+
struct sso_led *led, *n;
846842

847843
priv = platform_get_drvdata(pdev);
848844

849-
list_for_each_safe(pos, n, &priv->led_list) {
850-
list_del(pos);
851-
led = list_entry(pos, struct sso_led, list);
845+
list_for_each_entry_safe(led, n, &priv->led_list, list) {
846+
list_del(&led->list);
852847
sso_led_shutdown(led);
853848
}
854849

0 commit comments

Comments
 (0)