Thomas Gleixner | 328970d | 2019-05-24 12:04:05 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 2 | /* |
Joel Becker | ecb3d28 | 2008-06-18 19:29:05 -0700 | [diff] [blame] | 3 | * configfs_example_macros.c - This file is a demonstration module |
| 4 | * containing a number of configfs subsystems. It uses the helper |
| 5 | * macros defined by configfs.h |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 6 | * |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 7 | * Based on sysfs: |
Bartosz Golaszewski | 288f295 | 2020-09-24 14:45:25 +0200 | [diff] [blame] | 8 | * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 9 | * |
| 10 | * configfs Copyright (C) 2005 Oracle. All rights reserved. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/init.h> |
Bartosz Golaszewski | b86ff67 | 2020-09-24 14:45:21 +0200 | [diff] [blame] | 14 | #include <linux/kernel.h> |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 15 | #include <linux/module.h> |
| 16 | #include <linux/slab.h> |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 17 | #include <linux/configfs.h> |
| 18 | |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 19 | /* |
| 20 | * 01-childless |
| 21 | * |
| 22 | * This first example is a childless subsystem. It cannot create |
| 23 | * any config_items. It just has attributes. |
| 24 | * |
| 25 | * Note that we are enclosing the configfs_subsystem inside a container. |
| 26 | * This is not necessary if a subsystem has no attributes directly |
| 27 | * on the subsystem. See the next example, 02-simple-children, for |
| 28 | * such a subsystem. |
| 29 | */ |
| 30 | |
| 31 | struct childless { |
| 32 | struct configfs_subsystem subsys; |
| 33 | int showme; |
| 34 | int storeme; |
| 35 | }; |
| 36 | |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 37 | static inline struct childless *to_childless(struct config_item *item) |
| 38 | { |
Bartosz Golaszewski | e0ee1fd | 2020-09-24 14:45:18 +0200 | [diff] [blame] | 39 | return container_of(to_configfs_subsystem(to_config_group(item)), |
| 40 | struct childless, subsys); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 41 | } |
| 42 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 43 | static ssize_t childless_showme_show(struct config_item *item, char *page) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 44 | { |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 45 | struct childless *childless = to_childless(item); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 46 | ssize_t pos; |
| 47 | |
| 48 | pos = sprintf(page, "%d\n", childless->showme); |
| 49 | childless->showme++; |
| 50 | |
| 51 | return pos; |
| 52 | } |
| 53 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 54 | static ssize_t childless_storeme_show(struct config_item *item, char *page) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 55 | { |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 56 | return sprintf(page, "%d\n", to_childless(item)->storeme); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 57 | } |
| 58 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 59 | static ssize_t childless_storeme_store(struct config_item *item, |
| 60 | const char *page, size_t count) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 61 | { |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 62 | struct childless *childless = to_childless(item); |
Bartosz Golaszewski | b86ff67 | 2020-09-24 14:45:21 +0200 | [diff] [blame] | 63 | int ret; |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 64 | |
Bartosz Golaszewski | b86ff67 | 2020-09-24 14:45:21 +0200 | [diff] [blame] | 65 | ret = kstrtoint(page, 10, &childless->storeme); |
| 66 | if (ret) |
| 67 | return ret; |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 68 | |
| 69 | return count; |
| 70 | } |
| 71 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 72 | static ssize_t childless_description_show(struct config_item *item, char *page) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 73 | { |
| 74 | return sprintf(page, |
| 75 | "[01-childless]\n" |
| 76 | "\n" |
| 77 | "The childless subsystem is the simplest possible subsystem in\n" |
| 78 | "configfs. It does not support the creation of child config_items.\n" |
| 79 | "It only has a few attributes. In fact, it isn't much different\n" |
| 80 | "than a directory in /proc.\n"); |
| 81 | } |
| 82 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 83 | CONFIGFS_ATTR_RO(childless_, showme); |
| 84 | CONFIGFS_ATTR(childless_, storeme); |
| 85 | CONFIGFS_ATTR_RO(childless_, description); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 86 | |
| 87 | static struct configfs_attribute *childless_attrs[] = { |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 88 | &childless_attr_showme, |
| 89 | &childless_attr_storeme, |
| 90 | &childless_attr_description, |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 91 | NULL, |
| 92 | }; |
| 93 | |
Bhumika Goyal | 84c4367 | 2017-10-16 17:18:54 +0200 | [diff] [blame] | 94 | static const struct config_item_type childless_type = { |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 95 | .ct_attrs = childless_attrs, |
| 96 | .ct_owner = THIS_MODULE, |
| 97 | }; |
| 98 | |
| 99 | static struct childless childless_subsys = { |
| 100 | .subsys = { |
| 101 | .su_group = { |
| 102 | .cg_item = { |
| 103 | .ci_namebuf = "01-childless", |
| 104 | .ci_type = &childless_type, |
| 105 | }, |
| 106 | }, |
| 107 | }, |
| 108 | }; |
| 109 | |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 110 | /* ----------------------------------------------------------------- */ |
| 111 | |
| 112 | /* |
| 113 | * 02-simple-children |
| 114 | * |
| 115 | * This example merely has a simple one-attribute child. Note that |
| 116 | * there is no extra attribute structure, as the child's attribute is |
| 117 | * known from the get-go. Also, there is no container for the |
| 118 | * subsystem, as it has no attributes of its own. |
| 119 | */ |
| 120 | |
| 121 | struct simple_child { |
| 122 | struct config_item item; |
| 123 | int storeme; |
| 124 | }; |
| 125 | |
| 126 | static inline struct simple_child *to_simple_child(struct config_item *item) |
| 127 | { |
Bartosz Golaszewski | e0ee1fd | 2020-09-24 14:45:18 +0200 | [diff] [blame] | 128 | return container_of(item, struct simple_child, item); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 129 | } |
| 130 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 131 | static ssize_t simple_child_storeme_show(struct config_item *item, char *page) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 132 | { |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 133 | return sprintf(page, "%d\n", to_simple_child(item)->storeme); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 134 | } |
| 135 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 136 | static ssize_t simple_child_storeme_store(struct config_item *item, |
| 137 | const char *page, size_t count) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 138 | { |
| 139 | struct simple_child *simple_child = to_simple_child(item); |
Bartosz Golaszewski | b86ff67 | 2020-09-24 14:45:21 +0200 | [diff] [blame] | 140 | int ret; |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 141 | |
Bartosz Golaszewski | b86ff67 | 2020-09-24 14:45:21 +0200 | [diff] [blame] | 142 | ret = kstrtoint(page, 10, &simple_child->storeme); |
| 143 | if (ret) |
| 144 | return ret; |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 145 | |
| 146 | return count; |
| 147 | } |
| 148 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 149 | CONFIGFS_ATTR(simple_child_, storeme); |
| 150 | |
| 151 | static struct configfs_attribute *simple_child_attrs[] = { |
| 152 | &simple_child_attr_storeme, |
| 153 | NULL, |
| 154 | }; |
| 155 | |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 156 | static void simple_child_release(struct config_item *item) |
| 157 | { |
| 158 | kfree(to_simple_child(item)); |
| 159 | } |
| 160 | |
| 161 | static struct configfs_item_operations simple_child_item_ops = { |
Bartosz Golaszewski | 1b0d36e | 2020-09-24 14:45:20 +0200 | [diff] [blame] | 162 | .release = simple_child_release, |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 163 | }; |
| 164 | |
Bhumika Goyal | 84c4367 | 2017-10-16 17:18:54 +0200 | [diff] [blame] | 165 | static const struct config_item_type simple_child_type = { |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 166 | .ct_item_ops = &simple_child_item_ops, |
| 167 | .ct_attrs = simple_child_attrs, |
| 168 | .ct_owner = THIS_MODULE, |
| 169 | }; |
| 170 | |
Joel Becker | 22dd0e8 | 2006-04-12 18:34:43 -0700 | [diff] [blame] | 171 | struct simple_children { |
| 172 | struct config_group group; |
| 173 | }; |
| 174 | |
| 175 | static inline struct simple_children *to_simple_children(struct config_item *item) |
| 176 | { |
Bartosz Golaszewski | e0ee1fd | 2020-09-24 14:45:18 +0200 | [diff] [blame] | 177 | return container_of(to_config_group(item), |
| 178 | struct simple_children, group); |
Joel Becker | 22dd0e8 | 2006-04-12 18:34:43 -0700 | [diff] [blame] | 179 | } |
| 180 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 181 | static struct config_item *simple_children_make_item(struct config_group *group, |
| 182 | const char *name) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 183 | { |
| 184 | struct simple_child *simple_child; |
| 185 | |
Yoann Padioleau | dd00cc4 | 2007-07-19 01:49:03 -0700 | [diff] [blame] | 186 | simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 187 | if (!simple_child) |
Joel Becker | a6795e9 | 2008-07-17 15:21:29 -0700 | [diff] [blame] | 188 | return ERR_PTR(-ENOMEM); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 189 | |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 190 | config_item_init_type_name(&simple_child->item, name, |
| 191 | &simple_child_type); |
| 192 | |
Joel Becker | f89ab86 | 2008-07-17 14:53:48 -0700 | [diff] [blame] | 193 | return &simple_child->item; |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 194 | } |
| 195 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 196 | static ssize_t simple_children_description_show(struct config_item *item, |
| 197 | char *page) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 198 | { |
| 199 | return sprintf(page, |
| 200 | "[02-simple-children]\n" |
| 201 | "\n" |
| 202 | "This subsystem allows the creation of child config_items. These\n" |
| 203 | "items have only one attribute that is readable and writeable.\n"); |
| 204 | } |
| 205 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 206 | CONFIGFS_ATTR_RO(simple_children_, description); |
| 207 | |
| 208 | static struct configfs_attribute *simple_children_attrs[] = { |
| 209 | &simple_children_attr_description, |
| 210 | NULL, |
| 211 | }; |
| 212 | |
Joel Becker | 22dd0e8 | 2006-04-12 18:34:43 -0700 | [diff] [blame] | 213 | static void simple_children_release(struct config_item *item) |
| 214 | { |
| 215 | kfree(to_simple_children(item)); |
| 216 | } |
| 217 | |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 218 | static struct configfs_item_operations simple_children_item_ops = { |
Joel Becker | ecb3d28 | 2008-06-18 19:29:05 -0700 | [diff] [blame] | 219 | .release = simple_children_release, |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | /* |
| 223 | * Note that, since no extra work is required on ->drop_item(), |
| 224 | * no ->drop_item() is provided. |
| 225 | */ |
| 226 | static struct configfs_group_operations simple_children_group_ops = { |
| 227 | .make_item = simple_children_make_item, |
| 228 | }; |
| 229 | |
Bhumika Goyal | 84c4367 | 2017-10-16 17:18:54 +0200 | [diff] [blame] | 230 | static const struct config_item_type simple_children_type = { |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 231 | .ct_item_ops = &simple_children_item_ops, |
| 232 | .ct_group_ops = &simple_children_group_ops, |
| 233 | .ct_attrs = simple_children_attrs, |
Joel Becker | 3d0f89b | 2006-01-25 13:31:07 -0800 | [diff] [blame] | 234 | .ct_owner = THIS_MODULE, |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 235 | }; |
| 236 | |
| 237 | static struct configfs_subsystem simple_children_subsys = { |
| 238 | .su_group = { |
| 239 | .cg_item = { |
| 240 | .ci_namebuf = "02-simple-children", |
| 241 | .ci_type = &simple_children_type, |
| 242 | }, |
| 243 | }, |
| 244 | }; |
| 245 | |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 246 | /* ----------------------------------------------------------------- */ |
| 247 | |
| 248 | /* |
| 249 | * 03-group-children |
| 250 | * |
| 251 | * This example reuses the simple_children group from above. However, |
| 252 | * the simple_children group is not the subsystem itself, it is a |
| 253 | * child of the subsystem. Creation of a group in the subsystem creates |
| 254 | * a new simple_children group. That group can then have simple_child |
| 255 | * children of its own. |
| 256 | */ |
| 257 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 258 | static struct config_group *group_children_make_group( |
| 259 | struct config_group *group, const char *name) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 260 | { |
| 261 | struct simple_children *simple_children; |
| 262 | |
Yoann Padioleau | dd00cc4 | 2007-07-19 01:49:03 -0700 | [diff] [blame] | 263 | simple_children = kzalloc(sizeof(struct simple_children), |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 264 | GFP_KERNEL); |
| 265 | if (!simple_children) |
Joel Becker | a6795e9 | 2008-07-17 15:21:29 -0700 | [diff] [blame] | 266 | return ERR_PTR(-ENOMEM); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 267 | |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 268 | config_group_init_type_name(&simple_children->group, name, |
| 269 | &simple_children_type); |
| 270 | |
Joel Becker | f89ab86 | 2008-07-17 14:53:48 -0700 | [diff] [blame] | 271 | return &simple_children->group; |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 272 | } |
| 273 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 274 | static ssize_t group_children_description_show(struct config_item *item, |
| 275 | char *page) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 276 | { |
| 277 | return sprintf(page, |
| 278 | "[03-group-children]\n" |
| 279 | "\n" |
| 280 | "This subsystem allows the creation of child config_groups. These\n" |
| 281 | "groups are like the subsystem simple-children.\n"); |
| 282 | } |
| 283 | |
Christoph Hellwig | 5179822 | 2015-10-03 15:32:59 +0200 | [diff] [blame] | 284 | CONFIGFS_ATTR_RO(group_children_, description); |
| 285 | |
| 286 | static struct configfs_attribute *group_children_attrs[] = { |
| 287 | &group_children_attr_description, |
| 288 | NULL, |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 289 | }; |
| 290 | |
| 291 | /* |
| 292 | * Note that, since no extra work is required on ->drop_item(), |
| 293 | * no ->drop_item() is provided. |
| 294 | */ |
| 295 | static struct configfs_group_operations group_children_group_ops = { |
| 296 | .make_group = group_children_make_group, |
| 297 | }; |
| 298 | |
Bhumika Goyal | 84c4367 | 2017-10-16 17:18:54 +0200 | [diff] [blame] | 299 | static const struct config_item_type group_children_type = { |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 300 | .ct_group_ops = &group_children_group_ops, |
| 301 | .ct_attrs = group_children_attrs, |
Joel Becker | 3d0f89b | 2006-01-25 13:31:07 -0800 | [diff] [blame] | 302 | .ct_owner = THIS_MODULE, |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 303 | }; |
| 304 | |
| 305 | static struct configfs_subsystem group_children_subsys = { |
| 306 | .su_group = { |
| 307 | .cg_item = { |
| 308 | .ci_namebuf = "03-group-children", |
| 309 | .ci_type = &group_children_type, |
| 310 | }, |
| 311 | }, |
| 312 | }; |
| 313 | |
| 314 | /* ----------------------------------------------------------------- */ |
| 315 | |
| 316 | /* |
| 317 | * We're now done with our subsystem definitions. |
| 318 | * For convenience in this module, here's a list of them all. It |
| 319 | * allows the init function to easily register them. Most modules |
| 320 | * will only have one subsystem, and will only call register_subsystem |
| 321 | * on it directly. |
| 322 | */ |
| 323 | static struct configfs_subsystem *example_subsys[] = { |
| 324 | &childless_subsys.subsys, |
| 325 | &simple_children_subsys, |
| 326 | &group_children_subsys, |
| 327 | NULL, |
| 328 | }; |
| 329 | |
| 330 | static int __init configfs_example_init(void) |
| 331 | { |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 332 | struct configfs_subsystem *subsys; |
Bartosz Golaszewski | 4e415a8 | 2020-09-24 14:45:24 +0200 | [diff] [blame] | 333 | int ret, i; |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 334 | |
| 335 | for (i = 0; example_subsys[i]; i++) { |
| 336 | subsys = example_subsys[i]; |
| 337 | |
| 338 | config_group_init(&subsys->su_group); |
Joel Becker | e6bd07a | 2007-07-06 23:33:17 -0700 | [diff] [blame] | 339 | mutex_init(&subsys->su_mutex); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 340 | ret = configfs_register_subsystem(subsys); |
| 341 | if (ret) { |
Bartosz Golaszewski | 76ecfcb08 | 2020-09-24 14:45:26 +0200 | [diff] [blame] | 342 | pr_err("Error %d while registering subsystem %s\n", |
| 343 | ret, subsys->su_group.cg_item.ci_namebuf); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 344 | goto out_unregister; |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | return 0; |
| 349 | |
| 350 | out_unregister: |
Jiri Slaby | dcb3a08 | 2011-05-26 16:25:17 -0700 | [diff] [blame] | 351 | for (i--; i >= 0; i--) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 352 | configfs_unregister_subsystem(example_subsys[i]); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 353 | |
| 354 | return ret; |
| 355 | } |
| 356 | |
| 357 | static void __exit configfs_example_exit(void) |
| 358 | { |
| 359 | int i; |
| 360 | |
Jiri Slaby | dcb3a08 | 2011-05-26 16:25:17 -0700 | [diff] [blame] | 361 | for (i = 0; example_subsys[i]; i++) |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 362 | configfs_unregister_subsystem(example_subsys[i]); |
Joel Becker | 7063fbf | 2005-12-15 14:29:43 -0800 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | module_init(configfs_example_init); |
| 366 | module_exit(configfs_example_exit); |
| 367 | MODULE_LICENSE("GPL"); |