Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
attribute_container.h File Reference
#include <linux/list.h>
#include <linux/klist.h>

Go to the source code of this file.

Data Structures

struct  attribute_container
 

Macros

#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS   0x01
 

Functions

int attribute_container_register (struct attribute_container *cont)
 
int __must_check attribute_container_unregister (struct attribute_container *cont)
 
void attribute_container_create_device (struct device *dev, int(*fn)(struct attribute_container *, struct device *, struct device *))
 
void attribute_container_add_device (struct device *dev, int(*fn)(struct attribute_container *, struct device *, struct device *))
 
void attribute_container_remove_device (struct device *dev, void(*fn)(struct attribute_container *, struct device *, struct device *))
 
void attribute_container_device_trigger (struct device *dev, int(*fn)(struct attribute_container *, struct device *, struct device *))
 
void attribute_container_trigger (struct device *dev, int(*fn)(struct attribute_container *, struct device *))
 
int attribute_container_add_attrs (struct device *classdev)
 
int attribute_container_add_class_device (struct device *classdev)
 
int attribute_container_add_class_device_adapter (struct attribute_container *cont, struct device *dev, struct device *classdev)
 
void attribute_container_remove_attrs (struct device *classdev)
 
void attribute_container_class_device_del (struct device *classdev)
 
struct attribute_containerattribute_container_classdev_to_container (struct device *)
 
struct deviceattribute_container_find_class_device (struct attribute_container *, struct device *)
 
struct device_attribute ** attribute_container_classdev_to_attrs (const struct device *classdev)
 

Macro Definition Documentation

#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS   0x01

Definition at line 24 of file attribute_container.h.

Function Documentation

int attribute_container_add_attrs ( struct device classdev)

attribute_container_add_attrs - add attributes

: The class device

This simply creates all the class device sysfs files from the attributes listed in the container

Definition at line 315 of file attribute_container.c.

int attribute_container_add_class_device ( struct device classdev)

attribute_container_add_class_device - same function as device_add

: the class device to add

This performs essentially the same function as device_add except for attribute containers, namely add the classdev to the system and then create the attribute files

Definition at line 350 of file attribute_container.c.

int attribute_container_add_class_device_adapter ( struct attribute_container cont,
struct device dev,
struct device classdev 
)

attribute_container_add_class_device_adapter - simple adapter for triggers

This function is identical to attribute_container_add_class_device except that it is designed to be called from the triggers

Definition at line 365 of file attribute_container.c.

void attribute_container_add_device ( struct device dev,
int(*)(struct attribute_container *, struct device *, struct device *)  fn 
)

Definition at line 142 of file attribute_container.c.

void attribute_container_class_device_del ( struct device classdev)

attribute_container_class_device_del - equivalent of class_device_del

: the class device

This function simply removes all the attribute files and then calls device_del.

Definition at line 407 of file attribute_container.c.

struct device_attribute** attribute_container_classdev_to_attrs ( const struct device classdev)
read
struct attribute_container* attribute_container_classdev_to_container ( struct device classdev)
read

attribute_container_classdev_to_container - given a classdev, return the container

: the class device created by attribute_container_add_device.

Returns the container associated with this classdev.

Definition at line 56 of file attribute_container.c.

void attribute_container_create_device ( struct device dev,
int(*)(struct attribute_container *, struct device *, struct device *)  fn 
)
void attribute_container_device_trigger ( struct device dev,
int(*)(struct attribute_container *, struct device *, struct device *)  fn 
)

Definition at line 251 of file attribute_container.c.

struct device* attribute_container_find_class_device ( struct attribute_container cont,
struct device dev 
)
read

attribute_container_find_class_device - find the corresponding class_device

: the container : the generic device

Looks up the device in the container's list of class devices and returns the corresponding class_device.

Definition at line 423 of file attribute_container.c.

int attribute_container_register ( struct attribute_container cont)

attribute_container_register - register an attribute container

: The container to register. This must be allocated by the callee and should also be zeroed by it.

Definition at line 75 of file attribute_container.c.

void attribute_container_remove_attrs ( struct device classdev)

attribute_container_remove_attrs - remove any attribute files

: The class device to remove the files from

Definition at line 379 of file attribute_container.c.

void attribute_container_remove_device ( struct device dev,
void(*)(struct attribute_container *, struct device *, struct device *)  fn 
)

Definition at line 207 of file attribute_container.c.

void attribute_container_trigger ( struct device dev,
int(*)(struct attribute_container *, struct device *)  fn 
)

Definition at line 292 of file attribute_container.c.

int __must_check attribute_container_unregister ( struct attribute_container cont)

attribute_container_unregister - remove a container registration

: previously registered container to remove

Definition at line 95 of file attribute_container.c.