Lines Matching +full:foo +full:- +full:bar
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2004-2007 Greg Kroah-Hartman <greg@kroah.com>
16 * /sys/kernel/kobject-example In that directory, 3 files are created:
17 * "foo", "baz", and "bar". If an integer is written to these files, it can be
21 static int foo; variable
23 static int bar; variable
26 * The "foo" file where a static variable is read from and written to.
31 return sysfs_emit(buf, "%d\n", foo); in foo_show()
39 ret = kstrtoint(buf, 10, &foo); in foo_store()
46 /* Sysfs attributes cannot be world-writable. */
48 __ATTR(foo, 0664, foo_show, foo_store);
52 * looking at the attribute for the "baz" and "bar" files.
59 if (strcmp(attr->attr.name, "baz") == 0) in b_show()
62 var = bar; in b_show()
75 if (strcmp(attr->attr.name, "baz") == 0) in b_store()
78 bar = var; in b_store()
85 __ATTR(bar, 0664, b_show, b_store);
126 return -ENOMEM; in example_init()
144 MODULE_AUTHOR("Greg Kroah-Hartman <greg@kroah.com>");