PCI: pciehp: Consolidate code files
PATCH 1/1 PCI: pciehp: Consolidate code files
The code in the pciehp driver is a bit painful to read because of the criss-cross calls that cross file boundaries making the split to multiple files feel quite artificial.
Consolidate the code into single pciehp.c. The split files are not simply merged as is but the functions are grouped based on functionality and order that avoids most forward declarations.
---
Based on top of pci/hotplug. Has a minor conflict with the LBMS reset change in the pci/bwctrl branch.
The move is generated with a script to avoid copy-paste errors. It might help review to check diff pre/post change with e.g. command like this to see what truly was changed (after applying the patch):
"diff -u <(git diff-tree -p HEAD | grep '^[-]' | cut -b 2- | rev | sort | rev) <(cat drivers/pci/hotplug/pciehp.c | rev | sort | rev)"
I've a few cleanup already on my TODO list wrt. this code but with the merge window coming up, it seems better to just try to get the move done now that it shouldn't have major conflicts and leave the cleanups later.
drivers/pci/hotplug/Makefile | 5 - drivers/pci/hotplug/pciehp.c | 2151 +++++++++++++++++++++++++++++ drivers/pci/hotplug/pciehp.h | 212 --- drivers/pci/hotplug/pciehp_core.c | 383 ----- drivers/pci/hotplug/pciehp_ctrl.c | 445 ------ drivers/pci/hotplug/pciehp_hpc.c | 1123 --------------- drivers/pci/hotplug/pciehp_pci.c | 141 -- 7 files changed, 2151 insertions(+), 2309 deletions(-) create mode 100644 drivers/pci/hotplug/pciehp.c delete mode 100644 drivers/pci/hotplug/pciehp.h delete mode 100644 drivers/pci/hotplug/pciehp_core.c delete mode 100644 drivers/pci/hotplug/pciehp_ctrl.c delete mode 100644 drivers/pci/hotplug/pciehp_hpc.c delete mode 100644 drivers/pci/hotplug/pciehp_pci.c
drivers/pci/hotplug/Makefile +0 -5
@@ -62,11 +62,6 @@ rpaphp-objs := rpaphp_core.o \ rpadlpar_io-objs := rpadlpar_core.o \ rpadlpar_sysfs.o -pciehp-objs := pciehp_core.o \ - pciehp_ctrl.o \ - pciehp_pci.o \ - pciehp_hpc.o - shpchp-objs := shpchp_core.o \ shpchp_ctrl.o \ shpchp_pci.o \
drivers/pci/hotplug/pciehp.c new file +2151 -0
2,151 lines not on this page · raw message
drivers/pci/hotplug/pciehp.h deleted +0 -212
212 lines not on this page · raw message
drivers/pci/hotplug/pciehp_core.c deleted +0 -383
383 lines not on this page · raw message
drivers/pci/hotplug/pciehp_ctrl.c deleted +0 -445
243 lines not on this page · raw message
drivers/pci/hotplug/pciehp_hpc.c deleted +0 -1123
1,123 lines not on this page · raw message
drivers/pci/hotplug/pciehp_pci.c deleted +0 -141
141 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
base-commit: d46b3918fac499f60b7df1cb1437af7344480576
Signature · 1 line
2.39.5
Part of the diff is not shown here. View the raw message.
Quoted 7 lines · Ilpo Järvinen
The code in the pciehp driver is a bit painful to read because of the criss-cross calls that cross file boundaries making the split to multiple files feel quite artificial.
Consolidate the code into single
pciehp.c. The split files are not simply merged as is but the functions are grouped based on functionality and order that avoids most forward declarations.
[...]
Quoted 8 lines
drivers/pci/hotplug/Makefile | 5 - drivers/pci/hotplug/pciehp.c | 2151 +++++++++++++++++++++++++++++ drivers/pci/hotplug/pciehp.h | 212 --- drivers/pci/hotplug/pciehp_core.c | 383 ----- drivers/pci/hotplug/pciehp_ctrl.c | 445 ------ drivers/pci/hotplug/pciehp_hpc.c | 1123 --------------- drivers/pci/hotplug/pciehp_pci.c | 141 -- 7 files changed, 2151 insertions(+), 2309 deletions(-)
Ugh, I understand that the current state is suboptimal to grok the code, but a single file with 2000+ LoC isn't much better in terms of maintainability. I think partitioning the code into separate files does make sense, just the current (historically grown) structure can be improved upon. Let me think what a more logical separation might look like...
Thanks,
Lukas