Searched refs:foo_obj (Results 1 - 1 of 1) sorted by relevance

/linux-4.1.27/samples/kobject/
H A Dkset-example.c31 struct foo_obj { struct
37 #define to_foo_obj(x) container_of(x, struct foo_obj, kobj)
39 /* a custom attribute that works just for a struct foo_obj. */
42 ssize_t (*show)(struct foo_obj *foo, struct foo_attribute *attr, char *buf);
43 ssize_t (*store)(struct foo_obj *foo, struct foo_attribute *attr, const char *buf, size_t count);
51 * transpose back from a "default" kobject to our custom struct foo_obj and
59 struct foo_obj *foo; foo_attr_show()
79 struct foo_obj *foo; foo_attr_store()
105 struct foo_obj *foo; foo_release()
114 static ssize_t foo_show(struct foo_obj *foo_obj, struct foo_attribute *attr, foo_show() argument
117 return sprintf(buf, "%d\n", foo_obj->foo); foo_show()
120 static ssize_t foo_store(struct foo_obj *foo_obj, struct foo_attribute *attr, foo_store() argument
125 ret = kstrtoint(buf, 10, &foo_obj->foo); foo_store()
140 static ssize_t b_show(struct foo_obj *foo_obj, struct foo_attribute *attr, b_show() argument
146 var = foo_obj->baz; b_show()
148 var = foo_obj->bar; b_show()
152 static ssize_t b_store(struct foo_obj *foo_obj, struct foo_attribute *attr, b_store() argument
162 foo_obj->baz = var; b_store()
164 foo_obj->bar = var; b_store()
196 static struct foo_obj *foo_obj; variable in typeref:struct:foo_obj
197 static struct foo_obj *bar_obj;
198 static struct foo_obj *baz_obj;
200 static struct foo_obj *create_foo_obj(const char *name) create_foo_obj()
202 struct foo_obj *foo; create_foo_obj()
237 static void destroy_foo_obj(struct foo_obj *foo) destroy_foo_obj()
255 foo_obj = create_foo_obj("foo"); example_init()
256 if (!foo_obj) example_init()
272 destroy_foo_obj(foo_obj); example_init()
282 destroy_foo_obj(foo_obj); example_exit()

Completed in 104 milliseconds