All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Jiang Liu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: michal.simek@xilinx.com, jiang.liu@linux.intel.com,
	soren.brinkmann@xilinx.com, bp@alien8.de, sthokal@xilinx.com,
	grant.likely@linaro.org, hpa@zytor.com, mingo@kernel.org,
	stuart.yoder@freescale.com, pratyush.anand@gmail.com,
	bhelgaas@google.com, marc.zyngier@arm.com, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, wangyijing@huawei.com,
	jingoohan1@gmail.com, m-karicheri2@ti.com, tony.luck@intel.com,
	robh@kernel.org
Subject: [tip:irq/core] PCI: Use helper functions to access fields in struct msi_desc
Date: Wed, 22 Jul 2015 13:39:58 -0700	[thread overview]
Message-ID: <tip-e39758e0ea769e632e5e3c9f314160e55c2153ff@git.kernel.org> (raw)
In-Reply-To: <1436428847-8886-9-git-send-email-jiang.liu@linux.intel.com>

Commit-ID:  e39758e0ea769e632e5e3c9f314160e55c2153ff
Gitweb:     http://git.kernel.org/tip/e39758e0ea769e632e5e3c9f314160e55c2153ff
Author:     Jiang Liu <jiang.liu@linux.intel.com>
AuthorDate: Thu, 9 Jul 2015 16:00:43 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 22 Jul 2015 18:37:43 +0200

PCI: Use helper functions to access fields in struct msi_desc

Use helper functions to access fields in struct msi_desc, so we could
easily refine msi_desc later.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Reviewed-by: Yijing Wang <wangyijing@huawei.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Stuart Yoder <stuart.yoder@freescale.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Murali Karicheri <m-karicheri2@ti.com>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Pratyush Anand <pratyush.anand@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Soeren Brinkmann <soren.brinkmann@xilinx.com>
Cc: Srikanth Thokala <sthokal@xilinx.com>
Cc: Rob Herring <robh@kernel.org>
Link: http://lkml.kernel.org/r/1436428847-8886-9-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/pci/host/pci-keystone-dw.c |  6 +++---
 drivers/pci/host/pcie-designware.c |  4 ++--
 drivers/pci/host/pcie-xilinx.c     | 12 +++++-------
 drivers/pci/msi.c                  | 13 ++++++++-----
 4 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-keystone-dw.c b/drivers/pci/host/pci-keystone-dw.c
index e42d077..6f3abc2 100644
--- a/drivers/pci/host/pci-keystone-dw.c
+++ b/drivers/pci/host/pci-keystone-dw.c
@@ -108,7 +108,7 @@ static void ks_dw_pcie_msi_irq_ack(struct irq_data *d)
 	struct pcie_port *pp;
 
 	msi = irq_data_get_msi_desc(d);
-	pp = sys_to_pcie(msi->dev->bus->sysdata);
+	pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
 	ks_pcie = to_keystone_pcie(pp);
 	offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);
 	update_reg_offset_bit_pos(offset, &reg_offset, &bit_pos);
@@ -146,7 +146,7 @@ static void ks_dw_pcie_msi_irq_mask(struct irq_data *d)
 	u32 offset;
 
 	msi = irq_data_get_msi_desc(d);
-	pp = sys_to_pcie(msi->dev->bus->sysdata);
+	pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
 	ks_pcie = to_keystone_pcie(pp);
 	offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);
 
@@ -167,7 +167,7 @@ static void ks_dw_pcie_msi_irq_unmask(struct irq_data *d)
 	u32 offset;
 
 	msi = irq_data_get_msi_desc(d);
