Skip to contentSkip to conversation

PCI: endpoint: Replace magic number "6" by PCI_STD_NUM_BARS

PATCH Applied Rick Wertenbroek 2 participants 3 messages Dec 12, 2024 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: endpoint: Replace magic number "6" by PCI_STD_NUM_BARS

Replace the constant "6" by PCI_STD_NUM_BARS, as defined in include/uapi/linux/pci_regs.h:

---
 include/linux/pci-epf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/pci-epf.h +2 -2
index 18a3aeb62ae4..ee6156bcbbd0 100644
@@ -157,7 +157,7 @@ struct pci_epf {
 	struct device		dev;
 	const char		*name;
 	struct pci_epf_header	*header;
-	struct pci_epf_bar	bar[6];
+	struct pci_epf_bar	bar[PCI_STD_NUM_BARS];
 	u8			msi_interrupts;
 	u16			msix_interrupts;
 	u8			func_no;
@@ -174,7 +174,7 @@ struct pci_epf {
 	/* Below members are to attach secondary EPC to an endpoint function */
 	struct pci_epc		*sec_epc;
 	struct list_head	sec_epc_list;
-	struct pci_epf_bar	sec_epc_bar[6];
+	struct pci_epf_bar	sec_epc_bar[PCI_STD_NUM_BARS];
 	u8			sec_epc_func_no;
 	struct config_group	*group;
 	unsigned int		is_bound;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 32 lines · Rick Wertenbroek

Replace the constant "6" by PCI_STD_NUM_BARS, as defined in include/uapi/linux/pci_regs.h:

---
 include/linux/pci-epf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/pci-epf.h +2 -3
index 18a3aeb62ae4..ee6156bcbbd0 100644
@@ -157,7 +157,7 @@ struct pci_epf {
        struct device           dev;
        const char              *name;
        struct pci_epf_header   *header;
-       struct pci_epf_bar      bar[6];
+       struct pci_epf_bar      bar[PCI_STD_NUM_BARS];
        u8                      msi_interrupts;
        u16                     msix_interrupts;
        u8                      func_no;
@@ -174,7 +174,7 @@ struct pci_epf {
        /* Below members are to attach secondary EPC to an endpoint function */
        struct pci_epc          *sec_epc;
        struct list_head        sec_epc_list;
-       struct pci_epf_bar      sec_epc_bar[6];
+       struct pci_epf_bar      sec_epc_bar[PCI_STD_NUM_BARS];
        u8                      sec_epc_func_no;
        struct config_group     *group;
        unsigned int            is_bound;
--
Quoted 2 lines

2.25.1

The commit message was supposed to state :

---

PCI: endpoint: Replace magic number "6" by PCI_STD_NUM_BARS

Replace the constant "6" by PCI_STD_NUM_BARS, as defined in include/uapi/linux/pci_regs.h:
#define PCI_STD_NUM_BARS 6 /* Number of standard BARs */

---

But the line starting with # got eaten away as a comment. Sorry about that.
Best regards,
Rick

#2 lore raw
In reply to Rick Wertenbroek
Quoted 4 lines · Rick Wertenbroek

Replace the constant "6" by PCI_STD_NUM_BARS, as defined in include/uapi/linux/pci_regs.h:

Applied to pci/endpoint for v6.14, thanks!

Quoted 29 lines
---
 include/linux/pci-epf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/pci-epf.h +2 -2
index 18a3aeb62ae4..ee6156bcbbd0 100644
@@ -157,7 +157,7 @@ struct pci_epf {
 	struct device		dev;
 	const char		*name;
 	struct pci_epf_header	*header;
-	struct pci_epf_bar	bar[6];
+	struct pci_epf_bar	bar[PCI_STD_NUM_BARS];
 	u8			msi_interrupts;
 	u16			msix_interrupts;
 	u8			func_no;
@@ -174,7 +174,7 @@ struct pci_epf {
 	/* Below members are to attach secondary EPC to an endpoint function */
 	struct pci_epc		*sec_epc;
 	struct list_head	sec_epc_list;
-	struct pci_epf_bar	sec_epc_bar[6];
+	struct pci_epf_bar	sec_epc_bar[PCI_STD_NUM_BARS];
 	u8			sec_epc_func_no;
 	struct config_group	*group;
 	unsigned int		is_bound;
Signature · 1 line
2.25.1