Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1132950pxj; Sat, 29 May 2021 04:21:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsXg/B7FrSnnFmRksl3/Of8ZQVJeO9Md7B0FzwnANedgNDYbCNh0RtLzkkCdUROuixgEwH X-Received: by 2002:a92:cd10:: with SMTP id z16mr5248917iln.308.1622287261029; Sat, 29 May 2021 04:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622287261; cv=none; d=google.com; s=arc-20160816; b=lmXSVZbCA7/krLNoXfooaMHXuTdURASpDZpcWPrwpdACgX42BvWt81DmkQrFGLazR+ Yv+rN/n0w3sDcPcOGx1k0PXd4hsxk8RheUJYU1+vINuHdFg6I61Qrord6y0EwWc3tho6 D/8bHNDYSfwnGV0kbOffJRqW4NDIYehxE93B4+nkD62DoTgtG4I+XtjU4LI3gH9k7R+r o37lIVeAwLcH6uEvQgurQERBRa8Il7LGs2jiZE2OgdvXuB87bJQKoPO1n2F4/CSKmBAI sVhYKizE/BRR2+C9pAZwSw2B2a83Bk/XM6Z63xFtuQqjb7DCEwnmW3iyKgJHDLN8tNQA 9YQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=0NU4t5DooPRTBP9xSnbkjj6cNz5LpwZ+ivKLMsLa504=; b=GzsSNOAs0Mxta3eeQ+M0g1yeM/26qyRJy96IcxMceBqTygO56RUjc6gY7cE1l7xefI Q13r9HEjlREMmUoa2TPMJefH+8HteWKW6CE6FSTEzVrGVN9umL/oyAQZvQjiM87hy6O5 MU2RwOZknTCc9pOF5io6B6hUJWxF/ZSxCDT6bijSsAVE0lEIdOHngKxtLYFH2frkRwUN i/DfpIblRl5cOU/u7U63hYZ5QUKE+3xAjKyhA/bKLGOj/0VQR2eqGKD+ajhfUATm/Txf IF4zZ0VXdfVhil6yu2nd1EE5E/mGUsi+C2+jFnyTJbAMGg7POTA+lvvZdm+cnwvJZ0fH +tTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si8469752ilu.19.2021.05.29.04.20.47; Sat, 29 May 2021 04:21:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbhE2LVk (ORCPT + 99 others); Sat, 29 May 2021 07:21:40 -0400 Received: from fgw20-7.mail.saunalahti.fi ([62.142.5.81]:27416 "EHLO fgw20-7.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbhE2LVW (ORCPT ); Sat, 29 May 2021 07:21:22 -0400 Received: from localhost (88-115-248-186.elisa-laajakaista.fi [88.115.248.186]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id c424a5a6-c06f-11eb-ba24-005056bd6ce9; Sat, 29 May 2021 14:19:43 +0300 (EEST) From: Andy Shevchenko To: Pavel Machek , Andy Shevchenko , Amireddy Mallikarjuna reddy , Linus Walleij , Abanoub Sameh , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Krzysztof Kozlowski , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/13] leds: lgm-sso: Convert to use list_for_each_entry*() API Date: Sat, 29 May 2021 14:19:29 +0300 Message-Id: <20210529111935.3849707-7-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210529111935.3849707-1-andy.shevchenko@gmail.com> References: <20210529111935.3849707-1-andy.shevchenko@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v2: no change 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 24f4057d5a05..77c933051d67 100644 --- a/drivers/leds/blink/leds-lgm-sso.c +++ b/drivers/leds/blink/leds-lgm-sso.c @@ -623,7 +623,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; @@ -709,10 +708,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; } @@ -843,14 +840,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