diff options
author | Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> | 2010-04-15 00:11:42 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-05-11 15:01:14 -0400 |
commit | 98ca3964fe8da0d742331af80952443af5cff464 (patch) | |
tree | 35c1b803496ca97322d88754de804117114a7c11 /drivers/pci | |
parent | 843f4697eea576c24f057bbdb199115bbb6b10bc (diff) |
PCI: aerdrv: rework find_source_device
Return bool to indicate that the source device is found or not.
This allows us to skip calling aer_process_err_devices() if we can.
And move dev_printk for debug into this function.
v2: return bool instead of int
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_core.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index ad15eea54fd0..5fa5c76719b0 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
@@ -215,11 +215,13 @@ added: | |||
215 | /** | 215 | /** |
216 | * find_source_device - search through device hierarchy for source device | 216 | * find_source_device - search through device hierarchy for source device |
217 | * @parent: pointer to Root Port pci_dev data structure | 217 | * @parent: pointer to Root Port pci_dev data structure |
218 | * @err_info: including detailed error information such like id | 218 | * @e_info: including detailed error information such like id |
219 | * | 219 | * |
220 | * Invoked when error is detected at the Root Port. | 220 | * Return true if found. |
221 | * | ||
222 | * Invoked by DPC when error is detected at the Root Port. | ||
221 | */ | 223 | */ |
222 | static void find_source_device(struct pci_dev *parent, | 224 | static bool find_source_device(struct pci_dev *parent, |
223 | struct aer_err_info *e_info) | 225 | struct aer_err_info *e_info) |
224 | { | 226 | { |
225 | struct pci_dev *dev = parent; | 227 | struct pci_dev *dev = parent; |
@@ -228,9 +230,17 @@ static void find_source_device(struct pci_dev *parent, | |||
228 | /* Is Root Port an agent that sends error message? */ | 230 | /* Is Root Port an agent that sends error message? */ |
229 | result = find_device_iter(dev, e_info); | 231 | result = find_device_iter(dev, e_info); |
230 | if (result) | 232 | if (result) |
231 | return; | 233 | return true; |
232 | 234 | ||
233 | pci_walk_bus(parent->subordinate, find_device_iter, e_info); | 235 | pci_walk_bus(parent->subordinate, find_device_iter, e_info); |
236 | |||
237 | if (!e_info->error_dev_num) { | ||
238 | dev_printk(KERN_DEBUG, &parent->dev, | ||
239 | "can't find device of ID%04x\n", | ||
240 | e_info->id); | ||
241 | return false; | ||
242 | } | ||
243 | return true; | ||
234 | } | 244 | } |
235 | 245 | ||
236 | static int report_error_detected(struct pci_dev *dev, void *data) | 246 | static int report_error_detected(struct pci_dev *dev, void *data) |
@@ -639,12 +649,6 @@ static inline void aer_process_err_devices(struct pcie_device *p_device, | |||
639 | { | 649 | { |
640 | int i; | 650 | int i; |
641 | 651 | ||
642 | if (!e_info->dev[0]) { | ||
643 | dev_printk(KERN_DEBUG, &p_device->port->dev, | ||
644 | "can't find device of ID%04x\n", | ||
645 | e_info->id); | ||
646 | } | ||
647 | |||
648 | /* Report all before handle them, not to lost records by reset etc. */ | 652 | /* Report all before handle them, not to lost records by reset etc. */ |
649 | for (i = 0; i < e_info->error_dev_num && e_info->dev[i]; i++) { | 653 | for (i = 0; i < e_info->error_dev_num && e_info->dev[i]; i++) { |
650 | if (get_device_error_info(e_info->dev[i], e_info)) | 654 | if (get_device_error_info(e_info->dev[i], e_info)) |
@@ -702,8 +706,8 @@ static void aer_isr_one_error(struct pcie_device *p_device, | |||
702 | 706 | ||
703 | aer_print_port_info(p_device->port, e_info); | 707 | aer_print_port_info(p_device->port, e_info); |
704 | 708 | ||
705 | find_source_device(p_device->port, e_info); | 709 | if (find_source_device(p_device->port, e_info)) |
706 | aer_process_err_devices(p_device, e_info); | 710 | aer_process_err_devices(p_device, e_info); |
707 | } | 711 | } |
708 | 712 | ||
709 | kfree(e_info); | 713 | kfree(e_info); |