diff options
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index c0a126125325..eeb33315514c 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -71,6 +71,10 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | |||
71 | * the specific driver's probe to initial the matched device. | 71 | * the specific driver's probe to initial the matched device. |
72 | * @remove: Called when a device removed from this bus. | 72 | * @remove: Called when a device removed from this bus. |
73 | * @shutdown: Called at shut-down time to quiesce the device. | 73 | * @shutdown: Called at shut-down time to quiesce the device. |
74 | * | ||
75 | * @online: Called to put the device back online (after offlining it). | ||
76 | * @offline: Called to put the device offline for hot-removal. May fail. | ||
77 | * | ||
74 | * @suspend: Called when a device on this bus wants to go to sleep mode. | 78 | * @suspend: Called when a device on this bus wants to go to sleep mode. |
75 | * @resume: Called to bring a device on this bus out of sleep mode. | 79 | * @resume: Called to bring a device on this bus out of sleep mode. |
76 | * @pm: Power management operations of this bus, callback the specific | 80 | * @pm: Power management operations of this bus, callback the specific |
@@ -104,6 +108,9 @@ struct bus_type { | |||
104 | int (*remove)(struct device *dev); | 108 | int (*remove)(struct device *dev); |
105 | void (*shutdown)(struct device *dev); | 109 | void (*shutdown)(struct device *dev); |
106 | 110 | ||
111 | int (*online)(struct device *dev); | ||
112 | int (*offline)(struct device *dev); | ||
113 | |||
107 | int (*suspend)(struct device *dev, pm_message_t state); | 114 | int (*suspend)(struct device *dev, pm_message_t state); |
108 | int (*resume)(struct device *dev); | 115 | int (*resume)(struct device *dev); |
109 | 116 | ||
@@ -648,6 +655,8 @@ struct acpi_dev_node { | |||
648 | * @release: Callback to free the device after all references have | 655 | * @release: Callback to free the device after all references have |
649 | * gone away. This should be set by the allocator of the | 656 | * gone away. This should be set by the allocator of the |
650 | * device (i.e. the bus driver that discovered the device). | 657 | * device (i.e. the bus driver that discovered the device). |
658 | * @offline_disabled: If set, the device is permanently online. | ||
659 | * @offline: Set after successful invocation of bus type's .offline(). | ||
651 | * | 660 | * |
652 | * At the lowest level, every device in a Linux system is represented by an | 661 | * At the lowest level, every device in a Linux system is represented by an |
653 | * instance of struct device. The device structure contains the information | 662 | * instance of struct device. The device structure contains the information |
@@ -720,6 +729,9 @@ struct device { | |||
720 | 729 | ||
721 | void (*release)(struct device *dev); | 730 | void (*release)(struct device *dev); |
722 | struct iommu_group *iommu_group; | 731 | struct iommu_group *iommu_group; |
732 | |||
733 | bool offline_disabled:1; | ||
734 | bool offline:1; | ||
723 | }; | 735 | }; |
724 | 736 | ||
725 | static inline struct device *kobj_to_dev(struct kobject *kobj) | 737 | static inline struct device *kobj_to_dev(struct kobject *kobj) |
@@ -856,6 +868,15 @@ extern const char *device_get_devnode(struct device *dev, | |||
856 | extern void *dev_get_drvdata(const struct device *dev); | 868 | extern void *dev_get_drvdata(const struct device *dev); |
857 | extern int dev_set_drvdata(struct device *dev, void *data); | 869 | extern int dev_set_drvdata(struct device *dev, void *data); |
858 | 870 | ||
871 | static inline bool device_supports_offline(struct device *dev) | ||
872 | { | ||
873 | return dev->bus && dev->bus->offline && dev->bus->online; | ||
874 | } | ||
875 | |||
876 | extern void lock_device_hotplug(void); | ||
877 | extern void unlock_device_hotplug(void); | ||
878 | extern int device_offline(struct device *dev); | ||
879 | extern int device_online(struct device *dev); | ||
859 | /* | 880 | /* |
860 | * Root device objects for grouping under /sys/devices | 881 | * Root device objects for grouping under /sys/devices |
861 | */ | 882 | */ |