aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-26 00:07:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-26 00:07:59 -0400
commit16c29dafcc86024048f1dbb8349d31cb22c7c55a (patch)
tree100c4fd34903adf02c9b8ae7705a3e1f30c8d712 /drivers/pci
parentdc50eddb2f3a0dff365f093b2a93fb4ab4dd4389 (diff)
parentd47d81c0e9abdc3c88653fabff5beae82c949b09 (diff)
Merge branch 'syscore' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'syscore' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6: Introduce ARCH_NO_SYSDEV_OPS config option (v2) cpufreq: Use syscore_ops for boot CPU suspend/resume (v2) KVM: Use syscore_ops instead of sysdev class and sysdev PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev timekeeping: Use syscore_ops instead of sysdev class and sysdev x86: Use syscore_ops instead of sysdev classes and sysdevs
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/intel-iommu.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 4789f8e8bf7a..a4115f1afe1f 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -36,7 +36,7 @@
36#include <linux/iova.h> 36#include <linux/iova.h>
37#include <linux/iommu.h> 37#include <linux/iommu.h>
38#include <linux/intel-iommu.h> 38#include <linux/intel-iommu.h>
39#include <linux/sysdev.h> 39#include <linux/syscore_ops.h>
40#include <linux/tboot.h> 40#include <linux/tboot.h>
41#include <linux/dmi.h> 41#include <linux/dmi.h>
42#include <asm/cacheflush.h> 42#include <asm/cacheflush.h>
@@ -3135,7 +3135,7 @@ static void iommu_flush_all(void)
3135 } 3135 }
3136} 3136}
3137 3137
3138static int iommu_suspend(struct sys_device *dev, pm_message_t state) 3138static int iommu_suspend(void)
3139{ 3139{
3140 struct dmar_drhd_unit *drhd; 3140 struct dmar_drhd_unit *drhd;
3141 struct intel_iommu *iommu = NULL; 3141 struct intel_iommu *iommu = NULL;
@@ -3175,7 +3175,7 @@ nomem:
3175 return -ENOMEM; 3175 return -ENOMEM;
3176} 3176}
3177 3177
3178static int iommu_resume(struct sys_device *dev) 3178static void iommu_resume(void)
3179{ 3179{
3180 struct dmar_drhd_unit *drhd; 3180 struct dmar_drhd_unit *drhd;
3181 struct intel_iommu *iommu = NULL; 3181 struct intel_iommu *iommu = NULL;
@@ -3183,7 +3183,7 @@ static int iommu_resume(struct sys_device *dev)
3183 3183
3184 if (init_iommu_hw()) { 3184 if (init_iommu_hw()) {
3185 WARN(1, "IOMMU setup failed, DMAR can not resume!\n"); 3185 WARN(1, "IOMMU setup failed, DMAR can not resume!\n");
3186 return -EIO; 3186 return;
3187 } 3187 }
3188 3188
3189 for_each_active_iommu(iommu, drhd) { 3189 for_each_active_iommu(iommu, drhd) {
@@ -3204,40 +3204,20 @@ static int iommu_resume(struct sys_device *dev)
3204 3204
3205 for_each_active_iommu(iommu, drhd) 3205 for_each_active_iommu(iommu, drhd)
3206 kfree(iommu->iommu_state); 3206 kfree(iommu->iommu_state);
3207
3208 return 0;
3209} 3207}
3210 3208
3211static struct sysdev_class iommu_sysclass = { 3209static struct syscore_ops iommu_syscore_ops = {
3212 .name = "iommu",
3213 .resume = iommu_resume, 3210 .resume = iommu_resume,
3214 .suspend = iommu_suspend, 3211 .suspend = iommu_suspend,
3215}; 3212};
3216 3213
3217static struct sys_device device_iommu = { 3214static void __init init_iommu_pm_ops(void)
3218 .cls = &iommu_sysclass,
3219};
3220
3221static int __init init_iommu_sysfs(void)
3222{ 3215{
3223 int error; 3216 register_syscore_ops(&iommu_syscore_ops);
3224
3225 error = sysdev_class_register(&iommu_sysclass);
3226 if (error)
3227 return error;
3228
3229 error = sysdev_register(&device_iommu);
3230 if (error)
3231 sysdev_class_unregister(&iommu_sysclass);
3232
3233 return error;
3234} 3217}
3235 3218
3236#else 3219#else
3237static int __init init_iommu_sysfs(void) 3220static inline int init_iommu_pm_ops(void) { }
3238{
3239 return 0;
3240}
3241#endif /* CONFIG_PM */ 3221#endif /* CONFIG_PM */
3242 3222
3243/* 3223/*
@@ -3320,7 +3300,7 @@ int __init intel_iommu_init(void)
3320#endif 3300#endif
3321 dma_ops = &intel_dma_ops; 3301 dma_ops = &intel_dma_ops;
3322 3302
3323 init_iommu_sysfs(); 3303 init_iommu_pm_ops();
3324 3304
3325 register_iommu(&intel_iommu_ops); 3305 register_iommu(&intel_iommu_ops);
3326 3306