linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: l.stach@pengutronix.de (Lucas Stach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 21/21] PCI/MSI: Clean up unused MSI arch functions
Date: Mon, 15 Sep 2014 16:47:10 +0200	[thread overview]
Message-ID: <1410792430.3314.10.camel@pengutronix.de> (raw)
In-Reply-To: <1409911806-10519-22-git-send-email-wangyijing@huawei.com>

Am Freitag, den 05.09.2014, 18:10 +0800 schrieb Yijing Wang:
> Now we use struct msi_chip in all platforms to configure
> MSI/MSI-X. We can clean up the unused arch functions.
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
>  drivers/iommu/irq_remapping.c |    2 +-
>  drivers/pci/msi.c             |   99 ++++++++++++++++-------------------------
>  include/linux/msi.h           |   14 ------
>  3 files changed, 39 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
> index 99b1c0f..6e645f0 100644
> --- a/drivers/iommu/irq_remapping.c
> +++ b/drivers/iommu/irq_remapping.c
> @@ -92,7 +92,7 @@ error:
>  
>  	/*
>  	 * Restore altered MSI descriptor fields and prevent just destroyed
> -	 * IRQs from tearing down again in default_teardown_msi_irqs()
> +	 * IRQs from tearing down again in teardown_msi_irqs()
>  	 */
>  	msidesc->irq = 0;
>  	msidesc->nvec_used = 0;
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index d78d637..e3e7f4f 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -34,50 +34,31 @@ struct msi_chip * __weak arch_find_msi_chip(struct pci_dev *dev)
>  	return dev->bus->msi;
>  }
>  
> -int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
> -{
> -	struct msi_chip *chip = arch_find_msi_chip(dev);
> -	int err;
> -
> -	if (!chip || !chip->setup_irq)
> -		return -EINVAL;
> -
> -	err = chip->setup_irq(dev, desc);
> -	if (err < 0)
> -		return err;
> -
> -	return 0;
> -}
> -
> -void __weak arch_teardown_msi_irq(unsigned int irq)
> -{
> -	struct msi_chip *chip = irq_get_chip_data(irq);
> -
> -	if (!chip || !chip->teardown_irq)
> -		return;
> -
> -	chip->teardown_irq(irq);
> -}
> -
> -int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
> +int setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
>  {
>  	struct msi_desc *entry;
>  	int ret;
>  	struct msi_chip *chip;
>  
>  	chip = arch_find_msi_chip(dev);
> -	if (chip && chip->setup_irqs)
> +	if (!chip)
> +		return -EINVAL;
> +
> +	if (chip->setup_irqs)
>  		return chip->setup_irqs(dev, nvec, type);
>  
>  	/*
>  	 * If an architecture wants to support multiple MSI, it needs to
> -	 * override arch_setup_msi_irqs()
> +	 * implement chip->setup_irqs().
>  	 */
>  	if (type == PCI_CAP_ID_MSI && nvec > 1)
>  		return 1;
>  
> +	if (!chip->setup_irq)
> +		return -EINVAL;
> +
>  	list_for_each_entry(entry, &dev->msi_list, list) {
> -		ret = arch_setup_msi_irq(dev, entry);
> +		ret = chip->setup_irq(dev, entry);
>  		if (ret < 0)
>  			return ret;
>  		if (ret > 0)
> @@ -87,13 +68,20 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
>  	return 0;
>  }
>  
> -/*
> - * We have a default implementation available as a separate non-weak
> - * function, as it is used by the Xen x86 PCI code
> - */
> -void default_teardown_msi_irqs(struct pci_dev *dev)
> +static void teardown_msi_irqs(struct pci_dev *dev)
>  {
>  	struct msi_desc *entry;
> +	struct msi_chip *chip;
> +
> +	chip = arch_find_msi_chip(dev);
> +	if (!chip)
> +		return;
> +
> +	if (chip->teardown_irqs)
> +		return chip->teardown_irqs(dev);
> +
> +	if (!chip->teardown_irq)
> +		return;
>  
>  	list_for_each_entry(entry, &dev->msi_list, list) {
>  		int i, nvec;
> @@ -104,20 +92,10 @@ void default_teardown_msi_irqs(struct pci_dev *dev)
>  		else
>  			nvec = 1 << entry->msi_attrib.multiple;
>  		for (i = 0; i < nvec; i++)
> -			arch_teardown_msi_irq(entry->irq + i);
> +			chip->teardown_irq(entry->irq + i);
>  	}
>  }
>  
> -void __weak arch_teardown_msi_irqs(struct pci_dev *dev)
> -{
> -	struct msi_chip *chip = arch_find_msi_chip(dev);
> -
> -	if (chip && chip->teardown_irqs)
> -		return chip->teardown_irqs(dev);
> -
> -	return default_teardown_msi_irqs(dev);
> -}
> -
>  static void default_restore_msi_irq(struct pci_dev *dev, int irq)
>  {
>  	struct msi_desc *entry;
> @@ -136,10 +114,18 @@ static void default_restore_msi_irq(struct pci_dev *dev, int irq)
>  		write_msi_msg(irq, &entry->msg);
>  }
>  
> -void __weak arch_restore_msi_irqs(struct pci_dev *dev)
> +static void default_restore_msi_irqs(struct pci_dev *dev)
>  {
> -	struct msi_chip *chip = arch_find_msi_chip(dev);
> +	struct msi_desc *entry = NULL;
> +
> +	list_for_each_entry(entry, &dev->msi_list, list) {
> +		default_restore_msi_irq(dev, entry->irq);
> +	}
> +}
>  
> +static void restore_msi_irqs(struct pci_dev *dev)
> +{
> +	struct msi_chip *chip = arch_find_msi_chip(dev);
>  	if (chip && chip->restore_irqs)
>  		return chip->restore_irqs(dev);
>  
> @@ -248,15 +234,6 @@ void unmask_msi_irq(struct irq_data *data)
>  	msi_set_mask_bit(data, 0);
>  }
>  
> -void default_restore_msi_irqs(struct pci_dev *dev)
> -{
> -	struct msi_desc *entry;
> -
> -	list_for_each_entry(entry, &dev->msi_list, list) {
> -		default_restore_msi_irq(dev, entry->irq);
> -	}
> -}
> -
>  void read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
>  {
>  	BUG_ON(entry->dev->current_state != PCI_D0);
> @@ -360,7 +337,7 @@ static void free_msi_irqs(struct pci_dev *dev)
>  			BUG_ON(irq_has_action(entry->irq + i));
>  	}
>  
> -	arch_teardown_msi_irqs(dev);
> +	teardown_msi_irqs(dev);
>  
>  	list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) {
>  		if (entry->msi_attrib.is_msix) {
> @@ -430,7 +407,7 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
>  
>  	pci_intx_for_msi(dev, 0);
>  	msi_set_enable(dev, 0);
> -	arch_restore_msi_irqs(dev);
> +	restore_msi_irqs(dev);
>  
>  	pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
>  	msi_mask_irq(entry, msi_mask(entry->msi_attrib.multi_cap),
> @@ -453,7 +430,7 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
>  	msix_clear_and_set_ctrl(dev, 0,
>  				PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL);
>  
> -	arch_restore_msi_irqs(dev);
> +	restore_msi_irqs(dev);
>  	list_for_each_entry(entry, &dev->msi_list, list) {
>  		msix_mask_irq(entry, entry->masked);
>  	}
> @@ -624,7 +601,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
>  	list_add_tail(&entry->list, &dev->msi_list);
>  
>  	/* Configure MSI capability structure */
> -	ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI);
> +	ret = setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI);
>  	if (ret) {
>  		msi_mask_irq(entry, mask, ~mask);
>  		free_msi_irqs(dev);
> @@ -740,7 +717,7 @@ static int msix_capability_init(struct pci_dev *dev,
>  	if (ret)
>  		return ret;
>  
> -	ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX);
> +	ret = setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX);
>  	if (ret)
>  		goto out_avail;
>  
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index 92a51e7..d6e1f7c 100644
> --- a/include/linux/msi.h
> +++ b/include/linux/msi.h
> @@ -51,20 +51,6 @@ struct msi_desc {
>  	struct kobject kobj;
>  };
>  
> -/*
> - * The arch hooks to setup up msi irqs. Those functions are
> - * implemented as weak symbols so that they /can/ be overriden by
> - * architecture specific code if needed.
> - */
> -int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
> -void arch_teardown_msi_irq(unsigned int irq);
> -int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
> -void arch_teardown_msi_irqs(struct pci_dev *dev);
> -void arch_restore_msi_irqs(struct pci_dev *dev);
> -
> -void default_teardown_msi_irqs(struct pci_dev *dev);
> -void default_restore_msi_irqs(struct pci_dev *dev);
> -
>  struct msi_chip {
>  	struct module *owner;
>  	struct device *dev;

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |

  reply	other threads:[~2014-09-15 14:47 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 10:09 [PATCH v1 00/21] Use MSI chip to configure MSI/MSI-X in all platforms Yijing Wang
2014-09-05 10:09 ` [PATCH v1 01/21] PCI/MSI: Clean up struct msi_chip argument Yijing Wang
2014-09-05 10:09 ` [PATCH v1 02/21] PCI/MSI: Remove useless bus->msi assignment Yijing Wang
2014-09-05 10:09 ` [PATCH v1 03/21] MSI: Remove the redundant irq_set_chip_data() Yijing Wang
2014-09-15 14:00   ` Lucas Stach
2014-09-16  1:30     ` Yijing Wang
2014-09-16 10:29       ` Lucas Stach
2014-09-16 10:37         ` Yijing Wang
2014-09-05 10:09 ` [PATCH v1 04/21] x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq() Yijing Wang
2014-09-10 12:36   ` [Xen-devel] " David Vrabel
2014-09-11  1:22     ` Yijing Wang
2014-09-11 13:08       ` David Vrabel
2014-09-05 10:09 ` [PATCH v1 05/21] PCI/MSI: Introduce weak arch_find_msi_chip() to find MSI chip Yijing Wang
2014-09-15 14:42   ` Lucas Stach
2014-09-16  2:08     ` Yijing Wang
2014-09-05 10:09 ` [PATCH v1 06/21] PCI/MSI: Refactor struct msi_chip to make it become more common Yijing Wang
2014-09-15 14:44   ` Lucas Stach
2014-09-16  2:09     ` Yijing Wang
2014-09-05 10:09 ` [PATCH v1 07/21] x86/MSI: Use MSI chip framework to configure MSI/MSI-X irq Yijing Wang
2014-09-05 10:09 ` [PATCH v1 08/21] x86/xen/MSI: " Yijing Wang
2014-09-05 14:29   ` [Xen-devel] " David Vrabel
2014-09-09  2:06     ` Yijing Wang
2014-09-10 12:38       ` David Vrabel
2014-09-10 14:59         ` Konrad Rzeszutek Wilk
2014-09-11  1:28           ` Yijing Wang
2014-09-11  1:27         ` Yijing Wang
2014-09-05 10:09 ` [PATCH v1 09/21] Irq_remapping/MSI: " Yijing Wang
2014-09-05 10:42   ` Sergei Shtylyov
2014-09-05 11:30     ` wangyijing
2014-09-05 10:09 ` [PATCH v1 10/21] x86/MSI: Remove unused MSI weak arch functions Yijing Wang
2014-09-05 10:09 ` [PATCH v1 11/21] MIPS/Octeon/MSI: Use MSI chip framework to configure MSI/MSI-X irq Yijing Wang
2014-09-05 10:09 ` [PATCH v1 12/21] MIPS/Xlp: Remove the dead function destroy_irq() to fix build error Yijing Wang
2014-09-05 10:09 ` [PATCH v1 13/21] MIPS/Xlp/MSI: Use MSI chip framework to configure MSI/MSI-X irq Yijing Wang
2014-09-05 10:09 ` [PATCH v1 14/21] MIPS/Xlr/MSI: " Yijing Wang
2014-09-05 10:10 ` [PATCH v1 15/21] Powerpc/MSI: " Yijing Wang
2014-09-05 10:47   ` Sergei Shtylyov
2014-09-05 11:33     ` wangyijing
2014-09-05 11:41       ` Sergei Shtylyov
2014-09-16  5:28   ` Michael Ellerman
2014-09-16  5:40     ` Yijing Wang
2014-09-05 10:10 ` [PATCH v1 16/21] s390/MSI: " Yijing Wang
2014-09-16 11:35   ` Sebastian Ott
2014-09-17  1:24     ` Yijing Wang
2014-09-05 10:10 ` [PATCH v1 17/21] arm/iop13xx/MSI: " Yijing Wang
2014-09-05 10:10 ` [PATCH v1 18/21] IA64/MSI: " Yijing Wang
2014-09-05 10:10 ` [PATCH v1 19/21] Sparc/MSI: " Yijing Wang
2014-09-05 10:10 ` [PATCH v1 20/21] tile/MSI: " Yijing Wang
2014-09-05 10:10 ` [PATCH v1 21/21] PCI/MSI: Clean up unused MSI arch functions Yijing Wang
2014-09-15 14:47   ` Lucas Stach [this message]
2014-09-16  2:09     ` Yijing Wang
2014-09-23 21:09 ` [PATCH v1 00/21] Use MSI chip to configure MSI/MSI-X in all platforms Bjorn Helgaas
2014-09-24  3:52   ` Yijing Wang

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=1410792430.3314.10.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).