Introduce ARCH_NO_SYSDEV_OPS config option (v2)

Introduce Kconfig option allowing architectures where sysdev
operations used during system suspend, resume and shutdown have been
completely replaced with struct sycore_ops operations to avoid
building sysdev code that will never be used.

Make callbacks in struct sys_device and struct sysdev_driver depend
on ARCH_NO_SYSDEV_OPS to allows us to verify if all of the references
have been actually removed from the code the given architecture
depends on.

Make x86 select ARCH_NO_SYSDEV_OPS.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

+27 -5
+1
arch/x86/Kconfig
··· 71 71 select GENERIC_IRQ_SHOW 72 72 select IRQ_FORCED_THREADING 73 73 select USE_GENERIC_SMP_HELPERS if SMP 74 + select ARCH_NO_SYSDEV_OPS 74 75 75 76 config INSTRUCTION_DECODER 76 77 def_bool (KPROBES || PERF_EVENTS)
+7
drivers/base/Kconfig
··· 168 168 bool 169 169 default n 170 170 171 + config ARCH_NO_SYSDEV_OPS 172 + bool 173 + ---help--- 174 + To be selected by architectures that don't use sysdev class or 175 + sysdev driver power management (suspend/resume) and shutdown 176 + operations. 177 + 171 178 endmenu
+2 -1
drivers/base/sys.c
··· 329 329 } 330 330 331 331 332 - 332 + #ifndef CONFIG_ARCH_NO_SYSDEV_OPS 333 333 /** 334 334 * sysdev_shutdown - Shut down all system devices. 335 335 * ··· 524 524 return 0; 525 525 } 526 526 EXPORT_SYMBOL_GPL(sysdev_resume); 527 + #endif /* CONFIG_ARCH_NO_SYSDEV_OPS */ 527 528 528 529 int __init system_bus_init(void) 529 530 {
+4
include/linux/device.h
··· 633 633 /* drivers/base/power/shutdown.c */ 634 634 extern void device_shutdown(void); 635 635 636 + #ifndef CONFIG_ARCH_NO_SYSDEV_OPS 636 637 /* drivers/base/sys.c */ 637 638 extern void sysdev_shutdown(void); 639 + #else 640 + static inline void sysdev_shutdown(void) { } 641 + #endif 638 642 639 643 /* debugging and troubleshooting/diagnostic helpers. */ 640 644 extern const char *dev_driver_string(const struct device *dev);
+8 -2
include/linux/pm.h
··· 529 529 */ 530 530 531 531 #ifdef CONFIG_PM_SLEEP 532 - extern void device_pm_lock(void); 532 + #ifndef CONFIG_ARCH_NO_SYSDEV_OPS 533 + extern int sysdev_suspend(pm_message_t state); 533 534 extern int sysdev_resume(void); 535 + #else 536 + static inline int sysdev_suspend(pm_message_t state) { return 0; } 537 + static inline int sysdev_resume(void) { return 0; } 538 + #endif 539 + 540 + extern void device_pm_lock(void); 534 541 extern void dpm_resume_noirq(pm_message_t state); 535 542 extern void dpm_resume_end(pm_message_t state); 536 543 537 544 extern void device_pm_unlock(void); 538 - extern int sysdev_suspend(pm_message_t state); 539 545 extern int dpm_suspend_noirq(pm_message_t state); 540 546 extern int dpm_suspend_start(pm_message_t state); 541 547
+5 -2
include/linux/sysdev.h
··· 33 33 const char *name; 34 34 struct list_head drivers; 35 35 struct sysdev_class_attribute **attrs; 36 - 36 + struct kset kset; 37 + #ifndef CONFIG_ARCH_NO_SYSDEV_OPS 37 38 /* Default operations for these types of devices */ 38 39 int (*shutdown)(struct sys_device *); 39 40 int (*suspend)(struct sys_device *, pm_message_t state); 40 41 int (*resume)(struct sys_device *); 41 - struct kset kset; 42 + #endif 42 43 }; 43 44 44 45 struct sysdev_class_attribute { ··· 77 76 struct list_head entry; 78 77 int (*add)(struct sys_device *); 79 78 int (*remove)(struct sys_device *); 79 + #ifndef CONFIG_ARCH_NO_SYSDEV_OPS 80 80 int (*shutdown)(struct sys_device *); 81 81 int (*suspend)(struct sys_device *, pm_message_t state); 82 82 int (*resume)(struct sys_device *); 83 + #endif 83 84 }; 84 85 85 86