1a1bdc7aaSBen Dooks 2c6f7e72aSGreg Kroah-Hartman /** 3c6f7e72aSGreg Kroah-Hartman * struct bus_type_private - structure to hold the private to the driver core portions of the bus_type structure. 4c6f7e72aSGreg Kroah-Hartman * 5c6f7e72aSGreg Kroah-Hartman * @subsys - the struct kset that defines this bus. This is the main kobject 6c6f7e72aSGreg Kroah-Hartman * @drivers_kset - the list of drivers associated with this bus 7c6f7e72aSGreg Kroah-Hartman * @devices_kset - the list of devices associated with this bus 8c6f7e72aSGreg Kroah-Hartman * @klist_devices - the klist to iterate over the @devices_kset 9c6f7e72aSGreg Kroah-Hartman * @klist_drivers - the klist to iterate over the @drivers_kset 10c6f7e72aSGreg Kroah-Hartman * @bus_notifier - the bus notifier list for anything that cares about things 11c6f7e72aSGreg Kroah-Hartman * on this bus. 12c6f7e72aSGreg Kroah-Hartman * @bus - pointer back to the struct bus_type that this structure is associated 13c6f7e72aSGreg Kroah-Hartman * with. 14c6f7e72aSGreg Kroah-Hartman * 15c6f7e72aSGreg Kroah-Hartman * This structure is the one that is the actual kobject allowing struct 16c6f7e72aSGreg Kroah-Hartman * bus_type to be statically allocated safely. Nothing outside of the driver 17c6f7e72aSGreg Kroah-Hartman * core should ever touch these fields. 18c6f7e72aSGreg Kroah-Hartman */ 19c6f7e72aSGreg Kroah-Hartman struct bus_type_private { 20c6f7e72aSGreg Kroah-Hartman struct kset subsys; 21c6f7e72aSGreg Kroah-Hartman struct kset *drivers_kset; 22c6f7e72aSGreg Kroah-Hartman struct kset *devices_kset; 23c6f7e72aSGreg Kroah-Hartman struct klist klist_devices; 24c6f7e72aSGreg Kroah-Hartman struct klist klist_drivers; 25c6f7e72aSGreg Kroah-Hartman struct blocking_notifier_head bus_notifier; 26c6f7e72aSGreg Kroah-Hartman unsigned int drivers_autoprobe:1; 27c6f7e72aSGreg Kroah-Hartman struct bus_type *bus; 28c6f7e72aSGreg Kroah-Hartman }; 29a1bdc7aaSBen Dooks 30c6f7e72aSGreg Kroah-Hartman 31c6f7e72aSGreg Kroah-Hartman /* initialisation functions */ 32a1bdc7aaSBen Dooks extern int devices_init(void); 33a1bdc7aaSBen Dooks extern int buses_init(void); 34a1bdc7aaSBen Dooks extern int classes_init(void); 35a1bdc7aaSBen Dooks extern int firmware_init(void); 364039483fSMichael Holzheu #ifdef CONFIG_SYS_HYPERVISOR 374039483fSMichael Holzheu extern int hypervisor_init(void); 384039483fSMichael Holzheu #else 394039483fSMichael Holzheu static inline int hypervisor_init(void) { return 0; } 404039483fSMichael Holzheu #endif 41a1bdc7aaSBen Dooks extern int platform_bus_init(void); 42a1bdc7aaSBen Dooks extern int system_bus_init(void); 43a1bdc7aaSBen Dooks extern int cpu_dev_init(void); 44a1bdc7aaSBen Dooks extern int attribute_container_init(void); 45a1bdc7aaSBen Dooks 461da177e4SLinus Torvalds extern int bus_add_device(struct device * dev); 47c6a46696SCornelia Huck extern void bus_attach_device(struct device * dev); 481da177e4SLinus Torvalds extern void bus_remove_device(struct device * dev); 491da177e4SLinus Torvalds 501da177e4SLinus Torvalds extern int bus_add_driver(struct device_driver *); 511da177e4SLinus Torvalds extern void bus_remove_driver(struct device_driver *); 521da177e4SLinus Torvalds 5307e4a3e2Smochel@digitalimplant.org extern void driver_detach(struct device_driver * drv); 54afdce75fSGreg Kroah-Hartman extern int driver_probe_device(struct device_driver *, struct device *); 5507e4a3e2Smochel@digitalimplant.org 56f67d115fSAdrian Bunk extern void sysdev_shutdown(void); 57f67d115fSAdrian Bunk extern int sysdev_suspend(pm_message_t state); 58f67d115fSAdrian Bunk extern int sysdev_resume(void); 59f67d115fSAdrian Bunk 601da177e4SLinus Torvalds static inline struct class_device *to_class_dev(struct kobject *obj) 611da177e4SLinus Torvalds { 621da177e4SLinus Torvalds return container_of(obj, struct class_device, kobj); 631da177e4SLinus Torvalds } 641da177e4SLinus Torvalds 651da177e4SLinus Torvalds static inline 661da177e4SLinus Torvalds struct class_device_attribute *to_class_dev_attr(struct attribute *_attr) 671da177e4SLinus Torvalds { 681da177e4SLinus Torvalds return container_of(_attr, struct class_device_attribute, attr); 691da177e4SLinus Torvalds } 701da177e4SLinus Torvalds 71aa49b913SGreg Kroah-Hartman extern char *make_class_name(const char *name, struct kobject *kobj); 721da177e4SLinus Torvalds 732a013455SAdrian Bunk extern int devres_release_all(struct device *dev); 74823bccfcSGreg Kroah-Hartman 75881c6cfdSGreg Kroah-Hartman extern struct kset *devices_kset; 76