linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Ram Pai <linuxram@us.ibm.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH 13/21] PCI: Rename dev_res_x to add_res or fail_res
Date: Sat, 21 Jan 2012 02:08:29 -0800	[thread overview]
Message-ID: <1327140517-14811-14-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1327140517-14811-1-git-send-email-yinghai@kernel.org>

According to Linus, don't use dev_res_x.
Replace them with add_res, fail_res etc according to context.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/setup-bus.c |  110 +++++++++++++++++++++++-----------------------
 1 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index af2a98a..a6e427a 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -95,32 +95,32 @@ static void add_to_failed_list(struct list_head *head,
 			0 /* dont care */);
 }
 
-static void remove_from_list(struct list_head *realloc_head,
+static void remove_from_list(struct list_head *head,
 				 struct resource *res)
 {
-	struct pci_dev_resource *dev_res_x, *tmp;
+	struct pci_dev_resource *dev_res, *tmp;
 
-	list_for_each_entry_safe(dev_res_x, tmp, realloc_head, list) {
-		if (dev_res_x->res == res) {
-			list_del(&dev_res_x->list);
-			kfree(dev_res_x);
+	list_for_each_entry_safe(dev_res, tmp, head, list) {
+		if (dev_res->res == res) {
+			list_del(&dev_res->list);
+			kfree(dev_res);
 			break;
 		}
 	}
 }
 
-static resource_size_t get_res_add_size(struct list_head *realloc_head,
+static resource_size_t get_res_add_size(struct list_head *head,
 					struct resource *res)
 {
-	struct pci_dev_resource *dev_res_x;
+	struct pci_dev_resource *dev_res;
 
-	list_for_each_entry(dev_res_x, realloc_head, list) {
-		if (dev_res_x->res == res) {
-			dev_printk(KERN_DEBUG, &dev_res_x->dev->dev,
+	list_for_each_entry(dev_res, head, list) {
+		if (dev_res->res == res) {
+			dev_printk(KERN_DEBUG, &dev_res->dev->dev,
 				 "%pR get_res_add_size  add_size %llx\n",
-				 dev_res_x->res,
-				 (unsigned long long)dev_res_x->add_size);
-			return dev_res_x->add_size;
+				 dev_res->res,
+				 (unsigned long long)dev_res->add_size);
+			return dev_res->add_size;
 		}
 	}
 
@@ -221,15 +221,15 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
 		struct list_head *head)
 {
 	struct resource *res;
-	struct pci_dev_resource *dev_res_x, *tmp;
+	struct pci_dev_resource *add_res, *tmp;
 	struct pci_dev_resource *dev_res;
 	resource_size_t add_size;
 	int idx;
 
-	list_for_each_entry_safe(dev_res_x, tmp, realloc_head, list) {
+	list_for_each_entry_safe(add_res, tmp, realloc_head, list) {
 		bool found_match = false;
 
-		res = dev_res_x->res;
+		res = add_res->res;
 		/* skip resource that has been reset */
 		if (!res->flags)
 			goto out;
@@ -244,26 +244,26 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
 		if (!found_match)/* just skip */
 			continue;
 
-		idx = res - &dev_res_x->dev->resource[0];
-		add_size = dev_res_x->add_size;
+		idx = res - &add_res->dev->resource[0];
+		add_size = add_res->add_size;
 		if (!resource_size(res)) {
-			res->start = dev_res_x->start;
+			res->start = add_res->start;
 			res->end = res->start + add_size - 1;
-			if (pci_assign_resource(dev_res_x->dev, idx))
+			if (pci_assign_resource(add_res->dev, idx))
 				reset_resource(res);
 		} else {
-			resource_size_t align = dev_res_x->min_align;
-			res->flags |= dev_res_x->flags &
+			resource_size_t align = add_res->min_align;
+			res->flags |= add_res->flags &
 				 (IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN);
-			if (pci_reassign_resource(dev_res_x->dev, idx,
+			if (pci_reassign_resource(add_res->dev, idx,
 						  add_size, align))
-				dev_printk(KERN_DEBUG, &dev_res_x->dev->dev,
+				dev_printk(KERN_DEBUG, &add_res->dev->dev,
 				   "failed to add optional resources res=%pR\n",
 							res);
 		}
 out:
-		list_del(&dev_res_x->list);
-		kfree(dev_res_x);
+		list_del(&add_res->list);
+		kfree(add_res);
 	}
 }
 
@@ -319,7 +319,7 @@ static void __assign_resources_sorted(struct list_head *head,
 	 */
 	LIST_HEAD(save_head);
 	LIST_HEAD(local_fail_head);
-	struct pci_dev_resource *dev_res_x;
+	struct pci_dev_resource *save_res;
 	struct pci_dev_resource *dev_res;
 
 	/* Check if optional add_size is there */
@@ -358,12 +358,12 @@ static void __assign_resources_sorted(struct list_head *head,
 		if (dev_res->res->parent)
 			release_resource(dev_res->res);
 	/* Restore start/end/flags from saved list */
-	list_for_each_entry(dev_res_x, &save_head, list) {
-		struct resource *res = dev_res_x->res;
+	list_for_each_entry(save_res, &save_head, list) {
+		struct resource *res = save_res->res;
 
-		res->start = dev_res_x->start;
-		res->end = dev_res_x->end;
-		res->flags = dev_res_x->flags;
+		res->start = save_res->start;
+		res->end = save_res->end;
+		res->flags = save_res->flags;
 	}
 	free_list(pci_dev_resource, &save_head);
 
@@ -1250,7 +1250,7 @@ pci_assign_unassigned_resources(void)
 	int tried_times = 0;
 	enum release_type rel_type = leaf_only;
 	LIST_HEAD(fail_head);
-	struct pci_dev_resource *dev_res_x;
+	struct pci_dev_resource *fail_res;
 	unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
 				  IORESOURCE_PREFETCH;
 	unsigned long failed_type;
@@ -1289,8 +1289,8 @@ again:
 		goto enable_and_dump;
 
 	failed_type = 0;
-	list_for_each_entry(dev_res_x, &fail_head, list)
-		failed_type |= dev_res_x->flags;
+	list_for_each_entry(fail_res, &fail_head, list)
+		failed_type |= fail_res->flags;
 
 	/*
 	 * io port are tight, don't try extra
@@ -1313,20 +1313,20 @@ again:
 	 * Try to release leaf bridge's resources that doesn't fit resource of
 	 * child device under that bridge
 	 */
-	list_for_each_entry(dev_res_x, &fail_head, list) {
-		bus = dev_res_x->dev->bus;
+	list_for_each_entry(fail_res, &fail_head, list) {
+		bus = fail_res->dev->bus;
 		pci_bus_release_bridge_resources(bus,
-						 dev_res_x->flags & type_mask,
+						 fail_res->flags & type_mask,
 						 rel_type);
 	}
 	/* restore size and flags */
-	list_for_each_entry(dev_res_x, &fail_head, list) {
-		struct resource *res = dev_res_x->res;
+	list_for_each_entry(fail_res, &fail_head, list) {
+		struct resource *res = fail_res->res;
 
-		res->start = dev_res_x->start;
-		res->end = dev_res_x->end;
-		res->flags = dev_res_x->flags;
-		if (dev_res_x->dev->subordinate)
+		res->start = fail_res->start;
+		res->end = fail_res->end;
+		res->flags = fail_res->flags;
+		if (fail_res->dev->subordinate)
 			res->flags = 0;
 	}
 	free_list(pci_dev_resource, &fail_head);
@@ -1350,7 +1350,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
 					want additional resources */
 	int tried_times = 0;
 	LIST_HEAD(fail_head);
-	struct pci_dev_resource *dev_res_x;
+	struct pci_dev_resource *fail_res;
 	int retval;
 	unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
 				  IORESOURCE_PREFETCH;
@@ -1377,21 +1377,21 @@ again:
 	 * Try to release leaf bridge's resources that doesn't fit resource of
 	 * child device under that bridge
 	 */
-	list_for_each_entry(dev_res_x, &fail_head, list) {
-		struct pci_bus *bus = dev_res_x->dev->bus;
-		unsigned long flags = dev_res_x->flags;
+	list_for_each_entry(fail_res, &fail_head, list) {
+		struct pci_bus *bus = fail_res->dev->bus;
+		unsigned long flags = fail_res->flags;
 
 		pci_bus_release_bridge_resources(bus, flags & type_mask,
 						 whole_subtree);
 	}
 	/* restore size and flags */
-	list_for_each_entry(dev_res_x, &fail_head, list) {
-		struct resource *res = dev_res_x->res;
+	list_for_each_entry(fail_res, &fail_head, list) {
+		struct resource *res = fail_res->res;
 
-		res->start = dev_res_x->start;
-		res->end = dev_res_x->end;
-		res->flags = dev_res_x->flags;
-		if (dev_res_x->dev->subordinate)
+		res->start = fail_res->start;
+		res->end = fail_res->end;
+		res->flags = fail_res->flags;
+		if (fail_res->dev->subordinate)
 			res->flags = 0;
 	}
 	free_list(pci_dev_resource, &fail_head);
-- 
1.7.7


  parent reply	other threads:[~2012-01-21 10:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-21 10:08 [PATCH 00/21] PCI : bridge resource reallocation patchset Yinghai Lu
2012-01-21 10:08 ` [PATCH 01/21] PCI : Calculate right add_size Yinghai Lu
2012-01-27 17:55   ` Jesse Barnes
2012-01-21 10:08 ` [PATCH 02/21] PCI: Make add_to_list() return status Yinghai Lu
2012-01-21 10:08 ` [PATCH 03/21] PCI: Move get_res_add_size() early Yinghai Lu
2012-01-21 10:08 ` [PATCH 04/21] PCI: Try to assign required+option size at first Yinghai Lu
2012-01-21 10:08 ` [PATCH 05/21] PCI: Using add_list in pcie hotplug path Yinghai Lu
2012-01-21 10:08 ` [PATCH 06/21] PCI: Make rescan bus could increase bridge resource size if needed Yinghai Lu
2012-01-27 18:00   ` Jesse Barnes
2012-01-21 10:08 ` [PATCH 07/21] PCI: Make pci_rescan_bus handle add_list Yinghai Lu
2012-01-21 10:08 ` [PATCH 08/21] PCI: Fixing multiple retrying with pci resource optional resources allocation under multi bridges Yinghai Lu
2012-01-21 10:08 ` [PATCH 09/21] PCI: Move pdev_sort_resources() to setup-bus.c Yinghai Lu
2012-01-21 10:08 ` [PATCH 10/21] PCI: Move struct resource_list " Yinghai Lu
2012-01-21 10:08 ` [PATCH 11/21] PCI: Replace resource_list with generic list Yinghai Lu
2012-01-21 10:08 ` [PATCH 12/21] PCI: Merge pci_dev_resource_x and pci_dev_resource Yinghai Lu
2012-01-21 10:08 ` Yinghai Lu [this message]
2012-01-21 10:08 ` [PATCH 14/21] PCI: Change free_list() to function Yinghai Lu
2012-01-21 10:08 ` [PATCH 15/21] PCI: add debug print out for add_size Yinghai Lu
2012-01-21 10:08 ` [PATCH 16/21] PCI: remove add_to_failed_list() Yinghai Lu
2012-01-27 18:21   ` Jesse Barnes
2012-01-21 10:08 ` [PATCH 17/21] PCI: Disable cardbus bridge MEM1 pref CTL Yinghai Lu
2012-01-27 18:22   ` Jesse Barnes
2012-01-27 18:39     ` Yinghai Lu
2012-01-21 10:08 ` [PATCH 18/21] PCI: Fix cardbus bridge resources as optional size handling Yinghai Lu
2012-01-27 18:23   ` Jesse Barnes
2012-01-27 21:37     ` Yinghai Lu
2012-02-05 21:58       ` Dominik Brodowski
2012-02-05 23:30         ` Yinghai Lu
2012-02-10 15:35           ` Dominik Brodowski
2012-02-10 17:07             ` Yinghai Lu
2012-01-21 10:08 ` [PATCH 19/21] PCI: Retry on type IORESOURCE_IO allocation Yinghai Lu
2012-01-21 10:08 ` [PATCH 20/21] PCI: Make pci bridge reallocating enabled/disabled Yinghai Lu
2012-01-21 10:08 ` [PATCH 21/21] PCI: only enable pci realloc when SRIOV bar is not assigned Yinghai Lu
2012-01-27 18:25   ` Jesse Barnes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1327140517-14811-14-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxram@us.ibm.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).