diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2017-08-18 10:58:08 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-08-29 17:00:40 -0400 |
commit | cda370ec6d1f7b2567ef6f692d0df9358746ad5a (patch) | |
tree | 16f5847496e50ad478ab9671fd8f76d6dd5a25a3 /drivers/misc/pci_endpoint_test.c | |
parent | 0b91516adc581636770ea4fb3efc022de057d074 (diff) |
misc: pci_endpoint_test: Avoid using hard-coded BAR sizes
BAR sizes are hard-coded in pci_endpoint_test driver corresponding to the
sizes used in pci-epf-test function driver. This might break if the sizes
in pci-epf-test function driver are modified (and the corresponding change
is not done in pci_endpoint_test PCI driver).
To avoid hard coding BAR sizes, use pci_resource_len() API.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/misc/pci_endpoint_test.c')
-rw-r--r-- | drivers/misc/pci_endpoint_test.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 5cbb25cf276c..1f37ad39b169 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c | |||
@@ -100,8 +100,6 @@ struct pci_endpoint_test_data { | |||
100 | bool no_msi; | 100 | bool no_msi; |
101 | }; | 101 | }; |
102 | 102 | ||
103 | static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; | ||
104 | |||
105 | static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, | 103 | static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, |
106 | u32 offset) | 104 | u32 offset) |
107 | { | 105 | { |
@@ -149,11 +147,12 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test, | |||
149 | int j; | 147 | int j; |
150 | u32 val; | 148 | u32 val; |
151 | int size; | 149 | int size; |
150 | struct pci_dev *pdev = test->pdev; | ||
152 | 151 | ||
153 | if (!test->bar[barno]) | 152 | if (!test->bar[barno]) |
154 | return false; | 153 | return false; |
155 | 154 | ||
156 | size = bar_size[barno]; | 155 | size = pci_resource_len(pdev, barno); |
157 | 156 | ||
158 | if (barno == test->test_reg_bar) | 157 | if (barno == test->test_reg_bar) |
159 | size = 0x4; | 158 | size = 0x4; |