Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1573236 > unrolled thread

two small PCI MSI cleanups

Started byChristoph Hellwig <hch@lst.de>
First post2017-02-03 17:30 +0100
Last post2017-02-09 10:00 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  two small PCI MSI cleanups Christoph Hellwig <hch@lst.de> - 2017-02-03 17:30 +0100
    [PATCH 2/2] PCI/msi: remove pci_msi_domain_{alloc,free}_irqs Christoph Hellwig <hch@lst.de> - 2017-02-03 17:30 +0100
    [PATCH 1/2] PCI/msi: remove unused function pci_msi_create_default_irq_domain Christoph Hellwig <hch@lst.de> - 2017-02-03 17:30 +0100
      Re: [PATCH 1/2] PCI/msi: remove unused function  pci_msi_create_default_irq_domain Thomas Gleixner <tglx@linutronix.de> - 2017-02-08 14:50 +0100
        Re: [PATCH 1/2] PCI/msi: remove unused function  pci_msi_create_default_irq_domain Marc Zyngier <marc.zyngier@arm.com> - 2017-02-09 10:00 +0100

#1573236 — two small PCI MSI cleanups

FromChristoph Hellwig <hch@lst.de>
Date2017-02-03 17:30 +0100
Subjecttwo small PCI MSI cleanups
Message-ID<t6OUh-442-1@gated-at.bofh.it>
Remove an entirely dead function, and two small wrappers that are not
useful except for making the callchain in the MSI setup code even harder
to follow.

[toc] | [next] | [standalone]


#1573240 — [PATCH 2/2] PCI/msi: remove pci_msi_domain_{alloc,free}_irqs

FromChristoph Hellwig <hch@lst.de>
Date2017-02-03 17:30 +0100
Subject[PATCH 2/2] PCI/msi: remove pci_msi_domain_{alloc,free}_irqs
Message-ID<t6OUi-442-25@gated-at.bofh.it>
In reply to#1573236
Just call the msi_* version directly instead of having trivial wrappers
for one or two callsites.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/x86/kernel/apic/msi.c |  2 +-
 drivers/pci/msi.c          | 30 ++----------------------------
 include/linux/msi.h        |  3 ---
 3 files changed, 3 insertions(+), 32 deletions(-)

diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c
index 015bbf30e3e3..c61aec7e65f4 100644
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -82,7 +82,7 @@ int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 	if (domain == NULL)
 		return -ENOSYS;
 
-	return pci_msi_domain_alloc_irqs(domain, dev, nvec, type);
+	return msi_domain_alloc_irqs(domain, &dev->dev, nvec);
 }
 
 void native_teardown_msi_irq(unsigned int irq)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 4f2996bd5c6a..3ba99adb8b40 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -57,7 +57,7 @@ static int pci_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 
 	domain = pci_msi_get_domain(dev);
 	if (domain && irq_domain_is_hierarchy(domain))
-		return pci_msi_domain_alloc_irqs(domain, dev, nvec, type);
+		return msi_domain_alloc_irqs(domain, &dev->dev, nvec);
 
 	return arch_setup_msi_irqs(dev, nvec, type);
 }
@@ -68,7 +68,7 @@ static void pci_msi_teardown_msi_irqs(struct pci_dev *dev)
 
 	domain = pci_msi_get_domain(dev);
 	if (domain && irq_domain_is_hierarchy(domain))
-		pci_msi_domain_free_irqs(domain, dev);
+		msi_domain_free_irqs(domain, &dev->dev);
 	else
 		arch_teardown_msi_irqs(dev);
 }
@@ -1481,32 +1481,6 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
 }
 EXPORT_SYMBOL_GPL(pci_msi_create_irq_domain);
 
-/**
- * pci_msi_domain_alloc_irqs - Allocate interrupts for @dev in @domain
- * @domain:	The interrupt domain to allocate from
- * @dev:	The device for which to allocate
- * @nvec:	The number of interrupts to allocate
- * @type:	Unused to allow simpler migration from the arch_XXX interfaces
- *
- * Returns:
- * A virtual interrupt number or an error code in case of failure
- */
-int pci_msi_domain_alloc_irqs(struct irq_domain *domain, struct pci_dev *dev,
-			      int nvec, int type)
-{
-	return msi_domain_alloc_irqs(domain, &dev->dev, nvec);
-}
-
-/**
- * pci_msi_domain_free_irqs - Free interrupts for @dev in @domain
- * @domain:	The interrupt domain
- * @dev:	The device for which to free interrupts
- */
-void pci_msi_domain_free_irqs(struct irq_domain *domain, struct pci_dev *dev)
-{
-	msi_domain_free_irqs(domain, &dev->dev);
-}
-
 static int get_msi_id_cb(struct pci_dev *pdev, u16 alias, void *data)
 {
 	u32 *pa = data;
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 18b8566b3ce3..1b6f3ebbe876 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -316,9 +316,6 @@ void pci_msi_domain_write_msg(struct irq_data *irq_data, struct msi_msg *msg);
 struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
 					     struct msi_domain_info *info,
 					     struct irq_domain *parent);
