Skip to contentSkip to conversation

PCI: endpoint: pci-epf-vntb: reduce several globals to statics

PATCH In review Tom Rix 4 participants 6 messages Jul 4, 2022 – Aug 12, 2022

Subsystems (3)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH v3 1/1 PCI: endpoint: pci-epf-vntb: 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")

---
v2,3 : Change commit prefix

---
 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
Acked-by on v3 1/1
#1 lore raw
Quoted 24 lines

-----Original Message-----
From: Tom Rix <[email protected]>
Sent: Monday, July 4, 2022 8:26 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Cc: [email protected]; [email protected]; Tom Rix <[email protected]>
Subject: [EXT] [PATCH v3] PCI: endpoint: pci-epf-vntb: reduce several globals to statics

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?

Quoted 6 lines

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")

Quoted 53 lines

---
v2,3 : Change commit prefix

---
 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

#2 lore raw
In reply to Tom Rix
Quoted 11 lines · Tom Rix

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")

Handled via Jon, I guess?

I'm unclear on the future direction of pci-epf-vntb.c. Jon, are you signing up to maintain this? MAINTAINERS doesn't seem to reflect that, even in next-20220712, so you're not being copied on everything.

If you are planning to merge and maintain this file, it would be helpful to me if you acknowledge patches you merge so I know to ignore them.

Quoted 47 lines

---
v2,3 : Change commit prefix

---
 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
maintainer
#3 lore raw
Quoted 15 lines · Bjorn Helgaas
Quoted 11 lines · Tom Rix

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")

Handled via Jon, I guess?

Quoted 7 lines

I'm unclear on the future direction of pci-epf-vntb.c. Jon, are you signing up to maintain this? MAINTAINERS doesn't seem to reflect that, even in next-20220712, so you're not being copied on everything.

If you are planning to merge and maintain this file, it would be helpful to me if you acknowledge patches you merge so I know to ignore them.

I massively dropped the ball on all the EPF stuff. I appologize profusely.

I'm pulling it into my ntb tree bcause of the patch dependencies. If you want me to own this stuff because it has ntb in it, then I can do a matainers entry to reflect it. My assumption is that because it is under the drivers/pci umbrella it is yours (unless you want me to own it). 100% defer to your decision.

All that being said...
Sorry for the extremely long delay in response. This series is in my ntb branch and will be in my pull request for v5.20 which should be going out later today.

Thanks,
Jon

Quoted 48 lines
Quoted 48 lines

---
v2,3 : Change commit prefix

---
 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
#4 lore raw
Quoted 7 lines · Jon Mason
Quoted 6 lines · Bjorn Helgaas

Handled via Jon, I guess?

I'm unclear on the future direction of pci-epf-vntb.c. Jon, are you signing up to maintain this? MAINTAINERS doesn't seem to reflect that, even in next-20220712, so you're not being copied on everything.

Quoted 5 lines
Quoted 3 lines

If you are planning to merge and maintain this file, it would be helpful to me if you acknowledge patches you merge so I know to ignore them.

I massively dropped the ball on all the EPF stuff. I appologize profusely.

No worries, sounds like you're getting everything sorted out :)

Quoted 5 lines

I'm pulling it into my ntb tree bcause of the patch dependencies. If you want me to own this stuff because it has ntb in it, then I can do a matainers entry to reflect it. My assumption is that because it is under the drivers/pci umbrella it is yours (unless you want me to own it). 100% defer to your decision.

This patch dependency thing feels like a one-time or at least unusual situation. Unless it becomes a problem, I think it makes sense to keep the drivers/pci umbrella instead of carving bits out of the middle.

Even if I continue to merge everything under drivers/pci, maybe we should consider an update like this just so you get cc'd on updates to these files?

MAINTAINERS +1 -0
index 08a5d70ceef9..5bafe7e8c2b2 100644
@@ -14466,6 +14466,7 @@ W:	https://github.com/jonmason/ntb/wiki
 T:	git git://github.com/jonmason/ntb.git
 F:	drivers/net/ntb_netdev.c
 F:	drivers/ntb/
+F:	drivers/pci/endpoint/functions/pci-epf-*ntb.c
 F:	include/linux/ntb.h
 F:	include/linux/ntb_transport.h
 F:	tools/testing/selftests/ntb/
maintainer
#5 lore raw
Quoted 37 lines · Bjorn Helgaas
Quoted 7 lines · Jon Mason
Quoted 6 lines · Bjorn Helgaas

Handled via Jon, I guess?

I'm unclear on the future direction of pci-epf-vntb.c. Jon, are you signing up to maintain this? MAINTAINERS doesn't seem to reflect that, even in next-20220712, so you're not being copied on everything.

Quoted 5 lines
Quoted 3 lines

If you are planning to merge and maintain this file, it would be helpful to me if you acknowledge patches you merge so I know to ignore them.

I massively dropped the ball on all the EPF stuff. I appologize profusely.

No worries, sounds like you're getting everything sorted out :)

Quoted 5 lines

I'm pulling it into my ntb tree bcause of the patch dependencies. If you want me to own this stuff because it has ntb in it, then I can do a matainers entry to reflect it. My assumption is that because it is under the drivers/pci umbrella it is yours (unless you want me to own it). 100% defer to your decision.

This patch dependency thing feels like a one-time or at least unusual situation. Unless it becomes a problem, I think it makes sense to keep the drivers/pci umbrella instead of carving bits out of the middle.

Even if I continue to merge everything under drivers/pci, maybe we should consider an update like this just so you get cc'd on updates to these files?

MAINTAINERS +0 -0
index 08a5d70ceef9..5bafe7e8c2b2 100644

MAINTAINERS W: https://github.com/jonmason/ntb/wiki · line 14472

Quoted 7 lines
MAINTAINERS +1 -0
@@ -14466,6 +14466,7 @@ W:      https://github.com/jonmason/ntb/wiki
 T:     git git://github.com/jonmason/ntb.git
 F:     drivers/net/ntb_netdev.c
 F:     drivers/ntb/
+F:     drivers/pci/endpoint/functions/pci-epf-*ntb.c
 F:     include/linux/ntb.h
 F:     include/linux/ntb_transport.h
 F:     tools/testing/selftests/ntb/

Works for me. I can do a patch to add this line to maintainers, send it to the people on this thread, and pull it into my pending pull request.

Thanks,
Jon