All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Subject: [PATCH v3 01/18] MIPS: PCI: Use struct list_head lists
Date: Wed, 5 Oct 2016 18:18:07 +0100	[thread overview]
Message-ID: <20161005171824.18014-2-paul.burton@imgtec.com> (raw)
In-Reply-To: <20161005171824.18014-1-paul.burton@imgtec.com>

Rather than open-coding a linked list implementation, make use of the
one in linux/list.h.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>

---

Changes in v3:
- Include this patch missed from previous submissions.

Changes in v2: None

 arch/mips/include/asm/pci.h | 3 ++-
 arch/mips/pci/pci.c         | 9 ++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 9b63cd4..547e113 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -17,6 +17,7 @@
  */
 
 #include <linux/ioport.h>
+#include <linux/list.h>
 #include <linux/of.h>
 
 /*
@@ -25,7 +26,7 @@
  * single controller supporting multiple channels.
  */
 struct pci_controller {
-	struct pci_controller *next;
+	struct list_head list;
 	struct pci_bus *bus;
 	struct device_node *of_node;
 
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index b4c02f2..644ae96 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -28,8 +28,7 @@
 /*
  * The PCI controller list.
  */
-
-static struct pci_controller *hose_head, **hose_tail = &hose_head;
+static LIST_HEAD(controllers);
 
 unsigned long PCIBIOS_MIN_IO;
 unsigned long PCIBIOS_MIN_MEM;
@@ -193,8 +192,8 @@ void register_pci_controller(struct pci_controller *hose)
 		goto out;
 	}
 
-	*hose_tail = hose;
-	hose_tail = &hose->next;
+	INIT_LIST_HEAD(&hose->list);
+	list_add(&hose->list, &controllers);
 
 	/*
 	 * Do not panic here but later - this might happen before console init.
@@ -248,7 +247,7 @@ static int __init pcibios_init(void)
 	pcibios_set_cache_line_size();
 
 	/* Scan all of the recorded PCI controllers.  */
-	for (hose = hose_head; hose; hose = hose->next)
+	list_for_each_entry(hose, &controllers, list)
 		pcibios_scanbus(hose);
 
 	pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
-- 
2.10.0

WARNING: multiple messages have this Message-ID (diff)
From: Paul Burton <paul.burton@imgtec.com>
To: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Subject: [PATCH v3 01/18] MIPS: PCI: Use struct list_head lists
Date: Wed, 5 Oct 2016 18:18:07 +0100	[thread overview]
Message-ID: <20161005171824.18014-2-paul.burton@imgtec.com> (raw)
Message-ID: <20161005171807.eZ1X6qNHTLZ3uR2uwQK08H2h1JXJHaJtZ2nfLDM9kGo@z> (raw)
In-Reply-To: <20161005171824.18014-1-paul.burton@imgtec.com>

Rather than open-coding a linked list implementation, make use of the
one in linux/list.h.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>

---

Changes in v3:
- Include this patch missed from previous submissions.

Changes in v2: None

 arch/mips/include/asm/pci.h | 3 ++-
 arch/mips/pci/pci.c         | 9 ++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 9b63cd4..547e113 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -17,6 +17,7 @@
  */
 
 #include <linux/ioport.h>
+#include <linux/list.h>
 #include <linux/of.h>
 
 /*
@@ -25,7 +26,7 @@
  * single controller supporting multiple channels.
  */
 struct pci_controller {
-	struct pci_controller *next;
+	struct list_head list;
 	struct pci_bus *bus;
 	struct device_node *of_node;
 
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index b4c02f2..644ae96 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -28,8 +28,7 @@
 /*
  * The PCI controller list.
  */
-
-static struct pci_controller *hose_head, **hose_tail = &hose_head;
+static LIST_HEAD(controllers);
 
 unsigned long PCIBIOS_MIN_IO;
 unsigned long PCIBIOS_MIN_MEM;
@@ -193,8 +192,8 @@ void register_pci_controller(struct pci_controller *hose)
 		goto out;
 	}
 
-	*hose_tail = hose;
-	hose_tail = &hose->next;
+	INIT_LIST_HEAD(&hose->list);
+	list_add(&hose->list, &controllers);
 
 	/*
 	 * Do not panic here but later - this might happen before console init.
@@ -248,7 +247,7 @@ static int __init pcibios_init(void)
 	pcibios_set_cache_line_size();
 
 	/* Scan all of the recorded PCI controllers.  */
-	for (hose = hose_head; hose; hose = hose->next)
+	list_for_each_entry(hose, &controllers, list)
 		pcibios_scanbus(hose);
 
 	pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
-- 
2.10.0

  reply	other threads:[~2016-10-05 17:19 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-05 17:18 [PATCH v3 00/18] MIPS generic kernels, SEAD-3 & Boston support Paul Burton
2016-10-05 17:18 ` Paul Burton
2016-10-05 17:18 ` Paul Burton [this message]
2016-10-05 17:18   ` [PATCH v3 01/18] MIPS: PCI: Use struct list_head lists Paul Burton
2016-10-05 17:18 ` [PATCH v3 02/18] MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 03/18] MIPS: PCI: Make pcibios_set_cache_line_size an initcall Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 04/18] MIPS: PCI: Inline pcibios_assign_all_busses Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 05/18] MIPS: PCI: Split pci.c into pci.c & pci-legacy.c Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 06/18] MIPS: PCI: Introduce CONFIG_PCI_DRIVERS_LEGACY Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 07/18] MIPS: PCI: Support generic drivers Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 08/18] MIPS: Sanitise coherentio semantics Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 09/18] MIPS: dma-default: Don't check hw_coherentio if device is non-coherent Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 10/18] MIPS: Support per-device DMA coherence Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 11/18] MIPS: Print CM error reports upon bus errors Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 12/18] MIPS: Adjust MIPS64 CAC_BASE to reflect Config.K0 Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 13/18] MIPS: Support generating Flattened Image Trees (.itb) Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 14/18] MIPS: generic: Introduce generic DT-based board support Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 15/18] MIPS: generic: Convert SEAD-3 to a generic board Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 16/18] dt-bindings: Document img,boston-clock binding Paul Burton
2016-10-05 17:18   ` Paul Burton
     [not found]   ` <20161005171824.18014-17-paul.burton-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2016-10-10 13:01     ` Rob Herring
2016-10-10 13:01       ` Rob Herring
2016-10-11 15:56       ` Paul Burton
2016-10-11 15:56         ` Paul Burton
2016-10-11 16:00       ` Paul Burton
2016-10-11 16:00         ` Paul Burton
2016-10-11 20:06         ` Rob Herring
2016-10-11 21:15           ` Paul Burton
2016-10-19  0:46             ` Stephen Boyd
2016-10-19  0:46               ` Stephen Boyd
2016-10-05 17:18 ` [PATCH v3 17/18] clk: boston: Add a driver for MIPS Boston board clocks Paul Burton
2016-10-05 17:18   ` Paul Burton
2016-10-07  9:50   ` Paul Burton
2016-10-05 17:18 ` [PATCH v3 18/18] MIPS: generic: Support MIPS Boston development boards Paul Burton
2016-10-05 17:18   ` Paul Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161005171824.18014-2-paul.burton@imgtec.com \
    --to=paul.burton@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.