aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorRyan Desfosses <ryan@desfo.org>2014-04-18 20:13:49 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-06-10 22:20:19 -0400
commit3c78bc61f5ef3bc87e7f94f67ec737d2273f120b (patch)
tree490efb8676389718e78a4d6775ad668538ecaf4f /drivers/pci/pci.c
parentb7fe943421396b61b9f7a97c2554ed999e0f3658 (diff)
PCI: Whitespace cleanup
Fix various whitespace errors. No functional change. [bhelgaas: fix other similar problems] Signed-off-by: Ryan Desfosses <ryan@desfo.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c72
1 files changed, 30 insertions, 42 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 51ec8b481280..952b4b489d0f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -106,7 +106,7 @@ static bool pcie_ari_disabled;
106 * Given a PCI bus, returns the highest PCI bus number present in the set 106 * Given a PCI bus, returns the highest PCI bus number present in the set
107 * including the given PCI bus and its list of child PCI buses. 107 * including the given PCI bus and its list of child PCI buses.
108 */ 108 */
109unsigned char pci_bus_max_busnr(struct pci_bus* bus) 109unsigned char pci_bus_max_busnr(struct pci_bus *bus)
110{ 110{
111 struct pci_bus *tmp; 111 struct pci_bus *tmp;
112 unsigned char max, n; 112 unsigned char max, n;
@@ -114,7 +114,7 @@ unsigned char pci_bus_max_busnr(struct pci_bus* bus)
114 max = bus->busn_res.end; 114 max = bus->busn_res.end;
115 list_for_each_entry(tmp, &bus->children, node) { 115 list_for_each_entry(tmp, &bus->children, node) {
116 n = pci_bus_max_busnr(tmp); 116 n = pci_bus_max_busnr(tmp);
117 if(n > max) 117 if (n > max)
118 max = n; 118 max = n;
119 } 119 }
120 return max; 120 return max;
@@ -405,8 +405,8 @@ EXPORT_SYMBOL_GPL(pci_find_ht_capability);
405 * For given resource region of given device, return the resource 405 * For given resource region of given device, return the resource
406 * region of parent bus the given region is contained in. 406 * region of parent bus the given region is contained in.
407 */ 407 */
408struct resource * 408struct resource *pci_find_parent_resource(const struct pci_dev *dev,
409pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) 409 struct resource *res)
410{ 410{
411 const struct pci_bus *bus = dev->bus; 411 const struct pci_bus *bus = dev->bus;
412 struct resource *r; 412 struct resource *r;
@@ -473,8 +473,7 @@ int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask)
473 * Restore the BAR values for a given device, so as to make it 473 * Restore the BAR values for a given device, so as to make it
474 * accessible by its driver. 474 * accessible by its driver.
475 */ 475 */
476static void 476static void pci_restore_bars(struct pci_dev *dev)
477pci_restore_bars(struct pci_dev *dev)
478{ 477{
479 int i; 478 int i;
480 479
@@ -499,7 +498,7 @@ static inline bool platform_pci_power_manageable(struct pci_dev *dev)
499} 498}
500 499
501static inline int platform_pci_set_power_state(struct pci_dev *dev, 500static inline int platform_pci_set_power_state(struct pci_dev *dev,
502 pci_power_t t) 501 pci_power_t t)
503{ 502{
504 return pci_platform_pm ? pci_platform_pm->set_state(dev, t) : -ENOSYS; 503 return pci_platform_pm ? pci_platform_pm->set_state(dev, t) : -ENOSYS;
505} 504}
@@ -888,12 +887,10 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
888 } 887 }
889 return PCI_D0; 888 return PCI_D0;
890} 889}
891
892EXPORT_SYMBOL(pci_choose_state); 890EXPORT_SYMBOL(pci_choose_state);
893 891
894#define PCI_EXP_SAVE_REGS 7 892#define PCI_EXP_SAVE_REGS 7
895 893
896
897static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev, 894static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev,
898 u16 cap, bool extended) 895 u16 cap, bool extended)
899{ 896{
@@ -1005,8 +1002,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
1005 * pci_save_state - save the PCI configuration space of a device before suspending 1002 * pci_save_state - save the PCI configuration space of a device before suspending
1006 * @dev: - PCI device that we're dealing with 1003 * @dev: - PCI device that we're dealing with
1007 */ 1004 */
1008int 1005int pci_save_state(struct pci_dev *dev)
1009pci_save_state(struct pci_dev *dev)
1010{ 1006{
1011 int i; 1007 int i;
1012 /* XXX: 100% dword access ok here? */ 1008 /* XXX: 100% dword access ok here? */
@@ -1381,7 +1377,7 @@ static void pcim_release(struct device *gendev, void *res)
1381 pci_disable_device(dev); 1377 pci_disable_device(dev);
1382} 1378}
1383 1379
1384static struct pci_devres * get_pci_dr(struct pci_dev *pdev) 1380static struct pci_devres *get_pci_dr(struct pci_dev *pdev)
1385{ 1381{
1386 struct pci_devres *dr, *new_dr; 1382 struct pci_devres *dr, *new_dr;
1387 1383
@@ -1395,7 +1391,7 @@ static struct pci_devres * get_pci_dr(struct pci_dev *pdev)
1395 return devres_get(&pdev->dev, new_dr, NULL, NULL); 1391 return devres_get(&pdev->dev, new_dr, NULL, NULL);
1396} 1392}
1397 1393
1398static struct pci_devres * find_pci_dr(struct pci_dev *pdev) 1394static struct pci_devres *find_pci_dr(struct pci_dev *pdev)
1399{ 1395{
1400 if (pci_is_managed(pdev)) 1396 if (pci_is_managed(pdev))
1401 return devres_find(&pdev->dev, pcim_release, NULL, NULL); 1397 return devres_find(&pdev->dev, pcim_release, NULL, NULL);
@@ -1455,7 +1451,7 @@ EXPORT_SYMBOL(pcim_pin_device);
1455 * devices are added. This is the default implementation. Architecture 1451 * devices are added. This is the default implementation. Architecture
1456 * implementations can override this. 1452 * implementations can override this.
1457 */ 1453 */
1458int __weak pcibios_add_device (struct pci_dev *dev) 1454int __weak pcibios_add_device(struct pci_dev *dev)
1459{ 1455{
1460 return 0; 1456 return 0;
1461} 1457}
@@ -1527,8 +1523,7 @@ void pci_disable_enabled_device(struct pci_dev *dev)
1527 * Note we don't actually disable the device until all callers of 1523 * Note we don't actually disable the device until all callers of
1528 * pci_enable_device() have called pci_disable_device(). 1524 * pci_enable_device() have called pci_disable_device().
1529 */ 1525 */
1530void 1526void pci_disable_device(struct pci_dev *dev)
1531pci_disable_device(struct pci_dev *dev)
1532{ 1527{
1533 struct pci_devres *dr; 1528 struct pci_devres *dr;
1534 1529
@@ -2434,8 +2429,7 @@ u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin)
2434 return (((pin - 1) + slot) % 4) + 1; 2429 return (((pin - 1) + slot) % 4) + 1;
2435} 2430}
2436 2431
2437int 2432int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
2438pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
2439{ 2433{
2440 u8 pin; 2434 u8 pin;
2441 2435
@@ -2518,8 +2512,8 @@ EXPORT_SYMBOL(pci_release_region);
2518 * Returns 0 on success, or %EBUSY on error. A warning 2512 * Returns 0 on success, or %EBUSY on error. A warning
2519 * message is also printed on failure. 2513 * message is also printed on failure.
2520 */ 2514 */
2521static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_name, 2515static int __pci_request_region(struct pci_dev *pdev, int bar,
2522 int exclusive) 2516 const char *res_name, int exclusive)
2523{ 2517{
2524 struct pci_devres *dr; 2518 struct pci_devres *dr;
2525 2519
@@ -2530,8 +2524,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
2530 if (!request_region(pci_resource_start(pdev, bar), 2524 if (!request_region(pci_resource_start(pdev, bar),
2531 pci_resource_len(pdev, bar), res_name)) 2525 pci_resource_len(pdev, bar), res_name))
2532 goto err_out; 2526 goto err_out;
2533 } 2527 } else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
2534 else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
2535 if (!__request_mem_region(pci_resource_start(pdev, bar), 2528 if (!__request_mem_region(pci_resource_start(pdev, bar),
2536 pci_resource_len(pdev, bar), res_name, 2529 pci_resource_len(pdev, bar), res_name,
2537 exclusive)) 2530 exclusive))
@@ -2588,7 +2581,8 @@ EXPORT_SYMBOL(pci_request_region);
2588 * explicitly not allowed to map the resource via /dev/mem or 2581 * explicitly not allowed to map the resource via /dev/mem or
2589 * sysfs. 2582 * sysfs.
2590 */ 2583 */
2591int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name) 2584int pci_request_region_exclusive(struct pci_dev *pdev, int bar,
2585 const char *res_name)
2592{ 2586{
2593 return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE); 2587 return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
2594} 2588}
@@ -2613,7 +2607,7 @@ void pci_release_selected_regions(struct pci_dev *pdev, int bars)
2613EXPORT_SYMBOL(pci_release_selected_regions); 2607EXPORT_SYMBOL(pci_release_selected_regions);
2614 2608
2615static int __pci_request_selected_regions(struct pci_dev *pdev, int bars, 2609static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
2616 const char *res_name, int excl) 2610 const char *res_name, int excl)
2617{ 2611{
2618 int i; 2612 int i;
2619 2613
@@ -2624,7 +2618,7 @@ static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
2624 return 0; 2618 return 0;
2625 2619
2626err_out: 2620err_out:
2627 while(--i >= 0) 2621 while (--i >= 0)
2628 if (bars & (1 << i)) 2622 if (bars & (1 << i))
2629 pci_release_region(pdev, i); 2623 pci_release_region(pdev, i);
2630 2624
@@ -2645,8 +2639,8 @@ int pci_request_selected_regions(struct pci_dev *pdev, int bars,
2645} 2639}
2646EXPORT_SYMBOL(pci_request_selected_regions); 2640EXPORT_SYMBOL(pci_request_selected_regions);
2647 2641
2648int pci_request_selected_regions_exclusive(struct pci_dev *pdev, 2642int pci_request_selected_regions_exclusive(struct pci_dev *pdev, int bars,
2649 int bars, const char *res_name) 2643 const char *res_name)
2650{ 2644{
2651 return __pci_request_selected_regions(pdev, bars, res_name, 2645 return __pci_request_selected_regions(pdev, bars, res_name,
2652 IORESOURCE_EXCLUSIVE); 2646 IORESOURCE_EXCLUSIVE);
@@ -2836,8 +2830,7 @@ EXPORT_SYMBOL_GPL(pci_set_cacheline_size);
2836 * 2830 *
2837 * RETURNS: An appropriate -ERRNO error value on error, or zero for success. 2831 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
2838 */ 2832 */
2839int 2833int pci_set_mwi(struct pci_dev *dev)
2840pci_set_mwi(struct pci_dev *dev)
2841{ 2834{
2842#ifdef PCI_DISABLE_MWI 2835#ifdef PCI_DISABLE_MWI
2843 return 0; 2836 return 0;
@@ -2850,7 +2843,7 @@ pci_set_mwi(struct pci_dev *dev)
2850 return rc; 2843 return rc;
2851 2844
2852 pci_read_config_word(dev, PCI_COMMAND, &cmd); 2845 pci_read_config_word(dev, PCI_COMMAND, &cmd);
2853 if (! (cmd & PCI_COMMAND_INVALIDATE)) { 2846 if (!(cmd & PCI_COMMAND_INVALIDATE)) {
2854 dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n"); 2847 dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n");
2855 cmd |= PCI_COMMAND_INVALIDATE; 2848 cmd |= PCI_COMMAND_INVALIDATE;
2856 pci_write_config_word(dev, PCI_COMMAND, cmd); 2849 pci_write_config_word(dev, PCI_COMMAND, cmd);
@@ -2885,8 +2878,7 @@ EXPORT_SYMBOL(pci_try_set_mwi);
2885 * 2878 *
2886 * Disables PCI Memory-Write-Invalidate transaction on the device 2879 * Disables PCI Memory-Write-Invalidate transaction on the device
2887 */ 2880 */
2888void 2881void pci_clear_mwi(struct pci_dev *dev)
2889pci_clear_mwi(struct pci_dev *dev)
2890{ 2882{
2891#ifndef PCI_DISABLE_MWI 2883#ifndef PCI_DISABLE_MWI
2892 u16 cmd; 2884 u16 cmd;
@@ -2907,18 +2899,16 @@ EXPORT_SYMBOL(pci_clear_mwi);
2907 * 2899 *
2908 * Enables/disables PCI INTx for device dev 2900 * Enables/disables PCI INTx for device dev
2909 */ 2901 */
2910void 2902void pci_intx(struct pci_dev *pdev, int enable)
2911pci_intx(struct pci_dev *pdev, int enable)
2912{ 2903{
2913 u16 pci_command, new; 2904 u16 pci_command, new;
2914 2905
2915 pci_read_config_word(pdev, PCI_COMMAND, &pci_command); 2906 pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
2916 2907
2917 if (enable) { 2908 if (enable)
2918 new = pci_command & ~PCI_COMMAND_INTX_DISABLE; 2909 new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
2919 } else { 2910 else
2920 new = pci_command | PCI_COMMAND_INTX_DISABLE; 2911 new = pci_command | PCI_COMMAND_INTX_DISABLE;
2921 }
2922 2912
2923 if (new != pci_command) { 2913 if (new != pci_command) {
2924 struct pci_devres *dr; 2914 struct pci_devres *dr;
@@ -4159,7 +4149,7 @@ void __init pci_register_set_vga_state(arch_set_vga_state_t func)
4159} 4149}
4160 4150
4161static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, 4151static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode,
4162 unsigned int command_bits, u32 flags) 4152 unsigned int command_bits, u32 flags)
4163{ 4153{
4164 if (arch_set_vga_state) 4154 if (arch_set_vga_state)
4165 return arch_set_vga_state(dev, decode, command_bits, 4155 return arch_set_vga_state(dev, decode, command_bits,
@@ -4271,11 +4261,10 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev)
4271 bus == dev->bus->number && 4261 bus == dev->bus->number &&
4272 slot == PCI_SLOT(dev->devfn) && 4262 slot == PCI_SLOT(dev->devfn) &&
4273 func == PCI_FUNC(dev->devfn)) { 4263 func == PCI_FUNC(dev->devfn)) {
4274 if (align_order == -1) { 4264 if (align_order == -1)
4275 align = PAGE_SIZE; 4265 align = PAGE_SIZE;
4276 } else { 4266 else
4277 align = 1 << align_order; 4267 align = 1 << align_order;
4278 }
4279 /* Found */ 4268 /* Found */
4280 break; 4269 break;
4281 } 4270 }
@@ -4393,7 +4382,6 @@ static int __init pci_resource_alignment_sysfs_init(void)
4393 return bus_create_file(&pci_bus_type, 4382 return bus_create_file(&pci_bus_type,
4394 &bus_attr_resource_alignment); 4383 &bus_attr_resource_alignment);
4395} 4384}
4396
4397late_initcall(pci_resource_alignment_sysfs_init); 4385late_initcall(pci_resource_alignment_sysfs_init);
4398 4386
4399static void pci_no_domains(void) 4387static void pci_no_domains(void)