linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: bridge: Replace open-coded list_for_each + list_entry
@ 2017-03-10 20:47 Moritz Fischer
  2017-03-13 18:52 ` Alan Tull
  0 siblings, 1 reply; 2+ messages in thread
From: Moritz Fischer @ 2017-03-10 20:47 UTC (permalink / raw)
  To: linux-fpga
  Cc: moritz.fischer, gregkh, Moritz Fischer, Alan Tull, linux-kernel

Replaces open-coded list_for_each() + list_entry() with macro
list_for_each_entry()

Signed-off-by: Moritz Fischer <mdf@kernel.org>
Cc: Alan Tull <atull@kernel.org>
Cc: linux-fpga@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/fpga/fpga-bridge.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
index 33ee83e..cfacd2e 100644
--- a/drivers/fpga/fpga-bridge.c
+++ b/drivers/fpga/fpga-bridge.c
@@ -146,11 +146,9 @@ EXPORT_SYMBOL_GPL(fpga_bridge_put);
 int fpga_bridges_enable(struct list_head *bridge_list)
 {
 	struct fpga_bridge *bridge;
-	struct list_head *node;
 	int ret;
 
-	list_for_each(node, bridge_list) {
-		bridge = list_entry(node, struct fpga_bridge, node);
+	list_for_each_entry(bridge, bridge_list, node) {
 		ret = fpga_bridge_enable(bridge);
 		if (ret)
 			return ret;
@@ -172,11 +170,9 @@ EXPORT_SYMBOL_GPL(fpga_bridges_enable);
 int fpga_bridges_disable(struct list_head *bridge_list)
 {
 	struct fpga_bridge *bridge;
-	struct list_head *node;
 	int ret;
 
-	list_for_each(node, bridge_list) {
-		bridge = list_entry(node, struct fpga_bridge, node);
+	list_for_each_entry(bridge, bridge_list, node) {
 		ret = fpga_bridge_disable(bridge);
 		if (ret)
 			return ret;
@@ -196,13 +192,10 @@ EXPORT_SYMBOL_GPL(fpga_bridges_disable);
  */
 void fpga_bridges_put(struct list_head *bridge_list)
 {
-	struct fpga_bridge *bridge;
-	struct list_head *node, *next;
+	struct fpga_bridge *bridge, *next;
 	unsigned long flags;
 
-	list_for_each_safe(node, next, bridge_list) {
-		bridge = list_entry(node, struct fpga_bridge, node);
-
+	list_for_each_entry_safe(bridge, next, bridge_list, node) {
 		fpga_bridge_put(bridge);
 
 		spin_lock_irqsave(&bridge_list_lock, flags);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fpga: bridge: Replace open-coded list_for_each + list_entry
  2017-03-10 20:47 [PATCH] fpga: bridge: Replace open-coded list_for_each + list_entry Moritz Fischer
@ 2017-03-13 18:52 ` Alan Tull
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Tull @ 2017-03-13 18:52 UTC (permalink / raw)
  To: Moritz Fischer
  Cc: linux-fpga, Moritz Fischer, Greg Kroah-Hartman, linux-kernel

On Fri, Mar 10, 2017 at 2:47 PM, Moritz Fischer <mdf@kernel.org> wrote:

Hi Moritz,

Thanks!

Alan

> Replaces open-coded list_for_each() + list_entry() with macro
> list_for_each_entry()
>
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
> Cc: Alan Tull <atull@kernel.org>
> Cc: linux-fpga@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org

Acked-by: Alan Tull <atull@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-13 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 20:47 [PATCH] fpga: bridge: Replace open-coded list_for_each + list_entry Moritz Fischer
2017-03-13 18:52 ` Alan Tull

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).