diff options
author | David S. Miller <davem@davemloft.net> | 2010-04-11 17:53:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-11 17:53:53 -0400 |
commit | 871039f02f8ec4ab2e5e9010718caa8e085786f1 (patch) | |
tree | f0d2b3127fc48c862967d68c46c2d46668137515 /drivers/pci/pci.c | |
parent | e4077e018b5ead3de9951fc01d8bf12eeeeeefed (diff) | |
parent | 4a1032faac94ebbf647460ae3e06fc21146eb280 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/stmmac/stmmac_main.c
drivers/net/wireless/wl12xx/wl1271_cmd.c
drivers/net/wireless/wl12xx/wl1271_main.c
drivers/net/wireless/wl12xx/wl1271_spi.c
net/core/ethtool.c
net/mac80211/scan.c
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cb1dd5f4988c..5ea587e59e48 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
14 | #include <linux/pm.h> | 14 | #include <linux/pm.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/module.h> | 16 | #include <linux/module.h> |
16 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
17 | #include <linux/string.h> | 18 | #include <linux/string.h> |
@@ -2576,18 +2577,17 @@ EXPORT_SYMBOL_GPL(pci_reset_function); | |||
2576 | */ | 2577 | */ |
2577 | int pcix_get_max_mmrbc(struct pci_dev *dev) | 2578 | int pcix_get_max_mmrbc(struct pci_dev *dev) |
2578 | { | 2579 | { |
2579 | int err, cap; | 2580 | int cap; |
2580 | u32 stat; | 2581 | u32 stat; |
2581 | 2582 | ||
2582 | cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); | 2583 | cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); |
2583 | if (!cap) | 2584 | if (!cap) |
2584 | return -EINVAL; | 2585 | return -EINVAL; |
2585 | 2586 | ||
2586 | err = pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat); | 2587 | if (pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat)) |
2587 | if (err) | ||
2588 | return -EINVAL; | 2588 | return -EINVAL; |
2589 | 2589 | ||
2590 | return (stat & PCI_X_STATUS_MAX_READ) >> 12; | 2590 | return 512 << ((stat & PCI_X_STATUS_MAX_READ) >> 21); |
2591 | } | 2591 | } |
2592 | EXPORT_SYMBOL(pcix_get_max_mmrbc); | 2592 | EXPORT_SYMBOL(pcix_get_max_mmrbc); |
2593 | 2593 | ||
@@ -2600,18 +2600,17 @@ EXPORT_SYMBOL(pcix_get_max_mmrbc); | |||
2600 | */ | 2600 | */ |
2601 | int pcix_get_mmrbc(struct pci_dev *dev) | 2601 | int pcix_get_mmrbc(struct pci_dev *dev) |
2602 | { | 2602 | { |
2603 | int ret, cap; | 2603 | int cap; |
2604 | u32 cmd; | 2604 | u16 cmd; |
2605 | 2605 | ||
2606 | cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); | 2606 | cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); |
2607 | if (!cap) | 2607 | if (!cap) |
2608 | return -EINVAL; | 2608 | return -EINVAL; |
2609 | 2609 | ||
2610 | ret = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd); | 2610 | if (pci_read_config_word(dev, cap + PCI_X_CMD, &cmd)) |
2611 | if (!ret) | 2611 | return -EINVAL; |
2612 | ret = 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2); | ||
2613 | 2612 | ||
2614 | return ret; | 2613 | return 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2); |
2615 | } | 2614 | } |
2616 | EXPORT_SYMBOL(pcix_get_mmrbc); | 2615 | EXPORT_SYMBOL(pcix_get_mmrbc); |
2617 | 2616 | ||
@@ -2626,28 +2625,27 @@ EXPORT_SYMBOL(pcix_get_mmrbc); | |||
2626 | */ | 2625 | */ |
2627 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc) | 2626 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc) |
2628 | { | 2627 | { |
2629 | int cap, err = -EINVAL; | 2628 | int cap; |
2630 | u32 stat, cmd, v, o; | 2629 | u32 stat, v, o; |
2630 | u16 cmd; | ||
2631 | 2631 | ||
2632 | if (mmrbc < 512 || mmrbc > 4096 || !is_power_of_2(mmrbc)) | 2632 | if (mmrbc < 512 || mmrbc > 4096 || !is_power_of_2(mmrbc)) |
2633 | goto out; | 2633 | return -EINVAL; |
2634 | 2634 | ||
2635 | v = ffs(mmrbc) - 10; | 2635 | v = ffs(mmrbc) - 10; |
2636 | 2636 | ||
2637 | cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); | 2637 | cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); |
2638 | if (!cap) | 2638 | if (!cap) |
2639 | goto out; | 2639 | return -EINVAL; |
2640 | 2640 | ||
2641 | err = pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat); | 2641 | if (pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat)) |
2642 | if (err) | 2642 | return -EINVAL; |
2643 | goto out; | ||
2644 | 2643 | ||
2645 | if (v > (stat & PCI_X_STATUS_MAX_READ) >> 21) | 2644 | if (v > (stat & PCI_X_STATUS_MAX_READ) >> 21) |
2646 | return -E2BIG; | 2645 | return -E2BIG; |
2647 | 2646 | ||
2648 | err = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd); | 2647 | if (pci_read_config_word(dev, cap + PCI_X_CMD, &cmd)) |
2649 | if (err) | 2648 | return -EINVAL; |
2650 | goto out; | ||
2651 | 2649 | ||
2652 | o = (cmd & PCI_X_CMD_MAX_READ) >> 2; | 2650 | o = (cmd & PCI_X_CMD_MAX_READ) >> 2; |
2653 | if (o != v) { | 2651 | if (o != v) { |
@@ -2657,10 +2655,10 @@ int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc) | |||
2657 | 2655 | ||
2658 | cmd &= ~PCI_X_CMD_MAX_READ; | 2656 | cmd &= ~PCI_X_CMD_MAX_READ; |
2659 | cmd |= v << 2; | 2657 | cmd |= v << 2; |
2660 | err = pci_write_config_dword(dev, cap + PCI_X_CMD, cmd); | 2658 | if (pci_write_config_word(dev, cap + PCI_X_CMD, cmd)) |
2659 | return -EIO; | ||
2661 | } | 2660 | } |
2662 | out: | 2661 | return 0; |
2663 | return err; | ||
2664 | } | 2662 | } |
2665 | EXPORT_SYMBOL(pcix_set_mmrbc); | 2663 | EXPORT_SYMBOL(pcix_set_mmrbc); |
2666 | 2664 | ||
@@ -3023,7 +3021,6 @@ EXPORT_SYMBOL(pcim_pin_device); | |||
3023 | EXPORT_SYMBOL(pci_disable_device); | 3021 | EXPORT_SYMBOL(pci_disable_device); |
3024 | EXPORT_SYMBOL(pci_find_capability); | 3022 | EXPORT_SYMBOL(pci_find_capability); |
3025 | EXPORT_SYMBOL(pci_bus_find_capability); | 3023 | EXPORT_SYMBOL(pci_bus_find_capability); |
3026 | EXPORT_SYMBOL(pci_register_set_vga_state); | ||
3027 | EXPORT_SYMBOL(pci_release_regions); | 3024 | EXPORT_SYMBOL(pci_release_regions); |
3028 | EXPORT_SYMBOL(pci_request_regions); | 3025 | EXPORT_SYMBOL(pci_request_regions); |
3029 | EXPORT_SYMBOL(pci_request_regions_exclusive); | 3026 | EXPORT_SYMBOL(pci_request_regions_exclusive); |