Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
attribute_container.c File Reference
#include <linux/attribute_container.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include "base.h"

Go to the source code of this file.

Data Structures

struct  internal_container


#define klist_for_each_entry(pos, head, member, iter)


struct attribute_containerattribute_container_classdev_to_container (struct device *classdev)
 EXPORT_SYMBOL_GPL (attribute_container_classdev_to_container)
int attribute_container_register (struct attribute_container *cont)
 EXPORT_SYMBOL_GPL (attribute_container_register)
int attribute_container_unregister (struct attribute_container *cont)
 EXPORT_SYMBOL_GPL (attribute_container_unregister)
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 deviceattribute_container_find_class_device (struct attribute_container *cont, struct device *dev)
 EXPORT_SYMBOL_GPL (attribute_container_find_class_device)

Macro Definition Documentation

#define klist_for_each_entry (   pos,
for (klist_iter_init(head, iter); (pos = ({ \
n ? container_of(n, typeof(*pos), member) : \
({ klist_iter_exit(iter) ; NULL; }); \
}) ) != NULL; )

Definition at line 183 of file attribute_container.c.

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 attribute_container* attribute_container_classdev_to_container ( struct device classdev)

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_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 

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 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.

EXPORT_SYMBOL_GPL ( attribute_container_register  )
EXPORT_SYMBOL_GPL ( attribute_container_unregister  )
EXPORT_SYMBOL_GPL ( attribute_container_find_class_device  )