Skip to contentSkip to conversation

rename the local variable *bridge* to *host_bridge* in pci_create_root_bus.

PATCH In review Richard Yang 2 participants 3 messages Jun 7, 2012 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rename the local variable *bridge* to *host_bridge* in pci_create_root_bus.

Since there are serverail *bridge* in this function, it would be a little confusion.

Rename it for easy reading.

 drivers/pci/probe.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/pci/probe.c +9 -9
index 5e1ca3c..2cc6eef 100644
@@ -1648,7 +1648,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	int error;
-	struct pci_host_bridge *bridge;
+	struct pci_host_bridge *host_bridge;
 	struct pci_bus *b, *b2;
 	struct device *dev;
 	struct pci_host_bridge_window *window, *n;
@@ -1657,8 +1657,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	char bus_addr[64];
 	char *fmt;
 
-	bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-	if (!bridge)
+	host_bridge = kzalloc(sizeof(*host_bridge), GFP_KERNEL);
+	if (!host_bridge)
 		return NULL;
 
 	b = pci_alloc_bus();
@@ -1704,8 +1704,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 
 	b->number = b->secondary = bus;
 
-	bridge->bus = b;
-	INIT_LIST_HEAD(&bridge->windows);
+	host_bridge->bus = b;
+	INIT_LIST_HEAD(&host_bridge->windows);
 
 	if (parent)
 		dev_info(parent, "PCI host bridge to bus %s\n", dev_name(&b->dev));
@@ -1714,7 +1714,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 
 	/* Add initial resources to the bus */
 	list_for_each_entry_safe(window, n, resources, list) {
-		list_move_tail(&window->list, &bridge->windows);
+		list_move_tail(&window->list, &host_bridge->windows);
 		res = window->res;
 		offset = window->offset;
 		pci_bus_add_resource(b, res, 0);
@@ -1732,7 +1732,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	}
 
 	down_write(&pci_bus_sem);
-	list_add_tail(&bridge->list, &pci_host_bridges);
+	list_add_tail(&host_bridge->list, &pci_host_bridges);
 	list_add_tail(&b->node, &pci_root_buses);
 	up_write(&pci_bus_sem);
 
@@ -1742,7 +1742,7 @@ class_dev_reg_err:
 	device_unregister(dev);
 dev_reg_err:
 	down_write(&pci_bus_sem);
-	list_del(&bridge->list);
+	list_del(&host_bridge->list);
 	list_del(&b->node);
 	up_write(&pci_bus_sem);
 err_out:
@@ -1750,7 +1750,7 @@ err_out:
 err_dev:
 	kfree(b);
 err_bus:
-	kfree(bridge);
+	kfree(host_bridge);
 	return NULL;
 }
 
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 6 lines

Since there are serverail *bridge* in this function, it would be a little confusion.

Rename it for easy reading.

At least, you missed "Signed-off-by" here :-)

Quoted 83 lines

drivers/pci/probe.c | 18 +++++++++---------

1 files changed, 9 insertions(+), 9 deletions(-)
drivers/pci/probe.c +7 -7
index 5e1ca3c..2cc6eef 100644
@@ -1648,7 +1648,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	int error;
-	struct pci_host_bridge *bridge;
+	struct pci_host_bridge *host_bridge;
 	struct pci_bus *b, *b2;
 	struct device *dev;
 	struct pci_host_bridge_window *window, *n;
@@ -1657,8 +1657,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	char bus_addr[64];
 	char *fmt;
 
-	bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-	if (!bridge)
+	host_bridge = kzalloc(sizeof(*host_bridge), GFP_KERNEL);
+	if (!host_bridge)
 		return NULL;
 
 	b = pci_alloc_bus();
@@ -1704,8 +1704,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 
 	b->number = b->secondary = bus;
 
-	bridge->bus = b;
-	INIT_LIST_HEAD(&bridge->windows);
+	host_bridge->bus = b;
+	INIT_LIST_HEAD(&host_bridge->windows);
 
 	if (parent)
 		dev_info(parent, "PCI host bridge to bus %s\n", dev_name(&b->dev));
