1 |
62 |
marcus.erl |
/*
|
2 |
|
|
* class_container.h - a generic container for all classes
|
3 |
|
|
*
|
4 |
|
|
* Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
|
5 |
|
|
*
|
6 |
|
|
* This file is licensed under GPLv2
|
7 |
|
|
*/
|
8 |
|
|
|
9 |
|
|
#ifndef _ATTRIBUTE_CONTAINER_H_
|
10 |
|
|
#define _ATTRIBUTE_CONTAINER_H_
|
11 |
|
|
|
12 |
|
|
#include <linux/device.h>
|
13 |
|
|
#include <linux/list.h>
|
14 |
|
|
#include <linux/klist.h>
|
15 |
|
|
|
16 |
|
|
struct attribute_container {
|
17 |
|
|
struct list_head node;
|
18 |
|
|
struct klist containers;
|
19 |
|
|
struct class *class;
|
20 |
|
|
struct class_device_attribute **attrs;
|
21 |
|
|
int (*match)(struct attribute_container *, struct device *);
|
22 |
|
|
#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
|
23 |
|
|
unsigned long flags;
|
24 |
|
|
};
|
25 |
|
|
|
26 |
|
|
static inline int
|
27 |
|
|
attribute_container_no_classdevs(struct attribute_container *atc)
|
28 |
|
|
{
|
29 |
|
|
return atc->flags & ATTRIBUTE_CONTAINER_NO_CLASSDEVS;
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
static inline void
|
33 |
|
|
attribute_container_set_no_classdevs(struct attribute_container *atc)
|
34 |
|
|
{
|
35 |
|
|
atc->flags |= ATTRIBUTE_CONTAINER_NO_CLASSDEVS;
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
int attribute_container_register(struct attribute_container *cont);
|
39 |
|
|
int attribute_container_unregister(struct attribute_container *cont);
|
40 |
|
|
void attribute_container_create_device(struct device *dev,
|
41 |
|
|
int (*fn)(struct attribute_container *,
|
42 |
|
|
struct device *,
|
43 |
|
|
struct class_device *));
|
44 |
|
|
void attribute_container_add_device(struct device *dev,
|
45 |
|
|
int (*fn)(struct attribute_container *,
|
46 |
|
|
struct device *,
|
47 |
|
|
struct class_device *));
|
48 |
|
|
void attribute_container_remove_device(struct device *dev,
|
49 |
|
|
void (*fn)(struct attribute_container *,
|
50 |
|
|
struct device *,
|
51 |
|
|
struct class_device *));
|
52 |
|
|
void attribute_container_device_trigger(struct device *dev,
|
53 |
|
|
int (*fn)(struct attribute_container *,
|
54 |
|
|
struct device *,
|
55 |
|
|
struct class_device *));
|
56 |
|
|
void attribute_container_trigger(struct device *dev,
|
57 |
|
|
int (*fn)(struct attribute_container *,
|
58 |
|
|
struct device *));
|
59 |
|
|
int attribute_container_add_attrs(struct class_device *classdev);
|
60 |
|
|
int attribute_container_add_class_device(struct class_device *classdev);
|
61 |
|
|
int attribute_container_add_class_device_adapter(struct attribute_container *cont,
|
62 |
|
|
struct device *dev,
|
63 |
|
|
struct class_device *classdev);
|
64 |
|
|
void attribute_container_remove_attrs(struct class_device *classdev);
|
65 |
|
|
void attribute_container_class_device_del(struct class_device *classdev);
|
66 |
|
|
struct attribute_container *attribute_container_classdev_to_container(struct class_device *);
|
67 |
|
|
struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *);
|
68 |
|
|
struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev);
|
69 |
|
|
|
70 |
|
|
#endif
|