public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Yinghai Lu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: bhelgaas@google.com, konrad.wilk@oracle.com,
	gregkh@linuxfoundation.org, joro@8bytes.org, hpa@zytor.com,
	sebastian@breakpoint.cc, mingo@kernel.org,
	linux-kernel@vger.kernel.org, bp@alien8.de,
	grant.likely@linaro.org, tony.luck@intel.com, rjw@rjwysocki.net,
	tglx@linutronix.de, prarit@redhat.com, jiang.liu@linux.intel.com,
	benh@kernel.crashing.org, rdunlap@infradead.org,
	yinghai@kernel.org
Subject: [tip:x86/apic] x86, irq: Convert irq_2_pin list to generic list
Date: Wed, 5 Nov 2014 08:35:32 -0800	[thread overview]
Message-ID: <tip-ad6b879eac110587bc6dc01ccea479e15de017df@git.kernel.org> (raw)
In-Reply-To: <1414397531-28254-5-git-send-email-jiang.liu@linux.intel.com>

Commit-ID:  ad6b879eac110587bc6dc01ccea479e15de017df
Gitweb:     http://git.kernel.org/tip/ad6b879eac110587bc6dc01ccea479e15de017df
Author:     Yinghai Lu <yinghai@kernel.org>
AuthorDate: Mon, 27 Oct 2014 16:11:55 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 5 Nov 2014 11:04:46 +0100

x86, irq: Convert irq_2_pin list to generic list

