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