-	pp = sys_to_pcie(msi->dev->bus->sysdata);
+	pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
 	ks_pcie = to_keystone_pcie(pp);
 	offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);
 
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 85c7735..aae6dcb 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -255,7 +255,7 @@ static void dw_pcie_msi_set_irq(struct pcie_port *pp, int irq)
 static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos)
 {
 	int irq, pos0, i;
-	struct pcie_port *pp = sys_to_pcie(desc->dev->bus->sysdata);
+	struct pcie_port *pp = sys_to_pcie(msi_desc_to_pci_sysdata(desc));
 
 	pos0 = bitmap_find_free_region(pp->msi_irq_in_use, MAX_MSI_IRQS,
 				       order_base_2(no_irqs));
@@ -327,7 +327,7 @@ static void dw_msi_teardown_irq(struct msi_controller *chip, unsigned int irq)
 {
 	struct irq_data *data = irq_get_irq_data(irq);
 	struct msi_desc *msi = irq_data_get_msi_desc(data);
-	struct pcie_port *pp = sys_to_pcie(msi->dev->bus->sysdata);
+	struct pcie_port *pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
 
 	clear_irq_range(pp, irq, 1, data->hwirq);
 }
diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index f1a06a0..64454f4 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -227,18 +227,16 @@ static struct pci_ops xilinx_pcie_ops = {
  */
 static void xilinx_pcie_destroy_msi(unsigned int irq)
 {
-	struct irq_desc *desc;
 	struct msi_desc *msi;
 	struct xilinx_pcie_port *port;
 
-	desc = irq_to_desc(irq);
-	msi = irq_desc_get_msi_desc(desc);
-	port = sys_to_pcie(msi->dev->bus->sysdata);
-
-	if (!test_bit(irq, msi_irq_in_use))
+	if (!test_bit(irq, msi_irq_in_use)) {
+		msi = irq_get_msi_desc(irq);
+		port = sys_to_pcie(msi_desc_to_pci_sys_data(msi));
 		dev_err(port->dev, "Trying to free unused MSI#%d\n", irq);
-	else
+	} else {
 		clear_bit(irq, msi_irq_in_use);
+	}
 }
 
 /**
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 540613e..f0714c3 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -208,7 +208,8 @@ u32 __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag)
 
 	mask_bits &= ~mask;
 	mask_bits |= flag;
-	pci_write_config_dword(desc->dev, desc->mask_pos, mask_bits);
+	pci_write_config_dword(msi_desc_to_pci_dev(desc), desc->mask_pos,
+			       mask_bits);
 
 	return mask_bits;
 }
@@ -288,7 +289,9 @@ void default_restore_msi_irqs(struct pci_dev *dev)
 
 void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 {
-	BUG_ON(entry->dev->current_state != PCI_D0);
+	struct pci_dev *dev = msi_desc_to_pci_dev(entry);
+
+	BUG_ON(dev->current_state != PCI_D0);
 
 	if (entry->msi_attrib.is_msix) {
 		void __iomem *base = entry->mask_base +
@@ -298,7 +301,6 @@ void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 		msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR);
 		msg->data = readl(base + PCI_MSIX_ENTRY_DATA);
 	} else {
-		struct pci_dev *dev = entry->dev;
 		int pos = dev->msi_cap;
 		u16 data;
 
@@ -318,7 +320,9 @@ void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 
 void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 {
-	if (entry->dev->current_state != PCI_D0) {
+	struct pci_dev *dev = msi_desc_to_pci_dev(entry);
+
+	if (dev->current_state != PCI_D0) {
 		/* Don't touch the hardware now */
 	} else if (entry->msi_attrib.is_msix) {
 		void __iomem *base;
@@ -329,7 +333,6 @@ void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 		writel(msg->address_hi, base + PCI_MSIX_ENTRY_UPPER_ADDR);
 		writel(msg->data, base + PCI_MSIX_ENTRY_DATA);
 	} else {
-		struct pci_dev *dev = entry->dev;
 		int pos = dev->msi_cap;
 		u16 msgctl;
 

  parent reply	other threads:[~2015-07-22 20:40 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09  8:00 [RFC Patch V1 00/12] Reorganize struct msi_desc to prepare for support of generic MSI Jiang Liu
2015-07-09  8:00 ` Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 01/12] PCI: Add helper function msi_desc_to_pci_sysdata() Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-22 20:37   ` [tip:irq/core] " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 02/12] MIPS, PCI: Use for_pci_msi_entry() to access MSI device list Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-09 11:03   ` Sergei Shtylyov
2015-07-09 11:03     ` Sergei Shtylyov
2015-07-22 20:37   ` [tip:irq/core] MIPS/PCI: " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 03/12] PowerPC, PCI: " Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-22 20:38   ` [tip:irq/core] powerpc/PCI: " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 04/12] s390/pci: " Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-13 12:47   ` Sebastian Ott
2015-07-13 12:47     ` Sebastian Ott
2015-07-22 20:38   ` [tip:irq/core] " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 05/12] x86, PCI: " Jiang Liu
2015-07-09  8:00 ` Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-09 19:07   ` Konrad Rzeszutek Wilk
2015-07-09 19:07     ` Konrad Rzeszutek Wilk
2015-07-09 19:07   ` Konrad Rzeszutek Wilk
2015-07-22 20:38   ` [tip:irq/core] x86/PCI: " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 06/12] PCI: " Jiang Liu
2015-07-09  8:00 ` Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-09 19:08   ` Konrad Rzeszutek Wilk
2015-07-09 19:08   ` Konrad Rzeszutek Wilk
2015-07-09 19:08     ` Konrad Rzeszutek Wilk
2015-07-22 20:39   ` [tip:irq/core] PCI: Use for_each_pci_msi_entry() " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 07/12] sparc, PCI: Use helper functions to access fields in struct msi_desc Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-09  8:00   ` David Miller
2015-07-09  8:00     ` David Miller
2015-07-09  8:00     ` David Miller
2015-07-22 20:39   ` [tip:irq/core] sparc/PCI: " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 08/12] PCI: " Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-12 11:18   ` Jingoo Han
2015-07-12 11:18     ` Jingoo Han
2015-07-22 20:39   ` tip-bot for Jiang Liu [this message]
2015-07-09  8:00 ` [RFC Patch V1 09/12] genirq: Move msi_list from struct pci_dev to struct device Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-10  0:19   ` Paul Gortmaker
2015-07-10  0:19     ` Paul Gortmaker
2015-07-21 22:02     ` Thomas Gleixner
2015-07-21 22:02       ` Thomas Gleixner
2015-07-22 20:40   ` [tip:irq/core] genirq/MSI: " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 10/12] genirq, PCI: Store 'struct device *' instead 'struct pci_dev *' in struct msi_desc Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-22 20:40   ` [tip:irq/core] genirq/MSI: Store 'struct device' instead of ' struct pci_dev' " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 11/12] genirq, PCI: Reorginize struct msi_desc to prepare for support of generic MSI Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-10 12:41   ` Marc Zyngier
2015-07-10 12:41     ` Marc Zyngier
2015-07-22 20:41   ` [tip:irq/core] genirq/MSI: " tip-bot for Jiang Liu
2015-07-09  8:00 ` [RFC Patch V1 12/12] genirq, PCI: Move alloc_msi_entry() from PCI MSI code into generic MSI code Jiang Liu
2015-07-09  8:00   ` Jiang Liu
2015-07-22 20:41   ` [tip:irq/core] genirq/MSI: Move alloc_msi_entry() from PCI " tip-bot for Jiang Liu
2015-07-10  1:41 ` [RFC Patch V1 00/12] Reorganize struct msi_desc to prepare for support of generic MSI Yijing Wang
2015-07-10  1:41   ` Yijing Wang
2015-07-10 12:54 ` Marc Zyngier
2015-07-10 12:54   ` Marc Zyngier
2015-07-21  8:31 ` Thomas Gleixner
2015-07-21  8:31   ` Thomas Gleixner
2015-07-21 13:30 ` Bjorn Helgaas
2015-07-21 13:30   ` Bjorn Helgaas
2015-07-21 15:51   ` Thomas Gleixner
2015-07-21 15:51     ` Thomas Gleixner

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-e39758e0ea769e632e5e3c9f314160e55c2153ff@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=grant.likely@linaro.org \
    --cc=hpa@zytor.com \
    --cc=jiang.liu@linux.intel.com \
    --cc=jingoohan1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=marc.zyngier@arm.com \
    --cc=michal.simek@xilinx.com \
    --cc=mingo@kernel.org \
    --cc=pratyush.anand@gmail.com \
    --cc=robh@kernel.org \
    --cc=soren.brinkmann@xilinx.com \
    --cc=sthokal@xilinx.com \
    --cc=stuart.yoder@freescale.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=wangyijing@huawei.com \
    /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.