summaryrefslogtreecommitdiff
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorPatrick Mochel <mochel@osdl.org>2002-10-16 22:07:11 -0700
committerPatrick Mochel <mochel@osdl.org>2002-10-16 22:07:11 -0700
commitbe0b9c71e35ebee75fc694daa9f2a268b504ca50 (patch)
tree8d5b8f6576758f593b91beb236cd8c1f0034c6e5 /include/linux/device.h
parent6b1febf70889295545f50cc0d05312eaf6daa0a2 (diff)
driver model: change struct device::present to enumerated value with multiple states.
Adapted from Greg KH: - add multiple possible enumerated states a device can be in: UNINITIALIZED, INITIALIZED, REGISTERED, and GONE. - Check whether device is INITIALIZED or REGISTERED in device_present(). - Change struct device::current_state to ::power_state to better reflect what it is.
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index d34142925760..3dd9a4081298 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -48,6 +48,13 @@ enum {
RESUME_ENABLE,
};
+enum device_state {
+ DEVICE_UNINITIALIZED = 0,
+ DEVICE_INITIALIZED = 1,
+ DEVICE_REGISTERED = 2,
+ DEVICE_GONE = 3,
+};
+
struct device;
struct device_driver;
struct device_class;
@@ -288,8 +295,8 @@ struct device {
void *platform_data; /* Platform specific data (e.g. ACPI,
BIOS data relevant to device) */
- u32 present;
- u32 current_state; /* Current operating state. In
+ enum device_state state;
+ u32 power_state; /* Current operating state. In
ACPI-speak, this is D0-D3, D0
being fully functional, and D3
being off. */
@@ -363,7 +370,7 @@ extern int (*platform_notify_remove)(struct device * dev);
static inline int device_present(struct device * dev)
{
- return (dev && dev->present == 1);
+ return (dev && (dev->state == DEVICE_INITIALIZED || dev->state == DEVICE_REGISTERED));
}
/* device and bus locking helpers.