PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev

The Intel IOMMU subsystem uses a sysdev class and a sysdev for
executing iommu_suspend() after interrupts have been turned off
on the boot CPU (during system suspend) and for executing
iommu_resume() before turning on interrupts on the boot CPU
(during system resume). However, since both of these functions
ignore their arguments, the entire mechanism may be replaced with a
struct syscore_ops object which is simpler.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>

+9 -29
+9 -29
drivers/pci/intel-iommu.c
··· 36 36 #include <linux/iova.h> 37 37 #include <linux/iommu.h> 38 38 #include <linux/intel-iommu.h> 39 - #include <linux/sysdev.h> 39 + #include <linux/syscore_ops.h> 40 40 #include <linux/tboot.h> 41 41 #include <linux/dmi.h> 42 42 #include <asm/cacheflush.h> ··· 3135 3135 } 3136 3136 } 3137 3137 3138 - static int iommu_suspend(struct sys_device *dev, pm_message_t state) 3138 + static int iommu_suspend(void) 3139 3139 { 3140 3140 struct dmar_drhd_unit *drhd; 3141 3141 struct intel_iommu *iommu = NULL; ··· 3175 3175 return -ENOMEM; 3176 3176 } 3177 3177 3178 - static int iommu_resume(struct sys_device *dev) 3178 + static void iommu_resume(void) 3179 3179 { 3180 3180 struct dmar_drhd_unit *drhd; 3181 3181 struct intel_iommu *iommu = NULL; ··· 3183 3183 3184 3184 if (init_iommu_hw()) { 3185 3185 WARN(1, "IOMMU setup failed, DMAR can not resume!\n"); 3186 - return -EIO; 3186 + return; 3187 3187 } 3188 3188 3189 3189 for_each_active_iommu(iommu, drhd) { ··· 3204 3204 3205 3205 for_each_active_iommu(iommu, drhd) 3206 3206 kfree(iommu->iommu_state); 3207 - 3208 - return 0; 3209 3207 } 3210 3208 3211 - static struct sysdev_class iommu_sysclass = { 3212 - .name = "iommu", 3209 + static struct syscore_ops iommu_syscore_ops = { 3213 3210 .resume = iommu_resume, 3214 3211 .suspend = iommu_suspend, 3215 3212 }; 3216 3213 3217 - static struct sys_device device_iommu = { 3218 - .cls = &iommu_sysclass, 3219 - }; 3220 - 3221 - static int __init init_iommu_sysfs(void) 3214 + static void __init init_iommu_pm_ops(void) 3222 3215 { 3223 - int error; 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; 3216 + register_syscore_ops(&iommu_syscore_ops); 3234 3217 } 3235 3218 3236 3219 #else 3237 - static int __init init_iommu_sysfs(void) 3238 - { 3239 - return 0; 3240 - } 3220 + static inline int init_iommu_pm_ops(void) { } 3241 3221 #endif /* CONFIG_PM */ 3242 3222 3243 3223 /* ··· 3300 3320 #endif 3301 3321 dma_ops = &intel_dma_ops; 3302 3322 3303 - init_iommu_sysfs(); 3323 + init_iommu_pm_ops(); 3304 3324 3305 3325 register_iommu(&intel_iommu_ops); 3306 3326