-int pci_msi_domain_alloc_irqs(struct irq_domain *domain, struct pci_dev *dev,
-			      int nvec, int type);
-void pci_msi_domain_free_irqs(struct irq_domain *domain, struct pci_dev *dev);
 irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev,
 					  struct msi_desc *desc);
 int pci_msi_domain_check_cap(struct irq_domain *domain,
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1573242 — [PATCH 1/2] PCI/msi: remove unused function pci_msi_create_default_irq_domain

FromChristoph Hellwig <hch@lst.de>
Date2017-02-03 17:30 +0100
Subject[PATCH 1/2] PCI/msi: remove unused function pci_msi_create_default_irq_domain
Message-ID<t6OUi-442-19@gated-at.bofh.it>
In reply to#1573236
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/pci/msi.c   | 27 ---------------------------
 include/linux/msi.h |  3 ---
 2 files changed, 30 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 50c5003295ca..4f2996bd5c6a 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1507,33 +1507,6 @@ void pci_msi_domain_free_irqs(struct irq_domain *domain, struct pci_dev *dev)
 	msi_domain_free_irqs(domain, &dev->dev);
 }
 
-/**
- * pci_msi_create_default_irq_domain - Create a default MSI interrupt domain
- * @fwnode:	Optional fwnode of the interrupt controller
- * @info:	MSI domain info
- * @parent:	Parent irq domain
- *
- * Returns: A domain pointer or NULL in case of failure. If successful
- * the default PCI/MSI irqdomain pointer is updated.
- */
-struct irq_domain *pci_msi_create_default_irq_domain(struct fwnode_handle *fwnode,
-		struct msi_domain_info *info, struct irq_domain *parent)
-{
-	struct irq_domain *domain;
-
-	mutex_lock(&pci_msi_domain_lock);
-	if (pci_msi_default_domain) {
-		pr_err("PCI: default irq domain for PCI MSI has already been created.\n");
-		domain = NULL;
-	} else {
-		domain = pci_msi_create_irq_domain(fwnode, info, parent);
-		pci_msi_default_domain = domain;
-	}
-	mutex_unlock(&pci_msi_domain_lock);
-
-	return domain;
-}
-
 static int get_msi_id_cb(struct pci_dev *pdev, u16 alias, void *data)
 {
 	u32 *pa = data;
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 0db320b7bb15..18b8566b3ce3 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -319,9 +319,6 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
 int pci_msi_domain_alloc_irqs(struct irq_domain *domain, struct pci_dev *dev,
 			      int nvec, int type);
 void pci_msi_domain_free_irqs(struct irq_domain *domain, struct pci_dev *dev);
-struct irq_domain *pci_msi_create_default_irq_domain(struct fwnode_handle *fwnode,
-		 struct msi_domain_info *info, struct irq_domain *parent);
-
 irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev,
 					  struct msi_desc *desc);
 int pci_msi_domain_check_cap(struct irq_domain *domain,
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1576591 — Re: [PATCH 1/2] PCI/msi: remove unused function pci_msi_create_default_irq_domain

FromThomas Gleixner <tglx@linutronix.de>
Date2017-02-08 14:50 +0100
SubjectRe: [PATCH 1/2] PCI/msi: remove unused function pci_msi_create_default_irq_domain
Message-ID<t8ANb-XW-11@gated-at.bofh.it>
In reply to#1573242
On Fri, 3 Feb 2017, Christoph Hellwig wrote:

No objections, but then we also can remove:

struct irq_domain * __weak arch_get_pci_msi_domain(struct pci_dev *dev)

as there are no arch specific implementations

along with:

static struct irq_domain *pci_msi_default_domain;

because pci_msi_create_default_irq_domain() is the only place where the
default domain is ever set.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1577382 — Re: [PATCH 1/2] PCI/msi: remove unused function pci_msi_create_default_irq_domain

FromMarc Zyngier <marc.zyngier@arm.com>
Date2017-02-09 10:00 +0100
SubjectRe: [PATCH 1/2] PCI/msi: remove unused function pci_msi_create_default_irq_domain
Message-ID<t8SK6-3XY-13@gated-at.bofh.it>
In reply to#1576591
On 08/02/17 13:43, Thomas Gleixner wrote:
> On Fri, 3 Feb 2017, Christoph Hellwig wrote:
> 
> No objections, but then we also can remove:
> 
> struct irq_domain * __weak arch_get_pci_msi_domain(struct pci_dev *dev)
> 
> as there are no arch specific implementations
> 
> along with:
> 
> static struct irq_domain *pci_msi_default_domain;
> 
> because pci_msi_create_default_irq_domain() is the only place where the
> default domain is ever set.

Indeed. I'm all for dropping the "default" stuff, as it only gives
people the idea that they can get away with it (most of the time, they
cannot).

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web