Skip to content

Commit 79e3f4a

Browse files
Murali Karicheribjorn-helgaas
Murali Karicheri
authored andcommitted
PCI: keystone: Fix MSI code that retrieves struct pcie_port pointer
Commit cbce790 ("PCI: designware: Make driver arch-agnostic") changed the host bridge sysdata pointer from the ARM pci_sys_data to the DesignWare pcie_port structure, and changed pcie-designware.c to reflect that. But it did not change the corresponding code in pci-keystone-dw.c, so it caused crashes on Keystone: Unable to handle kernel NULL pointer dereference at virtual address 00000030 pgd = c0003000 [00000030] *pgd=80000800004003, *pmd=00000000 Internal error: Oops: 206 [rib#1] PREEMPT SMP ARM CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.2-00139-gb74f926 rib#2 Hardware name: Keystone PC is at ks_dw_pcie_msi_irq_unmask+0x24/0x58 Change pci-keystone-dw.c to expect sysdata to be the struct pcie_port pointer. [bhelgaas: changelog] Fixes: cbce790 ("PCI: designware: Make driver arch-agnostic") Signed-off-by: Murali Karicheri <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> CC: [email protected] # v4.4+ CC: Zhou Wang <[email protected]>
1 parent 61d9e85 commit 79e3f4a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/pci/host/pci-keystone-dw.c

+3-8
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@
5858

5959
#define to_keystone_pcie(x) container_of(x, struct keystone_pcie, pp)
6060

61-
static inline struct pcie_port *sys_to_pcie(struct pci_sys_data *sys)
62-
{
63-
return sys->private_data;
64-
}
65-
6661
static inline void update_reg_offset_bit_pos(u32 offset, u32 *reg_offset,
6762
u32 *bit_pos)
6863
{
@@ -108,7 +103,7 @@ static void ks_dw_pcie_msi_irq_ack(struct irq_data *d)
108103
struct pcie_port *pp;
109104

110105
msi = irq_data_get_msi_desc(d);
111-
pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
106+
pp = (struct pcie_port *) msi_desc_to_pci_sysdata(msi);
112107
ks_pcie = to_keystone_pcie(pp);
113108
offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);
114109
update_reg_offset_bit_pos(offset, &reg_offset, &bit_pos);
@@ -146,7 +141,7 @@ static void ks_dw_pcie_msi_irq_mask(struct irq_data *d)
146141
u32 offset;
147142

148143
msi = irq_data_get_msi_desc(d);
149-
pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
144+
pp = (struct pcie_port *) msi_desc_to_pci_sysdata(msi);
150145
ks_pcie = to_keystone_pcie(pp);
151146
offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);
152147

@@ -167,7 +162,7 @@ static void ks_dw_pcie_msi_irq_unmask(struct irq_data *d)
167162
u32 offset;
168163

169164
msi = irq_data_get_msi_desc(d);
170-
pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
165+
pp = (struct pcie_port *) msi_desc_to_pci_sysdata(msi);
171166
ks_pcie = to_keystone_pcie(pp);
172167
offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);
173168

0 commit comments

Comments
 (0)