From be0b9c71e35ebee75fc694daa9f2a268b504ca50 Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Wed, 16 Oct 2002 22:07:11 -0700 Subject: 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. --- include/linux/device.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'include/linux/device.h') 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. -- cgit v1.2.3