diff options
Diffstat (limited to 'include/linux/device.h')
| -rw-r--r-- | include/linux/device.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 9d4835a8f8b8..bcf8c0d4cd98 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 |
| @@ -105,6 +109,9 @@ struct bus_type { | |||
| 105 | int (*remove)(struct device *dev); | 109 | int (*remove)(struct device *dev); |
| 106 | void (*shutdown)(struct device *dev); | 110 | void (*shutdown)(struct device *dev); |
| 107 | 111 | ||
| 112 | int (*online)(struct device *dev); | ||
| 113 | int (*offline)(struct device *dev); | ||
| 114 | |||
| 108 | int (*suspend)(struct device *dev, pm_message_t state); | 115 | int (*suspend)(struct device *dev, pm_message_t state); |
| 109 | int (*resume)(struct device *dev); | 116 | int (*resume)(struct device *dev); |
| 110 | 117 | ||
| @@ -652,6 +659,9 @@ struct acpi_dev_node { | |||
| 652 | * device (i.e. the bus driver that discovered the device). | 659 | * device (i.e. the bus driver that discovered the device). |
| 653 | * @iommu_group: IOMMU group the device belongs to. | 660 | * @iommu_group: IOMMU group the device belongs to. |
| 654 | * | 661 | * |
| 662 | * @offline_disabled: If set, the device is permanently online. | ||
| 663 | * @offline: Set after successful invocation of bus type's .offline(). | ||
| 664 | * | ||
| 655 | * At the lowest level, every device in a Linux system is represented by an | 665 | * At the lowest level, every device in a Linux system is represented by an |
| 656 | * instance of struct device. The device structure contains the information | 666 | * instance of struct device. The device structure contains the information |
| 657 | * that the device model core needs to model the system. Most subsystems, | 667 | * that the device model core needs to model the system. Most subsystems, |
| @@ -723,6 +733,9 @@ struct device { | |||
| 723 | 733 | ||
| 724 | void (*release)(struct device *dev); | 734 | void (*release)(struct device *dev); |
| 725 | struct iommu_group *iommu_group; | 735 | struct iommu_group *iommu_group; |
| 736 | |||
| 737 | bool offline_disabled:1; | ||
| 738 | bool offline:1; | ||
| 726 | }; | 739 | }; |
| 727 | 740 | ||
| 728 | static inline struct device *kobj_to_dev(struct kobject *kobj) | 741 | static inline struct device *kobj_to_dev(struct kobject *kobj) |
| @@ -859,6 +872,15 @@ extern const char *device_get_devnode(struct device *dev, | |||
| 859 | extern void *dev_get_drvdata(const struct device *dev); | 872 | extern void *dev_get_drvdata(const struct device *dev); |
| 860 | extern int dev_set_drvdata(struct device *dev, void *data); | 873 | extern int dev_set_drvdata(struct device *dev, void *data); |
| 861 | 874 | ||
| 875 | static inline bool device_supports_offline(struct device *dev) | ||
| 876 | { | ||
| 877 | return dev->bus && dev->bus->offline && dev->bus->online; | ||
| 878 | } | ||
| 879 | |||
| 880 | extern void lock_device_hotplug(void); | ||
| 881 | extern void unlock_device_hotplug(void); | ||
| 882 | extern int device_offline(struct device *dev); | ||
| 883 | extern int device_online(struct device *dev); | ||
| 862 | /* | 884 | /* |
| 863 | * Root device objects for grouping under /sys/devices | 885 | * Root device objects for grouping under /sys/devices |
| 864 | */ | 886 | */ |
