Skip to content

Commit d1c696d

Browse files
Mani-Sadhasivambjorn-helgaas
authored andcommitted
PCI: host-common: Convert to library for host controller drivers
This common library will be used as a placeholder for helper functions shared by the host controller drivers. This avoids placing the host controller drivers specific helpers in drivers/pci/*.c, to avoid enlarging the kernel image on platforms that do not use host controller drivers at all (like x86/ACPI platforms). Suggested-by: Lukas Wunner <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 1a176b2 commit d1c696d

File tree

10 files changed

+33
-12
lines changed

10 files changed

+33
-12
lines changed

drivers/pci/controller/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
menu "PCI controller drivers"
44
depends on PCI
55

6+
config PCI_HOST_COMMON
7+
tristate
8+
select PCI_ECAM
9+
610
config PCI_AARDVARK
711
tristate "Aardvark PCIe controller"
812
depends on (ARCH_MVEBU && ARM64) || COMPILE_TEST
@@ -119,10 +123,6 @@ config PCI_FTPCI100
119123
depends on OF
120124
default ARCH_GEMINI
121125

122-
config PCI_HOST_COMMON
123-
tristate
124-
select PCI_ECAM
125-
126126
config PCI_HOST_GENERIC
127127
tristate "Generic PCI host controller"
128128
depends on OF

drivers/pci/controller/dwc/pcie-hisi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/pci-acpi.h>
1616
#include <linux/pci-ecam.h>
1717
#include "../../pci.h"
18+
#include "../pci-host-common.h"
1819

1920
#if defined(CONFIG_PCI_HISI) || (defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS))
2021

drivers/pci/controller/pci-host-common.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/*
3-
* Generic PCI host driver common code
3+
* Common library for PCI host controller drivers
44
*
55
* Copyright (C) 2014 ARM Limited
66
*
@@ -15,6 +15,8 @@
1515
#include <linux/pci-ecam.h>
1616
#include <linux/platform_device.h>
1717

18+
#include "pci-host-common.h"
19+
1820
static void gen_pci_unmap_cfg(void *ptr)
1921
{
2022
pci_ecam_free((struct pci_config_window *)ptr);
@@ -94,5 +96,5 @@ void pci_host_common_remove(struct platform_device *pdev)
9496
}
9597
EXPORT_SYMBOL_GPL(pci_host_common_remove);
9698

97-
MODULE_DESCRIPTION("Generic PCI host common driver");
99+
MODULE_DESCRIPTION("Common library for PCI host controller drivers");
98100
MODULE_LICENSE("GPL v2");
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Common library for PCI host controller drivers
4+
*
5+
* Copyright (C) 2014 ARM Limited
6+
*
7+
* Author: Will Deacon <[email protected]>
8+
*/
9+
10+
#ifndef _PCI_HOST_COMMON_H
11+
#define _PCI_HOST_COMMON_H
12+
13+
int pci_host_common_probe(struct platform_device *pdev);
14+
void pci_host_common_remove(struct platform_device *pdev);
15+
16+
#endif

drivers/pci/controller/pci-host-generic.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <linux/pci-ecam.h>
1515
#include <linux/platform_device.h>
1616

17+
#include "pci-host-common.h"
18+
1719
static const struct pci_ecam_ops gen_pci_cfg_cam_bus_ops = {
1820
.bus_shift = 16,
1921
.pci_ops = {

drivers/pci/controller/pci-thunder-ecam.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <linux/pci-ecam.h>
1212
#include <linux/platform_device.h>
1313

14+
#include "pci-host-common.h"
15+
1416
#if defined(CONFIG_PCI_HOST_THUNDER_ECAM) || (defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS))
1517

1618
static void set_val(u32 v, int where, int size, u32 *val)

drivers/pci/controller/pci-thunder-pem.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/platform_device.h>
1515
#include <linux/io-64-nonatomic-lo-hi.h>
1616
#include "../pci.h"
17+
#include "pci-host-common.h"
1718

1819
#if defined(CONFIG_PCI_HOST_THUNDER_PEM) || (defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS))
1920

drivers/pci/controller/pcie-apple.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include <linux/of_irq.h>
3030
#include <linux/pci-ecam.h>
3131

32+
#include "pci-host-common.h"
33+
3234
#define CORE_RC_PHYIF_CTL 0x00024
3335
#define CORE_RC_PHYIF_CTL_RUN BIT(0)
3436
#define CORE_RC_PHYIF_STAT 0x00028

drivers/pci/controller/plda/pcie-microchip-host.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/wordpart.h>
2424

2525
#include "../../pci.h"
26+
#include "../pci-host-common.h"
2627
#include "pcie-plda.h"
2728

2829
#define MC_MAX_NUM_INBOUND_WINDOWS 8

include/linux/pci-ecam.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,4 @@ extern const struct pci_ecam_ops al_pcie_ops; /* Amazon Annapurna Labs PCIe */
9393
extern const struct pci_ecam_ops tegra194_pcie_ops; /* Tegra194 PCIe */
9494
extern const struct pci_ecam_ops loongson_pci_ecam_ops; /* Loongson PCIe */
9595
#endif
96-
97-
#if IS_ENABLED(CONFIG_PCI_HOST_COMMON)
98-
/* for DT-based PCI controllers that support ECAM */
99-
int pci_host_common_probe(struct platform_device *pdev);
100-
void pci_host_common_remove(struct platform_device *pdev);
101-
#endif
10296
#endif

0 commit comments

Comments
 (0)