Skip to contentSkip to conversation

NTB: EPF: reduce several globals to statics

PATCH In review Tom Rix 2 participants 2 messages Jun 30, 2022

Subsystems (3)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 NTB: EPF: reduce several globals to statics

sparse reports
drivers/pci/endpoint/functions/pci-epf-vntb.c:956:10: warning: symbol 'pci_space' was not declared. Should it be static? drivers/pci/endpoint/functions/pci-epf-vntb.c:975:5: warning: symbol 'pci_read' was not declared. Should it be static? drivers/pci/endpoint/functions/pci-epf-vntb.c:984:5: warning: symbol 'pci_write' was not declared. Should it be static? drivers/pci/endpoint/functions/pci-epf-vntb.c:989:16: warning: symbol 'vpci_ops' was not declared. Should it be static?

These functions and variables are only used in pci-epf-vntb.c, so their storage class specifiers should be static.

Fixes ff32fac00d97 ("NTB: EPF: support NTB transfer between PCI RC and EP connection")
---
 drivers/pci/endpoint/functions/pci-epf-vntb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/endpoint/functions/pci-epf-vntb.c +4 -4
index ebf7e243eefa..6f0775b1fec3 100644
@@ -953,7 +953,7 @@ static struct config_group *epf_ntb_add_cfs(struct pci_epf *epf,
 
 #define VPCI_BUS_NUM 0x10
 
-uint32_t pci_space[] = {
+static uint32_t pci_space[] = {
 	(VNTB_VID | (VNTB_PID << 16)),	//DeviceID, Vendor ID
 	0,		// status, Command
 	0xffffffff,	// Class code, subclass, prog if, revision id
@@ -972,7 +972,7 @@ uint32_t pci_space[] = {
 	0,		//Max Lat, Min Gnt, interrupt pin, interrupt line
 };
 
-int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
+static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
 {
 	if (devfn == 0) {
 		memcpy(val, ((uint8_t *)pci_space) + where, size);
@@ -981,12 +981,12 @@ int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *
 	return -1;
 }
 
-int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
+static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
 {
 	return 0;
 }
 
-struct pci_ops vpci_ops = {
+static struct pci_ops vpci_ops = {
 	.read = pci_read,
 	.write = pci_write,
 };
Signature · 1 line
2.27.0
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Tom Rix <[email protected]>
Sent: Thursday, June 30, 2022 3:49 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Tom Rix <[email protected]>
Subject: [EXT] [PATCH] NTB: EPF: reduce several globals to statics

[Frank Li]
Bjorn Suggest use " PCI: endpoint: ..." at other similar fixed patch.

Quoted 70 lines

Caution: EXT Email

sparse reports drivers/pci/endpoint/functions/pci-epf-vntb.c:956:10: warning: symbol 'pci_space' was not declared. Should it be static? drivers/pci/endpoint/functions/pci-epf-vntb.c:975:5: warning: symbol 'pci_read' was not declared. Should it be static? drivers/pci/endpoint/functions/pci-epf-vntb.c:984:5: warning: symbol 'pci_write' was not declared. Should it be static? drivers/pci/endpoint/functions/pci-epf-vntb.c:989:16: warning: symbol 'vpci_ops' was not declared. Should it be static?

These functions and variables are only used in pci-epf-vntb.c, so their storage class specifiers should be static.

Fixes ff32fac00d97 ("NTB: EPF: support NTB transfer between PCI RC and EP

connection")

---

 drivers/pci/endpoint/functions/pci-epf-vntb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -1
index ebf7e243eefa..6f0775b1fec3 100644
@@ -953,7 +953,7 @@ static struct config_group *epf_ntb_add_cfs(struct
 pci_epf *epf,
 
 #define VPCI_BUS_NUM 0x10
 
-uint32_t pci_space[] = {
+static uint32_t pci_space[] = {
        (VNTB_VID | (VNTB_PID << 16)),  //DeviceID, Vendor ID
        0,              // status, Command
        0xffffffff,     // Class code, subclass, prog if, revision id
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -1
@@ -972,7 +972,7 @@ uint32_t pci_space[] = {
        0,              //Max Lat, Min Gnt, interrupt pin, interrupt line
 };
 
-int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32
 *val)
+static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int
 size, u32 *val)
 {
        if (devfn == 0) {
                memcpy(val, ((uint8_t *)pci_space) + where, size);
drivers/pci/endpoint/functions/pci-epf-vntb.c +0 -0
@@ -981,12 +981,12 @@ int pci_read(struct pci_bus *bus, unsigned int

devfn, int where, int size, u32 *

        return -1;

}

-int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
+static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)

 {
        return 0;

}

drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -2
-struct pci_ops vpci_ops = {
+static struct pci_ops vpci_ops = {
        .read = pci_read,
        .write = pci_write,
 };
--

2.27.0