Go to the source code of this file.
Classes | |
| struct | root_device |
Defines | |
| #define | to_dev(obj) container_of(obj, struct device, kobj) |
| #define | to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr) |
| #define | to_root_device(dev) container_of(dev, struct root_device, dev) |
Functions | |
| static int | device_is_not_partition (struct device *dev) |
| const char * | dev_driver_string (const struct device *dev) |
| dev_driver_string - Return a device's driver name, if at all possible : struct device to get the name of | |
| EXPORT_SYMBOL (dev_driver_string) | |
| static ssize_t | dev_attr_show (struct kobject *kobj, struct attribute *attr, char *buf) |
| static ssize_t | dev_attr_store (struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) |
| static void | device_release (struct kobject *kobj) |
| device_release - free device structure. | |
| static int | dev_uevent_filter (struct kset *kset, struct kobject *kobj) |
| static const char * | dev_uevent_name (struct kset *kset, struct kobject *kobj) |
| static int | dev_uevent (struct kset *kset, struct kobject *kobj, struct kobj_uevent_env *env) |
| static ssize_t | show_uevent (struct device *dev, struct device_attribute *attr, char *buf) |
| static ssize_t | store_uevent (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
| static int | device_add_attributes (struct device *dev, struct device_attribute *attrs) |
| static void | device_remove_attributes (struct device *dev, struct device_attribute *attrs) |
| static int | device_add_groups (struct device *dev, struct attribute_group **groups) |
| static void | device_remove_groups (struct device *dev, struct attribute_group **groups) |
| static int | device_add_attrs (struct device *dev) |
| static void | device_remove_attrs (struct device *dev) |
| static ssize_t | show_dev (struct device *dev, struct device_attribute *attr, char *buf) |
| int | device_create_file (struct device *dev, struct device_attribute *attr) |
| device_create_file - create sysfs attribute file for device. | |
| void | device_remove_file (struct device *dev, struct device_attribute *attr) |
| device_remove_file - remove sysfs attribute file. | |
| int | device_create_bin_file (struct device *dev, struct bin_attribute *attr) |
| device_create_bin_file - create sysfs binary attribute file for device. | |
| EXPORT_SYMBOL_GPL (device_create_bin_file) | |
| void | device_remove_bin_file (struct device *dev, struct bin_attribute *attr) |
| device_remove_bin_file - remove sysfs binary attribute file : device. | |
| EXPORT_SYMBOL_GPL (device_remove_bin_file) | |
| int | device_schedule_callback_owner (struct device *dev, void(*func)(struct device *), struct module *owner) |
| device_schedule_callback_owner - helper to schedule a callback for a device : device. | |
| EXPORT_SYMBOL_GPL (device_schedule_callback_owner) | |
| static void | klist_children_get (struct klist_node *n) |
| static void | klist_children_put (struct klist_node *n) |
| void | device_initialize (struct device *dev) |
| device_initialize - init device structure. | |
| static struct kobject * | virtual_device_parent (struct device *dev) |
| static struct kobject * | get_device_parent (struct device *dev, struct device *parent) |
| static void | cleanup_glue_dir (struct device *dev, struct kobject *glue_dir) |
| static void | cleanup_device_parent (struct device *dev) |
| static void | setup_parent (struct device *dev, struct device *parent) |
| static int | device_add_class_symlinks (struct device *dev) |
| static void | device_remove_class_symlinks (struct device *dev) |
| int | dev_set_name (struct device *dev, const char *fmt,...) |
| dev_set_name - set a device name : device : format string for the device's name | |
| EXPORT_SYMBOL_GPL (dev_set_name) | |
| static struct kobject * | device_to_dev_kobj (struct device *dev) |
| device_to_dev_kobj - select a /sys/dev/ directory for the device : device | |
| static int | device_create_sys_dev_entry (struct device *dev) |
| static void | device_remove_sys_dev_entry (struct device *dev) |
| int | device_add (struct device *dev) |
| device_add - add device to device hierarchy. | |
| int | device_register (struct device *dev) |
| device_register - register a device with the system. | |
| struct device * | get_device (struct device *dev) |
| get_device - increment reference count for device. | |
| void | put_device (struct device *dev) |
| put_device - decrement reference count. | |
| void | device_del (struct device *dev) |
| device_del - delete device from system. | |
| void | device_unregister (struct device *dev) |
| device_unregister - unregister device from system. | |
| static struct device * | next_device (struct klist_iter *i) |
| int | device_for_each_child (struct device *parent, void *data, int(*fn)(struct device *dev, void *data)) |
| struct device * | device_find_child (struct device *parent, void *data, int(*match)(struct device *dev, void *data)) |
| device_find_child - device iterator for locating a particular device. | |
| int __init | devices_init (void) |
| EXPORT_SYMBOL_GPL (device_for_each_child) | |
| EXPORT_SYMBOL_GPL (device_find_child) | |
| EXPORT_SYMBOL_GPL (device_initialize) | |
| EXPORT_SYMBOL_GPL (device_add) | |
| EXPORT_SYMBOL_GPL (device_register) | |
| EXPORT_SYMBOL_GPL (device_del) | |
| EXPORT_SYMBOL_GPL (device_unregister) | |
| EXPORT_SYMBOL_GPL (get_device) | |
| EXPORT_SYMBOL_GPL (put_device) | |
| EXPORT_SYMBOL_GPL (device_create_file) | |
| EXPORT_SYMBOL_GPL (device_remove_file) | |
| static void | root_device_release (struct device *dev) |
: root device name | |
__root_device_register - allocate and register a root device : owner module of the root device, usually THIS_MODULE This function allocates a root device and registers it using device_register(). In order to free the returned device, use root_device_unregister(). Root devices are dummy devices which allow other devices to be grouped under /sys/devices. Use this function to allocate a root device and then use it as the parent of any device which should appear under /sys/devices/{name} The /sys/devices/{name} directory will also contain a 'module' symlink which points to the directory in sysfs.
Note: You probably want to use root_device_register(). | |
| struct device * | __root_device_register (const char *name, struct module *owner) |
| EXPORT_SYMBOL_GPL (__root_device_register) | |
| void | root_device_unregister (struct device *dev) |
| root_device_unregister - unregister and free a root device : device going away | |
| EXPORT_SYMBOL_GPL (root_device_unregister) | |
| static void | device_create_release (struct device *dev) |
| struct device * | device_create_vargs (struct class *class, struct device *parent, dev_t devt, void *drvdata, const char *fmt, va_list args) |
| EXPORT_SYMBOL_GPL (device_create_vargs) | |
| struct device * | device_create (struct class *class, struct device *parent, dev_t devt, void *drvdata, const char *fmt,...) |
| EXPORT_SYMBOL_GPL (device_create) | |
| static int | __match_devt (struct device *dev, void *data) |
| void | device_destroy (struct class *class, dev_t devt) |
| EXPORT_SYMBOL_GPL (device_destroy) | |
| int | device_rename (struct device *dev, char *new_name) |
| device_rename - renames a device : the pointer to the struct device to be renamed : the new name of the device | |
| EXPORT_SYMBOL_GPL (device_rename) | |
| static int | device_move_class_links (struct device *dev, struct device *old_parent, struct device *new_parent) |
| int | device_move (struct device *dev, struct device *new_parent) |
| device_move - moves a device to a new parent : the pointer to the struct device to be moved : the new parent of the device (can by NULL) | |
| EXPORT_SYMBOL_GPL (device_move) | |
| void | device_shutdown (void) |
| device_shutdown - call ->shutdown() on each device to shutdown. | |
Variables | |
| int(* | platform_notify )(struct device *dev) = NULL |
| int(* | platform_notify_remove )(struct device *dev) = NULL |
| static struct kobject * | dev_kobj |
| struct kobject * | sysfs_dev_char_kobj |
| struct kobject * | sysfs_dev_block_kobj |
| static struct sysfs_ops | dev_sysfs_ops |
| static struct kobj_type | device_ktype |
| static struct kset_uevent_ops | device_uevent_ops |
| static struct device_attribute | uevent_attr |
| static struct device_attribute | devt_attr |
| struct kset * | devices_kset |
| #define to_dev_attr | ( | _attr | ) | container_of(_attr, struct device_attribute, attr) |
| #define to_root_device | ( | dev | ) | container_of(dev, struct root_device, dev) |
| static int __match_devt | ( | struct device * | dev, | |
| void * | data | |||
| ) | [static] |
| struct device* __root_device_register | ( | const char * | name, | |
| struct module * | owner | |||
| ) | [read] |
| static void cleanup_device_parent | ( | struct device * | dev | ) | [static] |
| static void cleanup_glue_dir | ( | struct device * | dev, | |
| struct kobject * | glue_dir | |||
| ) | [static] |
| static ssize_t dev_attr_show | ( | struct kobject * | kobj, | |
| struct attribute * | attr, | |||
| char * | buf | |||
| ) | [static] |
| static ssize_t dev_attr_store | ( | struct kobject * | kobj, | |
| struct attribute * | attr, | |||
| const char * | buf, | |||
| size_t | count | |||
| ) | [static] |
| const char* dev_driver_string | ( | const struct device * | dev | ) |
dev_driver_string - Return a device's driver name, if at all possible : struct device to get the name of
Will return the device's driver's name if it is bound to a device. If the device is not bound to a device, it will return the name of the bus it is attached to. If it is not attached to a bus either, an empty string will be returned.
| int dev_set_name | ( | struct device * | dev, | |
| const char * | fmt, | |||
| ... | ||||
| ) |
| static int dev_uevent | ( | struct kset * | kset, | |
| struct kobject * | kobj, | |||
| struct kobj_uevent_env * | env | |||
| ) | [static] |
| static int dev_uevent_filter | ( | struct kset * | kset, | |
| struct kobject * | kobj | |||
| ) | [static] |
| static const char* dev_uevent_name | ( | struct kset * | kset, | |
| struct kobject * | kobj | |||
| ) | [static] |
| int device_add | ( | struct device * | dev | ) |
device_add - add device to device hierarchy.
: device.
This is part 2 of device_register(), though may be called separately _iff_ device_initialize() has been called separately.
This adds to the kobject hierarchy via kobject_add(), adds it to the global and sibling lists for the device, then adds it to the other relevant subsystems of the driver model.
NOTE: _Never_ directly free after calling this function, even if it returned an error! Always use put_device() to give up your reference instead.
| static int device_add_attributes | ( | struct device * | dev, | |
| struct device_attribute * | attrs | |||
| ) | [static] |
| static int device_add_class_symlinks | ( | struct device * | dev | ) | [static] |
| static int device_add_groups | ( | struct device * | dev, | |
| struct attribute_group ** | groups | |||
| ) | [static] |
| struct device* device_create | ( | struct class * | class, | |
| struct device * | parent, | |||
| dev_t | devt, | |||
| void * | drvdata, | |||
| const char * | fmt, | |||
| ... | ||||
| ) | [read] |
| int device_create_bin_file | ( | struct device * | dev, | |
| struct bin_attribute * | attr | |||
| ) |
| int device_create_file | ( | struct device * | dev, | |
| struct device_attribute * | attr | |||
| ) |
| static void device_create_release | ( | struct device * | dev | ) | [static] |
| static int device_create_sys_dev_entry | ( | struct device * | dev | ) | [static] |
| struct device* device_create_vargs | ( | struct class * | class, | |
| struct device * | parent, | |||
| dev_t | devt, | |||
| void * | drvdata, | |||
| const char * | fmt, | |||
| va_list | args | |||
| ) | [read] |
| void device_del | ( | struct device * | dev | ) |
device_del - delete device from system.
: device.
This is the first part of the device unregistration sequence. This removes the device from the lists we control from here, has it removed from the other driver model subsystems it was added to in device_add(), and removes it from the kobject hierarchy.
NOTE: this should be called manually _iff_ device_add() was also called manually.
| struct device* device_find_child | ( | struct device * | parent, | |
| void * | data, | |||
| int(*)(struct device *dev, void *data) | match | |||
| ) | [read] |
device_find_child - device iterator for locating a particular device.
: parent struct device : Data to pass to match function : Callback function to check device
This is similar to the device_for_each_child() function above, but it returns a reference to a device that is 'found' for later use, as determined by the callback.
The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero and a reference to the current device can be obtained, this function will return to the caller and not iterate over any more devices.
| int device_for_each_child | ( | struct device * | parent, | |
| void * | data, | |||
| int(*)(struct device *dev, void *data) | fn | |||
| ) |
| void device_initialize | ( | struct device * | dev | ) |
device_initialize - init device structure.
: device.
This prepares the device for use by other layers by initializing its fields. It is the first half of device_register(), if called by that function, though it can also be called separately, so one may use 's fields. In particular, get_device()/put_device() may be used for reference counting of after calling this function.
NOTE: Use put_device() to give up your reference instead of freeing directly once you have called this function.
| static int device_is_not_partition | ( | struct device * | dev | ) | [inline, static] |
| int device_move | ( | struct device * | dev, | |
| struct device * | new_parent | |||
| ) |
| static int device_move_class_links | ( | struct device * | dev, | |
| struct device * | old_parent, | |||
| struct device * | new_parent | |||
| ) | [static] |
| int device_register | ( | struct device * | dev | ) |
device_register - register a device with the system.
: pointer to the device structure
This happens in two clean steps - initialize the device and add it to the system. The two steps can be called separately, but this is the easiest and most common. I.e. you should only call the two helpers separately if have a clearly defined need to use and refcount the device before it is added to the hierarchy.
NOTE: _Never_ directly free after calling this function, even if it returned an error! Always use put_device() to give up the reference initialized in this function instead.
| static void device_release | ( | struct kobject * | kobj | ) | [static] |
| static void device_remove_attributes | ( | struct device * | dev, | |
| struct device_attribute * | attrs | |||
| ) | [static] |
| static void device_remove_attrs | ( | struct device * | dev | ) | [static] |
| void device_remove_bin_file | ( | struct device * | dev, | |
| struct bin_attribute * | attr | |||
| ) |
| static void device_remove_class_symlinks | ( | struct device * | dev | ) | [static] |
| void device_remove_file | ( | struct device * | dev, | |
| struct device_attribute * | attr | |||
| ) |
| static void device_remove_groups | ( | struct device * | dev, | |
| struct attribute_group ** | groups | |||
| ) | [static] |
| static void device_remove_sys_dev_entry | ( | struct device * | dev | ) | [static] |
| int device_rename | ( | struct device * | dev, | |
| char * | new_name | |||
| ) |
device_rename - renames a device : the pointer to the struct device to be renamed : the new name of the device
It is the responsibility of the caller to provide mutual exclusion between two different calls of device_rename on the same device to ensure that new_name is valid and won't conflict with other devices.
| int device_schedule_callback_owner | ( | struct device * | dev, | |
| void(*)(struct device *) | func, | |||
| struct module * | owner | |||
| ) |
device_schedule_callback_owner - helper to schedule a callback for a device : device.
: callback function to invoke later. : module owning the callback routine
Attribute methods must not unregister themselves or their parent device (which would amount to the same thing). Attempts to do so will deadlock, since unregistration is mutually exclusive with driver callbacks.
Instead methods can call this routine, which will attempt to allocate and schedule a workqueue request to call back with as its argument in the workqueue's process context. will be pinned until returns.
This routine is usually called via the inline device_schedule_callback(), which automatically sets to THIS_MODULE.
Returns 0 if the request was submitted, -ENOMEM if storage could not be allocated, -ENODEV if a reference to isn't available.
NOTE: This routine won't work if CONFIG_SYSFS isn't set! It uses an underlying sysfs routine (since it is intended for use by attribute methods), and if sysfs isn't available you'll get nothing but -ENOSYS.
| void device_shutdown | ( | void | ) |
| static struct kobject* device_to_dev_kobj | ( | struct device * | dev | ) | [static, read] |
device_to_dev_kobj - select a /sys/dev/ directory for the device : device
By default we select char/ for new entries. Setting class->dev_obj to NULL prevents an entry from being created. class->dev_kobj must be set (or cleared) before any devices are registered to the class otherwise device_create_sys_dev_entry() and device_remove_sys_dev_entry() will disagree about the the presence of the link.
| void device_unregister | ( | struct device * | dev | ) |
device_unregister - unregister device from system.
: device going away.
We do this in two parts, like we do device_register(). First, we remove it from all the subsystems with device_del(), then we decrement the reference count via put_device(). If that is the final reference count, the device will be cleaned up via device_release() above. Otherwise, the structure will stick around until the final reference to the device is dropped.
| EXPORT_SYMBOL | ( | dev_driver_string | ) |
| EXPORT_SYMBOL_GPL | ( | device_move | ) |
| EXPORT_SYMBOL_GPL | ( | device_rename | ) |
| EXPORT_SYMBOL_GPL | ( | device_destroy | ) |
| EXPORT_SYMBOL_GPL | ( | device_create | ) |
| EXPORT_SYMBOL_GPL | ( | device_create_vargs | ) |
| EXPORT_SYMBOL_GPL | ( | root_device_unregister | ) |
| EXPORT_SYMBOL_GPL | ( | __root_device_register | ) |
| EXPORT_SYMBOL_GPL | ( | device_remove_file | ) |
| EXPORT_SYMBOL_GPL | ( | device_create_file | ) |
| EXPORT_SYMBOL_GPL | ( | put_device | ) |
| EXPORT_SYMBOL_GPL | ( | get_device | ) |
| EXPORT_SYMBOL_GPL | ( | device_unregister | ) |
| EXPORT_SYMBOL_GPL | ( | device_del | ) |
| EXPORT_SYMBOL_GPL | ( | device_register | ) |
| EXPORT_SYMBOL_GPL | ( | device_add | ) |
| EXPORT_SYMBOL_GPL | ( | device_initialize | ) |
| EXPORT_SYMBOL_GPL | ( | device_find_child | ) |
| EXPORT_SYMBOL_GPL | ( | device_for_each_child | ) |
| EXPORT_SYMBOL_GPL | ( | dev_set_name | ) |
| EXPORT_SYMBOL_GPL | ( | device_schedule_callback_owner | ) |
| EXPORT_SYMBOL_GPL | ( | device_remove_bin_file | ) |
| EXPORT_SYMBOL_GPL | ( | device_create_bin_file | ) |
| struct device* get_device | ( | struct device * | dev | ) | [read] |
| static struct kobject* get_device_parent | ( | struct device * | dev, | |
| struct device * | parent | |||
| ) | [static, read] |
| static void klist_children_get | ( | struct klist_node * | n | ) | [static] |
| static void klist_children_put | ( | struct klist_node * | n | ) | [static] |
| static struct device* next_device | ( | struct klist_iter * | i | ) | [static, read] |
| void put_device | ( | struct device * | dev | ) |
| static void root_device_release | ( | struct device * | dev | ) | [static] |
| void root_device_unregister | ( | struct device * | dev | ) |
| static void setup_parent | ( | struct device * | dev, | |
| struct device * | parent | |||
| ) | [static] |
| static ssize_t show_dev | ( | struct device * | dev, | |
| struct device_attribute * | attr, | |||
| char * | buf | |||
| ) | [static] |
| static ssize_t show_uevent | ( | struct device * | dev, | |
| struct device_attribute * | attr, | |||
| char * | buf | |||
| ) | [static] |
| static ssize_t store_uevent | ( | struct device * | dev, | |
| struct device_attribute * | attr, | |||
| const char * | buf, | |||
| size_t | count | |||
| ) | [static] |
| static struct kobject* virtual_device_parent | ( | struct device * | dev | ) | [static, read] |
struct sysfs_ops dev_sysfs_ops [static] |
Initial value:
{
.show = dev_attr_show,
.store = dev_attr_store,
}
struct kobj_type device_ktype [static] |
Initial value:
{
.release = device_release,
.sysfs_ops = &dev_sysfs_ops,
}
struct kset_uevent_ops device_uevent_ops [static] |
Initial value:
{
.filter = dev_uevent_filter,
.name = dev_uevent_name,
.uevent = dev_uevent,
}
| struct kset* devices_kset |
struct device_attribute devt_attr [static] |
| int(* platform_notify)(struct device *dev) = NULL |
| int(* platform_notify_remove)(struct device *dev) = NULL |
| struct kobject* sysfs_dev_block_kobj |
| struct kobject* sysfs_dev_char_kobj |
struct device_attribute uevent_attr [static] |
Initial value:
__ATTR(uevent, S_IRUGO | S_IWUSR, show_uevent, store_uevent)
1.5.6