lkml.org 
[lkml]   [2013]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 19/29] PCI: Use for_each_pci_resource() in pci bases reading
Date
Replace those open code, and make code more readable.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/pci/probe.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ac751a6..263a575 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -354,9 +354,11 @@ out:
static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
{
unsigned int pos, reg;
+ struct resource *res;

- for (pos = 0; pos < howmany; pos++) {
- struct resource *res = &dev->resource[pos];
+ for_each_pci_resource(dev, res, pos, PCI_STD_RES) {
+ if (pos >= howmany)
+ break;
reg = PCI_BASE_ADDRESS_0 + (pos << 2);
pos += __pci_read_base(dev, pci_bar_unknown, res, reg);
}
--
1.8.1.4


\
 
 \ /
  Last update: 2013-04-13 01:41    [W:0.236 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site