@@ -1714,7 +1714,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 
 	/* Add initial resources to the bus */
 	list_for_each_entry_safe(window, n, resources, list) {
-		list_move_tail(&window->list, &bridge->windows);
+		list_move_tail(&window->list, &host_bridge->windows);
 		res = window->res;
 		offset = window->offset;
 		pci_bus_add_resource(b, res, 0);
@@ -1732,7 +1732,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	}
 
 	down_write(&pci_bus_sem);
-	list_add_tail(&bridge->list, &pci_host_bridges);
+	list_add_tail(&host_bridge->list, &pci_host_bridges);
 	list_add_tail(&b->node, &pci_root_buses);
 	up_write(&pci_bus_sem);
 
@@ -1742,7 +1742,7 @@ class_dev_reg_err:
 	device_unregister(dev);

dev_reg_err:

	down_write(&pci_bus_sem);
drivers/pci/probe.c +1 -1
-	list_del(&bridge->list);
+	list_del(&host_bridge->list);
	list_del(&b->node);
	up_write(&pci_bus_sem);

err_out:

drivers/pci/probe.c +0 -0
@@ -1750,7 +1750,7 @@ err_out:

err_dev:

	kfree(b);

err_bus:

drivers/pci/probe.c +1 -1
-	kfree(bridge);
+	kfree(host_bridge);
	return NULL;
}
Signature · 7 lines
1.7.4.1


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to Richard Yang
Quoted 5 lines

Since there are serverail *bridge* in this function, it would be a little confusion.

Rename it for easy reading.

At least, you missed "<Signed-off-by: xxx>" here :-)

By the way, the subject is little bit confusing. You may change it into "[PATCH] pci: cleanup on confusing variable name for pci_create_root_bus".

Thanks,
Gavin

Quoted 84 lines

drivers/pci/probe.c | 18 +++++++++---------

1 files changed, 9 insertions(+), 9 deletions(-)
drivers/pci/probe.c +7 -7
index 5e1ca3c..2cc6eef 100644
@@ -1648,7 +1648,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	int error;
-	struct pci_host_bridge *bridge;
+	struct pci_host_bridge *host_bridge;
 	struct pci_bus *b, *b2;
 	struct device *dev;
 	struct pci_host_bridge_window *window, *n;
@@ -1657,8 +1657,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	char bus_addr[64];
 	char *fmt;
 
-	bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-	if (!bridge)
+	host_bridge = kzalloc(sizeof(*host_bridge), GFP_KERNEL);
+	if (!host_bridge)
 		return NULL;
 
 	b = pci_alloc_bus();
@@ -1704,8 +1704,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 
 	b->number = b->secondary = bus;
 
-	bridge->bus = b;
-	INIT_LIST_HEAD(&bridge->windows);
+	host_bridge->bus = b;
+	INIT_LIST_HEAD(&host_bridge->windows);
 
 	if (parent)
 		dev_info(parent, "PCI host bridge to bus %s\n", dev_name(&b->dev));
@@ -1714,7 +1714,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 
 	/* Add initial resources to the bus */
 	list_for_each_entry_safe(window, n, resources, list) {
-		list_move_tail(&window->list, &bridge->windows);
+		list_move_tail(&window->list, &host_bridge->windows);
 		res = window->res;
 		offset = window->offset;
 		pci_bus_add_resource(b, res, 0);
@@ -1732,7 +1732,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	}
 
 	down_write(&pci_bus_sem);
-	list_add_tail(&bridge->list, &pci_host_bridges);
+	list_add_tail(&host_bridge->list, &pci_host_bridges);
 	list_add_tail(&b->node, &pci_root_buses);
 	up_write(&pci_bus_sem);
 
@@ -1742,7 +1742,7 @@ class_dev_reg_err:
 	device_unregister(dev);

dev_reg_err:

	down_write(&pci_bus_sem);
drivers/pci/probe.c +1 -1
-	list_del(&bridge->list);
+	list_del(&host_bridge->list);
	list_del(&b->node);
	up_write(&pci_bus_sem);

err_out:

drivers/pci/probe.c +0 -0
@@ -1750,7 +1750,7 @@ err_out:

err_dev:

	kfree(b);

err_bus:

drivers/pci/probe.c +1 -1
-	kfree(bridge);
+	kfree(host_bridge);
	return NULL;
}
Signature · 7 lines
1.7.4.1


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html