Skip to contentSkip to conversation

pcmcia: Convert to use less arguments in pci_bus_for_each_resource()

PATCH Applied Andy Shevchenko 2 participants 6 messages Oct 30, 2023 – Mar 30 Pcmcia

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pcmcia: Convert to use less arguments in pci_bus_for_each_resource()

The pci_bus_for_each_resource() can hide the iterator loop since it may be not used otherwise. With this, we may drop that iterator variable definition.

---

Split out of a series: [email protected].

Fixed the second hunk in nonstatic_autoadd_resources() to avoid potential breakage.

 drivers/pcmcia/rsrc_nonstatic.c | 6 +++---
 drivers/pcmcia/yenta_socket.c   | 3 +--
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/pcmcia/rsrc_nonstatic.c +3 -3
index bf9d070a4496..39da2ad9d0b2 100644
@@ -934,7 +934,7 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
 static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
 {
 	struct resource *res;
-	int i, done = 0;
+	int done = 0;
 
 	if (!s->cb_dev || !s->cb_dev->bus)
 		return -ENODEV;
@@ -961,10 +961,10 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
 	if (s->cb_dev->bus->number == 0)
 		return -EINVAL;
 
-	for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {
+	for (unsigned int i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {
 		res = s->cb_dev->bus->resource[i];
 #else
-	pci_bus_for_each_resource(s->cb_dev->bus, res, i) {
+	pci_bus_for_each_resource(s->cb_dev->bus, res) {
 #endif
 		if (!res)
 			continue;
drivers/pcmcia/yenta_socket.c +1 -2
index 1365eaa20ff4..fd18ab571ce8 100644
@@ -673,9 +673,8 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
 			    u32 min)
 {
 	struct resource *root;
-	int i;
 
-	pci_bus_for_each_resource(socket->dev->bus, root, i) {
+	pci_bus_for_each_resource(socket->dev->bus, root) {
 		if (!root)
 			continue;
 
Signature · 1 line
2.40.0.1.gaa8946217a0b
#1 lore raw
Quoted 3 lines · Andy Shevchenko

The pci_bus_for_each_resource() can hide the iterator loop since it may be not used otherwise. With this, we may drop that iterator variable definition.

Can it be now applied?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Am Thu, Feb 01, 2024 at 05:17:11PM +0200 schrieb Andy Shevchenko:

Quoted 6 lines · Andy Shevchenko
Quoted 3 lines

The pci_bus_for_each_resource() can hide the iterator loop since it may be not used otherwise. With this, we may drop that iterator variable definition.

Can it be now applied?

Which tree will this go through? No need to involve the PCMCIA tree, and you already have my ACK...

Best,
Dominik

#3 lore raw
Quoted 10 lines · Dominik Brodowski

Am Thu, Feb 01, 2024 at 05:17:11PM +0200 schrieb Andy Shevchenko:

Quoted 6 lines · Andy Shevchenko
Quoted 3 lines

The pci_bus_for_each_resource() can hide the iterator loop since it may be not used otherwise. With this, we may drop that iterator variable definition.

Can it be now applied?

Which tree will this go through? No need to involve the PCMCIA tree, and you already have my ACK...

I believe PCI one, okay, seems like I have to resend with Bjorn being included.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
In reply to Dominik Brodowski
Quoted 10 lines · Dominik Brodowski

Am Thu, Feb 01, 2024 at 05:17:11PM +0200 schrieb Andy Shevchenko:

Quoted 6 lines · Andy Shevchenko
Quoted 3 lines

The pci_bus_for_each_resource() can hide the iterator loop since it may be not used otherwise. With this, we may drop that iterator variable definition.

Can it be now applied?

Which tree will this go through? No need to involve the PCMCIA tree, and you already have my ACK...

Still not being applied. Can you pull it via your tree, please?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Applied
#5 lore raw

Am Tue, Jan 13, 2026 at 11:00:11AM +0200 schrieb Andy Shevchenko:

Quoted 7 lines · Dominik Brodowski
Quoted 6 lines

Am Thu, Feb 01, 2024 at 05:17:11PM +0200 schrieb Andy Shevchenko:

Quoted 5 lines · Andy Shevchenko
Quoted 3 lines

The pci_bus_for_each_resource() can hide the iterator loop since it may be not used otherwise. With this, we may drop that iterator variable definition.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Can it be now applied?

Which tree will this go through? No need to involve the PCMCIA tree, and you already have my ACK...

Still not being applied. Can you pull it via your tree, please?

Applied. Thanks,

Dominik