PCI/portdrv: Squash into portdrv.c
cover PCI/portdrv: Squash into portdrv.c
From: Bjorn Helgaas <[email protected]>
The PCIe portdrv is split across portdrv_core.c and portdrv_pci.c, but neither is very big and it's a hassle to figure out which to look at.
Squash them into a single portdrv.c file. Make functions static and non-exported when possible, and move some private things out of portdrv.h.
Please comment.
Bjorn Helgaas (3):
PCI/portdrv: Squash into portdrv.c PCI/portdrv: Move private things to portdrv.c PCI/portdrv: Unexport pcie_port_service_register(),
pcie_port_service_unregister()
drivers/pci/pcie/Makefile | 2 +-
.../pci/pcie/{portdrv_core.c => portdrv.c} | 263 +++++++++++++++++-
drivers/pci/pcie/portdrv.h | 19 --
drivers/pci/pcie/portdrv_pci.c | 252 -----------------
4 files changed, 253 insertions(+), 283 deletions(-)
rename drivers/pci/pcie/{portdrv_core.c => portdrv.c} (69%)
delete mode 100644 drivers/pci/pcie/portdrv_pci.cSignature · 1 line
2.25.1
PATCH 1/3 PCI/portdrv: Squash into portdrv.c
From: Bjorn Helgaas <[email protected]>
Squash portdrv_core.c and portdrv_pci.c into portdrv.c to make it easier to find things. The whole thing is less than 1000 lines, and it's a pain to bounce back and forth between two files.
Several portdrv_core.c functions were non-static because they were referenced from portdrv_pci.c. Make them static since they're now all in portdrv.c.
No functional change intended.
---
drivers/pci/pcie/Makefile | 2 +-
.../pci/pcie/{portdrv_core.c => portdrv.c} | 252 +++++++++++++++++-
drivers/pci/pcie/portdrv.h | 10 -
drivers/pci/pcie/portdrv_pci.c | 252 ------------------
4 files changed, 244 insertions(+), 272 deletions(-)
rename drivers/pci/pcie/{portdrv_core.c => portdrv.c} (70%)
delete mode 100644 drivers/pci/pcie/portdrv_pci.cdrivers/pci/pcie/Makefile +1 -1
@@ -2,7 +2,7 @@ # # Makefile for PCI Express features and port driver -pcieportdrv-y := portdrv_core.o portdrv_pci.o rcec.o +pcieportdrv-y := portdrv.o rcec.o obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o
drivers/pci/pcie/portdrv.c renamed from drivers/pci/pcie/portdrv_core.c +243 -9
312 lines not on this page · raw message
drivers/pci/pcie/portdrv.h +0 -10
@@ -108,16 +108,6 @@ void pcie_port_service_unregister(struct pcie_port_service_driver *new);#define get_descriptor_id (type, service) (((type - 4) << 8) | service)extern struct bus_type pcie_port_bus_type; -int pcie_port_device_register (struct pci_dev *dev); -int pcie_port_device_iter (struct device *dev,void *data); -#ifdef CONFIG_PM -int pcie_port_device_suspend (struct device *dev); -int pcie_port_device_resume_noirq (struct device *dev); -int pcie_port_device_resume (struct device *dev); -int pcie_port_device_runtime_suspend (struct device *dev); -int pcie_port_device_runtime_resume (struct device *dev); -#endif -void pcie_port_device_remove (struct pci_dev *dev);struct pci_dev ;
drivers/pci/pcie/portdrv_pci.c deleted +0 -252
252 lines not on this page · raw message
Signature · 1 line
2.25.1
Looks good:
PATCH 2/3 PCI/portdrv: Move private things to portdrv.c
In reply to Bjorn HelgaasFrom: Bjorn Helgaas <[email protected]>
Previously several things used by portdrv_core.c and portdrv_pci.c were shared by defining them in portdrv.h. Now that portdrv_core.c and portdrv_pci.c have been squashed, move things that can be private into portdrv.c. No functional change intended.
--- drivers/pci/pcie/portdrv.c | 9 +++++++++ drivers/pci/pcie/portdrv.h | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/pci/pcie/portdrv.c +9 -0
@@ -21,6 +21,15 @@#include "../pci.h" #include "portdrv.h" +/* +* The PCIe Capability Interrupt Message Number (PCIe r3.1, sec 7.8.2) must +* be one of the first 32 MSI-X entries. Per PCI r3.0, sec 6.8.3.1, MSI +* supports a maximum of 32 vectors per function. +*/ +#define PCIE_PORT_MAX_MSI_ENTRIES 32 + +#define get_descriptor_id (type, service) (((type - 4) << 8) | service) +struct portdrv_service_data {struct pcie_port_service_driver *drv;struct device *dev;
drivers/pci/pcie/portdrv.h +0 -9
@@ -98,15 +98,6 @@ struct pcie_port_service_driver {int pcie_port_service_register (struct pcie_port_service_driver *new);void pcie_port_service_unregister (struct pcie_port_service_driver *new); -/* -* The PCIe Capability Interrupt Message Number (PCIe r3.1, sec 7.8.2) must -* be one of the first 32 MSI-X entries. Per PCI r3.0, sec 6.8.3.1, MSI -* supports a maximum of 32 vectors per function. -*/ -#define PCIE_PORT_MAX_MSI_ENTRIES 32 - -#define get_descriptor_id (type, service) (((type - 4) << 8) | service) -extern struct bus_type pcie_port_bus_type;struct pci_dev ;
Signature · 1 line
2.25.1
Re: [PATCH 2/3] PCI/portdrv: Move private things to portdrv.c
Looks good:
PATCH 3/3 PCI/portdrv: Unexport pcie_port_service_register(), pcie_port_service_unregister()
In reply to Bjorn HelgaasFrom: Bjorn Helgaas <[email protected]>
pcie_port_service_register() and pcie_port_service_unregister() are used only by the pciehp, aer, dpc, and pme PCIe port service drivers, none of which can be modules. Unexport pcie_port_service_register() and pcie_port_service_unregister(). No functional change intended.
--- drivers/pci/pcie/portdrv.c | 2 -- 1 file changed, 2 deletions(-)
drivers/pci/pcie/portdrv.c +0 -2
@@ -584,7 +584,6 @@ int pcie_port_service_register(struct pcie_port_service_driver *new)return driver_register (&new->driver); } -EXPORT_SYMBOL (pcie_port_service_register);/** * pcie_port_service_unregister - unregister PCI Express port service driver
@@ -594,7 +593,6 @@ void pcie_port_service_unregister(struct pcie_port_service_driver *drv) {driver_unregister (&drv->driver); } -EXPORT_SYMBOL (pcie_port_service_unregister);/* If this switch is set, PCIe port native services should not be enabled. */ bool pcie_ports_disabled;
Signature · 1 line
2.25.1
Re: [PATCH 3/3] PCI/portdrv: Unexport pcie_port_service_register(), pcie_port_service_unregister()
Quoted 6 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
pcie_port_service_register()andpcie_port_service_unregister()are used only by the pciehp, aer, dpc, and pme PCIe port service drivers, none of which can be modules. Unexportpcie_port_service_register()andpcie_port_service_unregister(). No functional change intended.
Looks good:
Quoted 7 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
The PCIe portdrv is split across
portdrv_core.candportdrv_pci.c, but neither is very big and it's a hassle to figure out which to look at.Squash them into a single
portdrv.cfile. Make functions static and non-exported when possible, and move some private things out ofportdrv.h.
Looks like a nice cleanup.
Quoted 16 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
The PCIe portdrv is split across
portdrv_core.candportdrv_pci.c, but neither is very big and it's a hassle to figure out which to look at.Squash them into a single
portdrv.cfile. Make functions static and non-exported when possible, and move some private things out ofportdrv.h.Please comment.
Bjorn Helgaas (3):
PCI/portdrv: Squash intoportdrv.cPCI/portdrv: Move private things toportdrv.cPCI/portdrv: Unexportpcie_port_service_register(),
pcie_port_service_unregister()
Quoted 7 lines
drivers/pci/pcie/Makefile | 2 +-
.../pci/pcie/{portdrv_core.c => portdrv.c} | 263 +++++++++++++++++-
drivers/pci/pcie/portdrv.h | 19 --
drivers/pci/pcie/portdrv_pci.c | 252 -----------------
4 files changed, 253 insertions(+), 283 deletions(-)
rename drivers/pci/pcie/{portdrv_core.c => portdrv.c} (69%)
delete mode 100644 drivers/pci/pcie/portdrv_pci.cI applied these to pci/portdrv for v6.2 with Reviewed-Bys from Christoph and Keith. Thanks for taking a look!
Bjorn