Linux Kernel
3.7.1
|
#include <linux/ioport.h>
#include <linux/kobject.h>
#include <linux/klist.h>
#include <linux/list.h>
#include <linux/lockdep.h>
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/mutex.h>
#include <linux/pm.h>
#include <linux/atomic.h>
#include <linux/ratelimit.h>
#include <asm/device.h>
#include <linux/pm_wakeup.h>
Go to the source code of this file.
Data Structures | |
struct | bus_attribute |
struct | bus_type |
struct | subsys_dev_iter |
struct | device_driver |
struct | driver_attribute |
struct | subsys_interface |
class | class |
struct | class_dev_iter |
struct | class_attribute |
struct | class_attribute_string |
struct | class_interface |
struct | device_type |
struct | device_attribute |
struct | dev_ext_attribute |
struct | device_dma_parameters |
class | device |
Namespaces | |
namespace | Namespace |
Macros | |
#define | BUS_ATTR(_name, _mode, _show, _store) struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) |
Functions | |
int __must_check | bus_create_file (struct bus_type *, struct bus_attribute *) |
void | bus_remove_file (struct bus_type *, struct bus_attribute *) |
: name of the device function | |
struct subsys_interface - interfaces to device functions : subsytem of the devices to attach to : the list of functions registered at the subsystem : device hookup to device function handler : device hookup to device function handler Simple interfaces attached to a subsystem. Multiple interfaces can attach to a subsystem and its devices. Unlike drivers, they do not exclusively claim or control devices. Interfaces usually represent a specific functionality of a subsystem/class of devices. | |
int | subsys_interface_register (struct subsys_interface *sif) |
void | subsys_interface_unregister (struct subsys_interface *sif) |
int | subsys_system_register (struct bus_type *subsys, const struct attribute_group **groups) |
: The name of the bus. | |
struct bus_type - The bus type of the device : Used for subsystems to enumerate devices like ("foo%u", dev->id). : Default device to use as the parent. : Default attributes of the bus. : Default attributes of the devices on the bus. : Default attributes of the device drivers on the bus. : Called, perhaps multiple times, whenever a new device or driver is added for this bus. It should return a nonzero value if the given device can be handled by the given driver. : Called when a device is added, removed, or a few other things that generate uevents to add the environment variables. : Called when a new device or driver add to this bus, and callback the specific driver's probe to initial the matched device. : Called when a device removed from this bus. : Called at shut-down time to quiesce the device. : Called when a device on this bus wants to go to sleep mode. : Called to bring a device on this bus out of sleep mode. : Power management operations of this bus, callback the specific device driver's pm-ops. : IOMMU specific operations for this bus, used to attach IOMMU driver implementations to a bus and allow the driver to do bus-specific setup A bus is a channel between the processor and one or more devices. For the purposes of the device model, all devices are connected via a bus, even if it is an internal, virtual, "platform" bus. Buses can plug into each other. A USB controller is usually a PCI device, for example. The device model represents the actual connections between buses and the devices they control. A bus is represented by the bus_type structure. It contains the name, the default attributes, the bus' methods, PM operations, and the driver core's private data. | |
#define | bus_register(subsys) |
#define | BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ |
#define | BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ |
#define | BUS_NOTIFY_BIND_DRIVER |
#define | BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */ |
#define | BUS_NOTIFY_UNBIND_DRIVER |
#define | BUS_NOTIFY_UNBOUND_DRIVER |
int __must_check | __bus_register (struct bus_type *bus, struct lock_class_key *key) |
void | bus_unregister (struct bus_type *bus) |
int __must_check | bus_rescan_devices (struct bus_type *bus) |
void | subsys_dev_iter_init (struct subsys_dev_iter *iter, struct bus_type *subsys, struct device *start, const struct device_type *type) |
struct device * | subsys_dev_iter_next (struct subsys_dev_iter *iter) |
void | subsys_dev_iter_exit (struct subsys_dev_iter *iter) |
int | bus_for_each_dev (struct bus_type *bus, struct device *start, void *data, int(*fn)(struct device *dev, void *data)) |
struct device * | bus_find_device (struct bus_type *bus, struct device *start, void *data, int(*match)(struct device *dev, void *data)) |
struct device * | bus_find_device_by_name (struct bus_type *bus, struct device *start, const char *name) |
struct device * | subsys_find_device_by_id (struct bus_type *bus, unsigned int id, struct device *hint) |
int | bus_for_each_drv (struct bus_type *bus, struct device_driver *start, void *data, int(*fn)(struct device_driver *, void *)) |
void | bus_sort_breadthfirst (struct bus_type *bus, int(*compare)(const struct device *a, const struct device *b)) |
int | bus_register_notifier (struct bus_type *bus, struct notifier_block *nb) |
int | bus_unregister_notifier (struct bus_type *bus, struct notifier_block *nb) |
struct kset * | bus_get_kset (struct bus_type *bus) |
struct klist * | bus_get_device_klist (struct bus_type *bus) |
: Name of the device driver. | |
struct device_driver - The basic device driver structure : The bus which the device of this driver belongs to. : The module owner. : Used for built-in modules. : Disables bind/unbind via sysfs. : The open firmware table. : Called to query the existence of a specific device, whether this driver can work with it, and bind the driver to a specific device. : Called when the device is removed from the system to unbind a device from this driver. : Called at shut-down time to quiesce the device. : Called to put the device to sleep mode. Usually to a low power state. : Called to bring a device from sleep mode. : Default attributes that get created by the driver core automatically. : Power management operations of the device which matched this driver. The device driver-model tracks all of the drivers known to the system. The main reason for this tracking is to enable the driver core to match up drivers with new devices. Once drivers are known objects within the system, however, a number of other things become possible. Device drivers can export information and configuration variables that are independent of any specific device. | |
#define | DRIVER_ATTR(_name, _mode, _show, _store) |
int __must_check | driver_register (struct device_driver *drv) |
void | driver_unregister (struct device_driver *drv) |
struct device_driver * | driver_find (const char *name, struct bus_type *bus) |
int | driver_probe_done (void) |
void | wait_for_device_probe (void) |
int __must_check | driver_create_file (struct device_driver *driver, const struct driver_attribute *attr) |
void | driver_remove_file (struct device_driver *driver, const struct driver_attribute *attr) |
int __must_check | driver_for_each_device (struct device_driver *drv, struct device *start, void *data, int(*fn)(struct device *dev, void *)) |
struct device * | driver_find_device (struct device_driver *drv, struct device *start, void *data, int(*match)(struct device *dev, void *data)) |
#define _CLASS_ATTR_STRING | ( | _name, | |
_mode, | |||
_str | |||
) | { __ATTR(_name, _mode, show_class_attr_string, NULL), _str } |
#define BUS_ATTR | ( | _name, | |
_mode, | |||
_show, | |||
_store | |||
) | struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) |
#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ |
#define BUS_NOTIFY_BIND_DRIVER |
#define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */ |
#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ |
#define BUS_NOTIFY_UNBIND_DRIVER |
#define BUS_NOTIFY_UNBOUND_DRIVER |
#define bus_register | ( | subsys | ) |
#define CLASS_ATTR | ( | _name, | |
_mode, | |||
_show, | |||
_store | |||
) | struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) |
#define CLASS_ATTR_STRING | ( | _name, | |
_mode, | |||
_str | |||
) |
#define class_register | ( | class | ) |
#define dev_alert_ratelimited | ( | dev, | |
fmt, | |||
... | |||
) | dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__) |
#define dev_crit_ratelimited | ( | dev, | |
fmt, | |||
... | |||
) | dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__) |
#define dev_dbg_ratelimited | ( | dev, | |
fmt, | |||
... | |||
) | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
#define dev_emerg_ratelimited | ( | dev, | |
fmt, | |||
... | |||
) | dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__) |
#define dev_notice_ratelimited | ( | dev, | |
fmt, | |||
... | |||
) | dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) |
#define DEVICE_ATTR | ( | _name, | |
_mode, | |||
_show, | |||
_store | |||
) | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
#define DEVICE_ATTR_IGNORE_LOCKDEP | ( | _name, | |
_mode, | |||
_show, | |||
_store | |||
) |
#define DEVICE_INT_ATTR | ( | _name, | |
_mode, | |||
_var | |||
) |
#define device_schedule_callback | ( | dev, | |
func | |||
) | device_schedule_callback_owner(dev, func, THIS_MODULE) |
#define DEVICE_ULONG_ATTR | ( | _name, | |
_mode, | |||
_var | |||
) |
#define DRIVER_ATTR | ( | _name, | |
_mode, | |||
_show, | |||
_store | |||
) |
#define MODULE_ALIAS_CHARDEV | ( | major, | |
minor | |||
) | MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) |
#define MODULE_ALIAS_CHARDEV_MAJOR | ( | major | ) | MODULE_ALIAS("char-major-" __stringify(major) "-*") |
#define module_driver | ( | __driver, | |
__register, | |||
__unregister, | |||
... | |||
) |
module_driver() - Helper macro for drivers that don't do anything special in module init/exit. This eliminates a lot of boilerplate. Each module may only use this macro once, and calling it replaces module_init() and module_exit().
: driver name : register function for this driver type : unregister function for this driver type ..: Additional arguments to be passed to __register and __unregister.
Use this macro to construct bus specific macros for registering drivers, and do not use it on its own.
#define root_device_register | ( | name | ) | __root_device_register(name, THIS_MODULE) |
int __must_check __bus_register | ( | struct bus_type * | bus, |
struct lock_class_key * | key | ||
) |
|
read |
int __must_check __class_register | ( | struct class * | class, |
struct lock_class_key * | key | ||
) |
__printf | ( | 2 | , |
3 | |||
) |
__printf | ( | 5 | , |
6 | |||
) |
int __must_check bus_create_file | ( | struct bus_type * | , |
struct bus_attribute * | |||
) |
|
read |
bus_find_device - device iterator for locating a particular device. : bus type : Device to begin with : Data to pass to match function : Callback function to check device
This is similar to the bus_for_each_dev() 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, this function will return to the caller and not iterate over any more devices.
int bus_for_each_dev | ( | struct bus_type * | bus, |
struct device * | start, | ||
void * | data, | ||
int(*)(struct device *dev, void *data) | fn | ||
) |
int bus_for_each_drv | ( | struct bus_type * | bus, |
struct device_driver * | start, | ||
void * | data, | ||
int(*)(struct device_driver *, void *) | fn | ||
) |
int bus_register_notifier | ( | struct bus_type * | bus, |
struct notifier_block * | nb | ||
) |
void bus_remove_file | ( | struct bus_type * | , |
struct bus_attribute * | |||
) |
int __must_check bus_rescan_devices | ( | struct bus_type * | bus | ) |
int bus_unregister_notifier | ( | struct bus_type * | bus, |
struct notifier_block * | nb | ||
) |
|
read |
void class_compat_unregister | ( | struct class_compat * | cls | ) |
int __must_check class_create_file | ( | struct class * | class, |
const struct class_attribute * | attr | ||
) |
void class_dev_iter_exit | ( | struct class_dev_iter * | iter | ) |
void class_dev_iter_init | ( | struct class_dev_iter * | iter, |
struct class * | class, | ||
struct device * | start, | ||
const struct device_type * | type | ||
) |
|
read |
class_dev_iter_next - iterate to the next device : class iterator to proceed
Proceed to the next device and return it. Returns NULL if iteration is complete.
The returned device is referenced and won't be released till iterator is proceed to the next device or exited. The caller is free to do whatever it wants to do with the device including calling back into class code.
int class_for_each_device | ( | struct class * | class, |
struct device * | start, | ||
void * | data, | ||
int(*)(struct device *dev, void *data) | fn | ||
) |
int __must_check class_interface_register | ( | struct class_interface * | ) |
void class_interface_unregister | ( | struct class_interface * | ) |
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 driver, 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 __must_check 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.
Do not call this routine or device_register() more than once for any device structure. The driver model core is not designed to work with devices that get unregistered and then spring back to life. (Among other things, it's very hard to guarantee that all references to the previous incarnation of have been dropped.) Allocate and register a fresh new struct device instead.
NOTE: Never directly free after calling this function, even if it returned an error! Always use put_device() to give up your reference instead.
int __must_check device_attach | ( | struct device * | dev | ) |
device_attach - try to attach device to a driver. : device.
Walk the list of drivers that the bus has and call driver_probe_device() for each pair. If a compatible pair is found, break out and return.
Returns 1 if the device was bound to a driver; 0 if no matching driver was found; -ENODEV if the device is not registered.
When called for a USB interface, ->parent lock must be held.
int __must_check device_bind_driver | ( | struct device * | dev | ) |
device_bind_driver - bind a driver to one device. : device.
Allow manual attachment of a driver to a device. Caller must have already set ->driver.
Note that this does not modify the bus reference count nor take the bus's rwsem. Please verify those are accounted for before calling this. (It is ok to call with no other effort from a driver's probe() method.)
This function must be called with the device lock held.
int __must_check device_create_bin_file | ( | struct device * | dev, |
const struct bin_attribute * | attr | ||
) |
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.
|
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.
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.
All fields in must be initialized by the caller to 0, except for those explicitly set to some other value. The simplest approach is to use kzalloc() to allocate the structure containing .
NOTE: Use put_device() to give up your reference instead of freeing directly once you have called this function.
int __must_check 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.
For more information, see the kerneldoc for device_initialize() and device_add().
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.
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.
Note: Don't call this function. Currently, the networking layer calls this function, but that will change. The following text from Kay Sievers offers some insight:
Renaming devices is racy at many levels, symlinks and other stuff are not replaced atomically, and you get a "move" uevent, but it's not easy to connect the event to the old and new device. Device nodes are not renamed at all, there isn't even support for that in the kernel now.
In the meantime, during renaming, your target name might be taken by another driver, creating conflicts. Or the old name is taken directly after you renamed it – then you get events for the same DEVPATH, before you even see the "move" event. It's just a mess, and nothing new should ever rely on kernel device renaming. Besides that, it's not even implemented now for other things than (driver-core wise very simple) network devices.
We are currently about to change network renaming in udev to completely disallow renaming of devices in the same namespace as the kernel uses, because we can't solve the problems properly, that arise with swapping names of multiple interfaces without races. Means, renaming of eth[0-9]* will only be allowed to some other name than eth[0-9]*, for the aforementioned reasons.
Make up a "real" name in the driver before you register anything, or add some other attributes for userspace to find the device, or use udev to add symlinks – but never rename kernel devices later, it's a complete mess. We don't even want to get into that and try to implement the missing pieces in the core. We really have other pieces to fix in the driver core mess. :)
int __must_check device_reprobe | ( | struct device * | dev | ) |
device_reprobe - remove driver for a device and probe for a new driver : the device to reprobe
This function detaches the attached driver (if any) for the given device and restarts the driver probing process. It is intended to use if probing criteria changed during a devices lifetime and driver attachment should change accordingly.
int device_schedule_callback_owner | ( | struct device * | dev, |
void(*)(struct device *dev) | func, | ||
struct module * | owner | ||
) |
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.
devm_kfree - Resource-managed kfree : Device this memory belongs to : Memory to free
Free memory allocated with devm_kzalloc().
devm_kzalloc - Resource-managed kzalloc : Device to allocate memory for : Allocation size : Allocation gfp flags
Managed kzalloc. Memory allocated with this function is automatically freed on driver detach. Like all other devres resources, guaranteed alignment is unsigned long long.
RETURNS: Pointer to allocated memory on success, NULL on failure.
devm_request_and_ioremap() - Check, request region, and ioremap resource : Generic device to handle the resource for : resource to be handled
Takes all necessary steps to ioremap a mem resource. Uses managed device, so everything is undone on driver detach. Checks arguments, so you can feed it the result from e.g. platform_get_resource() directly. Returns the remapped pointer or NULL on error. Usage example:
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_request_and_ioremap(&pdev->dev, res); if (!base) return -EADDRNOTAVAIL;
devres_add - Register device resource : Device to add resource to : Resource to register
Register devres to . should have been allocated using devres_alloc(). On driver detach, the associated release function will be invoked and devres will be freed automatically.
void* devres_alloc | ( | dr_release_t | release, |
size_t | size, | ||
gfp_t | gfp | ||
) |
devres_alloc - Allocate device resource data : Release function devres will be associated with : Allocation size : Allocation flags
Allocate devres of bytes. The allocated area is zeroed, then associated with . The returned pointer can be passed to other devres_*() functions.
RETURNS: Pointer to allocated devres on success, NULL on failure.
int devres_destroy | ( | struct device * | dev, |
dr_release_t | release, | ||
dr_match_t | match, | ||
void * | match_data | ||
) |
devres_destroy - Find a device resource and destroy it : Device to find resource from : Look for resources associated with this release function : Match function (optional) : Data for the match function
Find the latest devres of associated with and for which returns 1. If is NULL, it's considered to match all. If found, the resource is removed atomically and freed.
Note that the release function for the resource will not be called, only the devres-allocated data will be freed. The caller becomes responsible for freeing any other data.
RETURNS: 0 if devres is found and freed, -ENOENT if not found.
void* devres_find | ( | struct device * | dev, |
dr_release_t | release, | ||
dr_match_t | match, | ||
void * | match_data | ||
) |
devres_find - Find device resource : Device to lookup resource from : Look for resources associated with this release function : Match function (optional) : Data for the match function
Find the latest devres of which is associated with and for which returns 1. If is NULL, it's considered to match all.
RETURNS: Pointer to found devres, NULL if not found.
devres_free - Free device resource data : Pointer to devres data to free
Free devres created with devres_alloc().
devres_get - Find devres, if non-existent, add one atomically : Device to lookup or add devres for : Pointer to new initialized devres to add if not found : Match function (optional) : Data for the match function
Find the latest devres of which has the same release function as and for which return 1. If found, is freed; otherwise, is added atomically.
RETURNS: Pointer to found or added devres.
devres_open_group - Open a new devres group : Device to open devres group for : Separator ID : Allocation flags
Open a new devres group for with . For , using a pointer to an object which won't be used for another group is recommended. If is NULL, address-wise unique ID is created.
RETURNS: ID of the new group, NULL on failure.
int devres_release | ( | struct device * | dev, |
dr_release_t | release, | ||
dr_match_t | match, | ||
void * | match_data | ||
) |
devres_release - Find a device resource and destroy it, calling release : Device to find resource from : Look for resources associated with this release function : Match function (optional) : Data for the match function
Find the latest devres of associated with and for which returns 1. If is NULL, it's considered to match all. If found, the resource is removed atomically, the release function called and the resource freed.
RETURNS: 0 if devres is found and freed, -ENOENT if not found.
devres_release_group - Release resources in a devres group : Device to release group for : ID of target group, can be NULL
Release all resources in the group identified by . If is NULL, the latest open group is selected. The selected group and groups properly nested inside the selected group are removed.
RETURNS: The number of released non-group resources.
void* devres_remove | ( | struct device * | dev, |
dr_release_t | release, | ||
dr_match_t | match, | ||
void * | match_data | ||
) |
devres_remove - Find a device resource and remove it : Device to find resource from : Look for resources associated with this release function : Match function (optional) : Data for the match function
Find the latest devres of associated with and for which returns 1. If is NULL, it's considered to match all. If found, the resource is removed atomically and returned.
RETURNS: Pointer to removed devres on success, NULL if not found.
int __must_check driver_attach | ( | struct device_driver * | drv | ) |
int __must_check driver_create_file | ( | struct device_driver * | drv, |
const struct driver_attribute * | attr | ||
) |
|
read |
driver_find_device - device iterator for locating a particular device. : The device's driver : Device to begin with : Data to pass to match function : Callback function to check device
This is similar to the driver_for_each_device() 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, this function will return to the caller and not iterate over any more devices.
int __must_check driver_for_each_device | ( | struct device_driver * | drv, |
struct device * | start, | ||
void * | data, | ||
int(*)(struct device *dev, void *) | fn | ||
) |
int __must_check driver_register | ( | struct device_driver * | drv | ) |
void driver_remove_file | ( | struct device_driver * | drv, |
const struct driver_attribute * | attr | ||
) |
void driver_unregister | ( | struct device_driver * | drv | ) |
root_device_unregister - unregister and free a root device : device going away
This function unregisters and cleans up a device that was created by root_device_register().
void subsys_dev_iter_exit | ( | struct subsys_dev_iter * | iter | ) |
void subsys_dev_iter_init | ( | struct subsys_dev_iter * | iter, |
struct bus_type * | subsys, | ||
struct device * | start, | ||
const struct device_type * | type | ||
) |
subsys_dev_iter_init - initialize subsys device iterator : subsys iterator to initialize : the subsys we wanna iterate over : the device to start iterating from, if any : device_type of the devices to iterate over, NULL for all
Initialize subsys iterator such that it iterates over devices of . If is set, the list iteration will start there, otherwise if it is NULL, the iteration starts at the beginning of the list.
|
read |
subsys_dev_iter_next - iterate to the next device : subsys iterator to proceed
Proceed to the next device and return it. Returns NULL if iteration is complete.
The returned device is referenced and won't be released till iterator is proceed to the next device or exited. The caller is free to do whatever it wants to do with the device including calling back into subsys code.
|
read |
subsys_find_device_by_id - find a device with a specific enumeration number : subsystem : index 'id' in struct device : device to check first
Check the hint's next object and if it is a match return it directly, otherwise, fall back to a full list search. Either way a reference for the returned object is taken.
int subsys_interface_register | ( | struct subsys_interface * | sif | ) |
void subsys_interface_unregister | ( | struct subsys_interface * | sif | ) |
subsys_system_register - register a subsystem at /sys/devices/system/ : system subsystem : default attributes for the root device
All 'system' subsystems have a /sys/devices/system/<name> root device with the name of the subsystem. The root device can carry subsystem- wide attributes. All registered devices are below this single root device and are named after the subsystem with a simple enumeration number appended. The registered devices are not explicitely named; only 'id' in the device needs to be set.
Do not use this interface for anything new, it exists for compatibility with bad ideas only. New subsystems should use plain subsystems; and add the subsystem-wide attributes should be added to the subsystem directory itself and not some create fake root-device placed in /sys/devices/system/<name>.