Use generic list to replace private list implementation so we can use
the existing helper functions.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Grant Likely <grant.likely@linaro.org>
Link: http://lkml.kernel.org/r/1414397531-28254-5-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: Joerg Roedel <joro@8bytes.org>
---
 arch/x86/include/asm/hw_irq.h  |  2 +-
 arch/x86/kernel/apic/io_apic.c | 28 +++++++++++-----------------
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index b12c45c..66e59e6 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -138,7 +138,7 @@ struct irq_2_irte {
  * Most irqs are mapped 1:1 with pins.
  */
 struct irq_cfg {
-	struct irq_pin_list	*irq_2_pin;
+	struct list_head	irq_2_pin;
 	cpumask_var_t		domain;
 	cpumask_var_t		old_domain;
 	u8			vector;
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 192ca0a..fac6be1 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -74,7 +74,7 @@
 		for_each_pin((idx), (pin))
 
 #define for_each_irq_pin(entry, head) \
-	for (entry = head; entry; entry = entry->next)
+	list_for_each_entry(entry, &head, list)
 
 /*
  *      Is the SiS APIC rmw bug present ?
@@ -229,8 +229,8 @@ void mp_save_irq(struct mpc_intsrc *m)
 }
 
 struct irq_pin_list {
+	struct list_head list;
 	int apic, pin;
-	struct irq_pin_list *next;
 };
 
 static struct irq_pin_list *alloc_irq_pin_list(int node)
@@ -297,6 +297,7 @@ static struct irq_cfg *alloc_irq_cfg(unsigned int irq, int node)
 		goto out_cfg;
 	if (!zalloc_cpumask_var_node(&cfg->old_domain, GFP_KERNEL, node))
 		goto out_domain;
+	INIT_LIST_HEAD(&cfg->irq_2_pin);
 	return cfg;
 out_domain:
 	free_cpumask_var(cfg->domain);
@@ -460,15 +461,12 @@ static void ioapic_mask_entry(int apic, int pin)
  */
 static int __add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin)
 {
-	struct irq_pin_list **last, *entry;
+	struct irq_pin_list *entry;
 
 	/* don't allow duplicates */
-	last = &cfg->irq_2_pin;
-	for_each_irq_pin(entry, cfg->irq_2_pin) {
+	for_each_irq_pin(entry, cfg->irq_2_pin)
 		if (entry->apic == apic && entry->pin == pin)
 			return 0;
-		last = &entry->next;
-	}
 
 	entry = alloc_irq_pin_list(node);
 	if (!entry) {
@@ -479,22 +477,19 @@ static int __add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pi
 	entry->apic = apic;
 	entry->pin = pin;
 
-	*last = entry;
+	list_add_tail(&entry->list, &cfg->irq_2_pin);
 	return 0;
 }
 
 static void __remove_pin_from_irq(struct irq_cfg *cfg, int apic, int pin)
 {
-	struct irq_pin_list **last, *entry;
+	struct irq_pin_list *tmp, *entry;
 
-	last = &cfg->irq_2_pin;
-	for_each_irq_pin(entry, cfg->irq_2_pin)
+	list_for_each_entry_safe(entry, tmp, &cfg->irq_2_pin, list)
 		if (entry->apic == apic && entry->pin == pin) {
-			*last = entry->next;
+			list_del(&entry->list);
 			kfree(entry);
 			return;
-		} else {
-			last = &entry->next;
 		}
 }
 
@@ -1739,8 +1734,7 @@ __apicdebuginit(void) print_IO_APICs(void)
 		cfg = irq_cfg(irq);
 		if (!cfg)
 			continue;
-		entry = cfg->irq_2_pin;
-		if (!entry)
+		if (list_empty(&cfg->irq_2_pin))
 			continue;
 		printk(KERN_DEBUG "IRQ%d ", irq);
 		for_each_irq_pin(entry, cfg->irq_2_pin)
@@ -4076,7 +4070,7 @@ void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq)
 
 	ioapic_mask_entry(ioapic, pin);
 	__remove_pin_from_irq(cfg, ioapic, pin);
-	WARN_ON(cfg->irq_2_pin != NULL);
+	WARN_ON(!list_empty(&cfg->irq_2_pin));
 	arch_teardown_hwirq(virq);
 }
 

  reply	other threads:[~2014-11-05 16:42 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27  8:11 [Patch Part1 v3 00/20] Prepare for enabling hierarchy irqdomain on x86 Jiang Liu
2014-10-27  8:11 ` [Patch Part1 v3 01/20] ACPI, irq, x86: Get rid of special handling of GSI for ACPI SCI Jiang Liu
2014-11-05 16:34   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:12   ` tip-bot for Jiang Liu
2014-12-19 14:05   ` [tip:x86/apic] x86, irq, acpi: " tip-bot for Jiang Liu
2014-10-27  8:11 ` [Patch Part1 v3 02/20] x86, irq, ACPI: Fix building warning of unused code Jiang Liu
2014-11-05 16:34   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:13   ` tip-bot for Jiang Liu
2014-12-19 14:01   ` tip-bot for Jiang Liu
2014-10-27  8:11 ` [Patch Part1 v3 03/20] x86, irq: Kill fourth parameter of IO_APIC_get_PCI_irq_vector() Jiang Liu
2014-11-05 16:35   ` [tip:x86/apic] x86, irq: Kill useless parameter 'irq_attr' " tip-bot for Jiang Liu
2014-11-05 17:13   ` tip-bot for Jiang Liu
2014-12-19 14:06   ` tip-bot for Jiang Liu
2014-10-27  8:11 ` [Patch Part1 v3 04/20] x86, irq: Convert irq_2_pin list to generic list Jiang Liu
2014-11-05 16:35   ` tip-bot for Yinghai Lu [this message]
2014-11-05 17:13   ` [tip:x86/apic] " tip-bot for Yinghai Lu
2014-12-19 14:06   ` tip-bot for Yinghai Lu
2014-10-27  8:11 ` [Patch Part1 v3 05/20] x86, irq: Refine hw_irq.h to prepare for irqdomain support Jiang Liu
2014-11-05 16:35   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:13   ` tip-bot for Jiang Liu
2014-12-19 14:06   ` tip-bot for Jiang Liu
2014-10-27  8:11 ` [Patch Part1 v3 06/20] x86, irq: Rename local APIC related functions in io_apic.c as apic_xxx() Jiang Liu
2014-11-05 16:36   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:14   ` tip-bot for Jiang Liu
2014-12-19 14:07   ` tip-bot for Jiang Liu
2014-10-27  8:11 ` [Patch Part1 v3 07/20] x86, irq: Protect __clear_irq_vector() with vector_lock Jiang Liu
2014-11-05 16:36   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:14   ` tip-bot for Jiang Liu
2014-12-19 14:07   ` tip-bot for Jiang Liu
2014-10-27  8:11 ` [Patch Part1 v3 08/20] x86, irq: Introduce helpers to access struct irq_cfg Jiang Liu
2014-11-05 16:36   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:14   ` tip-bot for Jiang Liu
2014-12-19 14:07   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 09/20] x86, irq: Move local APIC related code from io_apic.c into vector.c Jiang Liu
2014-11-05 16:37   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:14   ` tip-bot for Jiang Liu
2014-12-19 14:08   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 10/20] x86, irq: Replace printk(KERN_LVL) with pr_lvl() utilities Jiang Liu
2014-11-05 16:37   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 16:47     ` Joe Perches
2014-11-05 17:15   ` tip-bot for Jiang Liu
2014-12-19 14:08   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 11/20] x86, irq: Move PCI MSI related code from io_apic.c into msi.c Jiang Liu
2014-11-05 16:38   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:15   ` tip-bot for Jiang Liu
2014-12-19 14:08   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 12/20] x86, irq: Move HT IRQ related code from io_apic.c into htirq.c Jiang Liu
2014-11-05 16:38   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:16   ` tip-bot for Jiang Liu
2014-12-19 14:09   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 13/20] x86, irq: Move IOAPIC related declarations from hw_irq.h into io_apic.h Jiang Liu
2014-11-05 16:38   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:16   ` tip-bot for Jiang Liu
2014-12-19 14:09   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 14/20] x86, irq: Move IRQ initialization routines from io_apic.c into vector.c Jiang Liu
2014-11-05 16:38   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:16   ` tip-bot for Jiang Liu
2014-12-19 14:09   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 15/20] x86, irq: Make MSI and HT_IRQ indepenent of X86_IO_APIC Jiang Liu
2014-11-05 16:39   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:16   ` tip-bot for Jiang Liu
2014-12-19 14:10   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 16/20] x86, irq: Use helpers to access irq_cfg data structure associated with IRQ Jiang Liu
2014-11-05 16:39   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:17   ` tip-bot for Jiang Liu
2014-12-19 14:10   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 17/20] x86: irq_remapping: " Jiang Liu
2014-11-05 16:39   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:17   ` tip-bot for Jiang Liu
2014-12-19 14:10   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 18/20] iommu/vt-d: " Jiang Liu
2014-11-05 16:39   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:17   ` tip-bot for Jiang Liu
2014-12-19 14:11   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 19/20] iommu/amd: " Jiang Liu
2014-11-05 16:40   ` [tip:x86/apic] " tip-bot for Jiang Liu
2014-11-05 17:17   ` tip-bot for Jiang Liu
2014-12-19 14:11   ` tip-bot for Jiang Liu
2014-10-27  8:12 ` [Patch Part1 v3 20/20] x86, irq: Fix link error of undefined reference to send_cleanup_vector Jiang Liu
2014-11-05 16:34   ` [tip:x86/apic] x86, irq: Provide empty send_cleanup_vector() stub for UP builds tip-bot for Jiang Liu
2014-11-05 17:12   ` tip-bot for Jiang Liu
2014-12-19 14:00   ` tip-bot for Jiang Liu

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=tip-ad6b879eac110587bc6dc01ccea479e15de017df@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jiang.liu@linux.intel.com \
    --cc=joro@8bytes.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=prarit@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=sebastian@breakpoint.cc \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=yinghai@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox