Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI: fixup sparse endianness warnings in proc.c
PCI PM: make more PCI PM core functionality available to drivers
PCI/DMAR: don't assume presence of RMRRs
PCI hotplug: fix error path in pci_slot's register_slot

+39 -24
+3 -2
drivers/acpi/pci_slot.c
··· 6 * Thanks to Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> for code 7 * review and fixes. 8 * 9 - * Copyright (C) 2007 Alex Chiang <achiang@hp.com> 10 - * Copyright (C) 2007 Hewlett-Packard Development Company, L.P. 11 * 12 * This program is free software; you can redistribute it and/or modify it 13 * under the terms and conditions of the GNU General Public License, ··· 158 if (IS_ERR(pci_slot)) { 159 err("pci_create_slot returned %ld\n", PTR_ERR(pci_slot)); 160 kfree(slot); 161 } 162 163 slot->root_handle = parent_context->root_handle;
··· 6 * Thanks to Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> for code 7 * review and fixes. 8 * 9 + * Copyright (C) 2007-2008 Hewlett-Packard Development Company, L.P. 10 + * Alex Chiang <achiang@hp.com> 11 * 12 * This program is free software; you can redistribute it and/or modify it 13 * under the terms and conditions of the GNU General Public License, ··· 158 if (IS_ERR(pci_slot)) { 159 err("pci_create_slot returned %ld\n", PTR_ERR(pci_slot)); 160 kfree(slot); 161 + return AE_OK; 162 } 163 164 slot->root_handle = parent_context->root_handle;
+1 -3
drivers/pci/dmar.c
··· 317 return -ENODEV; 318 } 319 320 - if (list_empty(&dmar_rmrr_units)) { 321 printk(KERN_INFO PREFIX "No RMRR found\n"); 322 - return -ENODEV; 323 - } 324 325 return 0; 326 }
··· 317 return -ENODEV; 318 } 319 320 + if (list_empty(&dmar_rmrr_units)) 321 printk(KERN_INFO PREFIX "No RMRR found\n"); 322 323 return 0; 324 }
+24 -10
drivers/pci/pci.c
··· 1040 * @dev: PCI device to handle. 1041 * @state: PCI state from which device will issue PME#. 1042 */ 1043 - static bool pci_pme_capable(struct pci_dev *dev, pci_power_t state) 1044 { 1045 if (!dev->pm_cap) 1046 return false; ··· 1123 } 1124 1125 /** 1126 - * pci_prepare_to_sleep - prepare PCI device for system-wide transition into a sleep state 1127 - * @dev: Device to handle. 1128 - * 1129 - * Choose the power state appropriate for the device depending on whether 1130 - * it can wake up the system and/or is power manageable by the platform 1131 - * (PCI_D3hot is the default) and put the device into that state. 1132 */ 1133 - int pci_prepare_to_sleep(struct pci_dev *dev) 1134 { 1135 pci_power_t target_state = PCI_D3hot; 1136 - int error; 1137 1138 if (platform_pci_power_manageable(dev)) { 1139 /* ··· 1153 * to generate PME#. 1154 */ 1155 if (!dev->pm_cap) 1156 - return -EIO; 1157 1158 if (dev->pme_support) { 1159 while (target_state ··· 1161 target_state--; 1162 } 1163 } 1164 1165 pci_enable_wake(dev, target_state, true); 1166 ··· 1930 EXPORT_SYMBOL(pci_set_power_state); 1931 EXPORT_SYMBOL(pci_save_state); 1932 EXPORT_SYMBOL(pci_restore_state); 1933 EXPORT_SYMBOL(pci_enable_wake); 1934 EXPORT_SYMBOL(pci_prepare_to_sleep); 1935 EXPORT_SYMBOL(pci_back_from_sleep); 1936 EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
··· 1040 * @dev: PCI device to handle. 1041 * @state: PCI state from which device will issue PME#. 1042 */ 1043 + bool pci_pme_capable(struct pci_dev *dev, pci_power_t state) 1044 { 1045 if (!dev->pm_cap) 1046 return false; ··· 1123 } 1124 1125 /** 1126 */ 1127 + pci_power_t pci_target_state(struct pci_dev *dev) 1128 { 1129 pci_power_t target_state = PCI_D3hot; 1130 1131 if (platform_pci_power_manageable(dev)) { 1132 /* ··· 1160 * to generate PME#. 1161 */ 1162 if (!dev->pm_cap) 1163 + return PCI_POWER_ERROR; 1164 1165 if (dev->pme_support) { 1166 while (target_state ··· 1168 target_state--; 1169 } 1170 } 1171 + 1172 + return target_state; 1173 + } 1174 + 1175 + /** 1176 + * pci_prepare_to_sleep - prepare PCI device for system-wide transition into a sleep state 1177 + * @dev: Device to handle. 1178 + * 1179 + * Choose the power state appropriate for the device depending on whether 1180 + * it can wake up the system and/or is power manageable by the platform 1181 + * (PCI_D3hot is the default) and put the device into that state. 1182 + */ 1183 + int pci_prepare_to_sleep(struct pci_dev *dev) 1184 + { 1185 + pci_power_t target_state = pci_target_state(dev); 1186 + int error; 1187 + 1188 + if (target_state == PCI_POWER_ERROR) 1189 + return -EIO; 1190 1191 pci_enable_wake(dev, target_state, true); 1192 ··· 1918 EXPORT_SYMBOL(pci_set_power_state); 1919 EXPORT_SYMBOL(pci_save_state); 1920 EXPORT_SYMBOL(pci_restore_state); 1921 + EXPORT_SYMBOL(pci_pme_capable); 1922 EXPORT_SYMBOL(pci_enable_wake); 1923 + EXPORT_SYMBOL(pci_target_state); 1924 EXPORT_SYMBOL(pci_prepare_to_sleep); 1925 EXPORT_SYMBOL(pci_back_from_sleep); 1926 EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
+9 -9
drivers/pci/proc.c
··· 88 if ((pos & 3) && cnt > 2) { 89 unsigned short val; 90 pci_user_read_config_word(dev, pos, &val); 91 - __put_user(cpu_to_le16(val), (unsigned short __user *) buf); 92 buf += 2; 93 pos += 2; 94 cnt -= 2; ··· 97 while (cnt >= 4) { 98 unsigned int val; 99 pci_user_read_config_dword(dev, pos, &val); 100 - __put_user(cpu_to_le32(val), (unsigned int __user *) buf); 101 buf += 4; 102 pos += 4; 103 cnt -= 4; ··· 106 if (cnt >= 2) { 107 unsigned short val; 108 pci_user_read_config_word(dev, pos, &val); 109 - __put_user(cpu_to_le16(val), (unsigned short __user *) buf); 110 buf += 2; 111 pos += 2; 112 cnt -= 2; ··· 156 } 157 158 if ((pos & 3) && cnt > 2) { 159 - unsigned short val; 160 - __get_user(val, (unsigned short __user *) buf); 161 pci_user_write_config_word(dev, pos, le16_to_cpu(val)); 162 buf += 2; 163 pos += 2; ··· 165 } 166 167 while (cnt >= 4) { 168 - unsigned int val; 169 - __get_user(val, (unsigned int __user *) buf); 170 pci_user_write_config_dword(dev, pos, le32_to_cpu(val)); 171 buf += 4; 172 pos += 4; ··· 174 } 175 176 if (cnt >= 2) { 177 - unsigned short val; 178 - __get_user(val, (unsigned short __user *) buf); 179 pci_user_write_config_word(dev, pos, le16_to_cpu(val)); 180 buf += 2; 181 pos += 2;
··· 88 if ((pos & 3) && cnt > 2) { 89 unsigned short val; 90 pci_user_read_config_word(dev, pos, &val); 91 + __put_user(cpu_to_le16(val), (__le16 __user *) buf); 92 buf += 2; 93 pos += 2; 94 cnt -= 2; ··· 97 while (cnt >= 4) { 98 unsigned int val; 99 pci_user_read_config_dword(dev, pos, &val); 100 + __put_user(cpu_to_le32(val), (__le32 __user *) buf); 101 buf += 4; 102 pos += 4; 103 cnt -= 4; ··· 106 if (cnt >= 2) { 107 unsigned short val; 108 pci_user_read_config_word(dev, pos, &val); 109 + __put_user(cpu_to_le16(val), (__le16 __user *) buf); 110 buf += 2; 111 pos += 2; 112 cnt -= 2; ··· 156 } 157 158 if ((pos & 3) && cnt > 2) { 159 + __le16 val; 160 + __get_user(val, (__le16 __user *) buf); 161 pci_user_write_config_word(dev, pos, le16_to_cpu(val)); 162 buf += 2; 163 pos += 2; ··· 165 } 166 167 while (cnt >= 4) { 168 + __le32 val; 169 + __get_user(val, (__le32 __user *) buf); 170 pci_user_write_config_dword(dev, pos, le32_to_cpu(val)); 171 buf += 4; 172 pos += 4; ··· 174 } 175 176 if (cnt >= 2) { 177 + __le16 val; 178 + __get_user(val, (__le16 __user *) buf); 179 pci_user_write_config_word(dev, pos, le16_to_cpu(val)); 180 buf += 2; 181 pos += 2;
+2
include/linux/pci.h
··· 638 int pci_restore_state(struct pci_dev *dev); 639 int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 640 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 641 int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 642 int pci_prepare_to_sleep(struct pci_dev *dev); 643 int pci_back_from_sleep(struct pci_dev *dev); 644
··· 638 int pci_restore_state(struct pci_dev *dev); 639 int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 640 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 641 + bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 642 int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 643 + pci_power_t pci_target_state(struct pci_dev *dev); 644 int pci_prepare_to_sleep(struct pci_dev *dev); 645 int pci_back_from_sleep(struct pci_dev *dev); 646