| 1 | |
| 2 | |
| 3 | * ConfigFS support
|
| 4 | *
|
| 5 | * Copyright (C) 2026, Intel Corporation
|
| 6 | * Author: Mika Westerberg <[email protected]>
|
| 7 |
|
| 8 |
|
| 9 | #include <linux/configfs.h>
|
| 10 | #include <linux/export.h>
|
| 11 |
|
| 12 | #include "tb.h"
|
| 13 |
|
| 14 | static const struct config_item_type tb_root_group_type = {
|
| 15 | .ct_owner = THIS_MODULE,
|
| 16 | };
|
| 17 |
|
| 18 | static struct configfs_subsystem tb_configfs = {
|
| 19 | .su_group = {
|
| 20 | .cg_item = {
|
| 21 | .ci_namebuf = "thunderbolt",
|
| 22 | .ci_type = &tb_root_group_type,
|
| 23 | },
|
| 24 | },
|
| 25 | };
|
| 26 |
|
| 27 | |
| 28 | * tb_configfs_register_group() - Register Thunderbolt ConfigFS group
|
| 29 | * @group: Group to register.
|
| 30 | *
|
| 31 | * Registers the new @group under Thunderbolt subsystem ConfigFS.
|
| 32 | *
|
| 33 | * Return: 0% in case of success, negative errno otherwise.
|
| 34 |
|
| 35 | int tb_configfs_register_group(struct config_group *group)
|
| 36 | {
|
| 37 | return configfs_register_group(&tb_configfs.su_group, group);
|
| 38 | }
|
| 39 | EXPORT_SYMBOL_GPL(tb_configfs_register_group);
|
| 40 |
|
| 41 | |
| 42 | * tb_configfs_unregister_group() - Unregister previously registered group
|
| 43 | * @group: Group to unregister.
|
| 44 |
|
| 45 | void tb_configfs_unregister_group(struct config_group *group)
|
| 46 | {
|
| 47 | configfs_unregister_group(group);
|
| 48 | }
|
| 49 | EXPORT_SYMBOL_GPL(tb_configfs_unregister_group);
|
| 50 |
|
| 51 | int tb_configfs_init(void)
|
| 52 | {
|
| 53 | config_group_init(&tb_configfs.su_group);
|
| 54 | mutex_init(&tb_configfs.su_mutex);
|
| 55 | return configfs_register_subsystem(&tb_configfs);
|
| 56 | }
|
| 57 |
|
| 58 | void tb_configfs_exit(void)
|
| 59 | {
|
| 60 | configfs_unregister_subsystem(&tb_configfs);
|
| 61 | }
|