Linux Audio

Check our new training course

Loading...
v6.9.4
 1// SPDX-License-Identifier: GPL-2.0
 2
 3#include <linux/types.h>
 4#include <linux/kconfig.h>
 5#include <linux/list.h>
 6#include <linux/slab.h>
 7#include <linux/export.h>
 8#include <linux/security.h>
 9#include <linux/highmem.h>
10#include <linux/umh.h>
11#include <linux/sysctl.h>
12
13#include "fallback.h"
14#include "firmware.h"
15
16/*
17 * firmware fallback configuration table
18 */
19
 
 
 
 
 
 
20struct firmware_fallback_config fw_fallback_config = {
21	.force_sysfs_fallback = IS_ENABLED(CONFIG_FW_LOADER_USER_HELPER_FALLBACK),
22	.loading_timeout = 60,
23	.old_timeout = 60,
24};
25EXPORT_SYMBOL_NS_GPL(fw_fallback_config, FIRMWARE_LOADER_PRIVATE);
26
27#ifdef CONFIG_SYSCTL
28static struct ctl_table firmware_config_table[] = {
29	{
30		.procname	= "force_sysfs_fallback",
31		.data		= &fw_fallback_config.force_sysfs_fallback,
32		.maxlen         = sizeof(unsigned int),
33		.mode           = 0644,
34		.proc_handler   = proc_douintvec_minmax,
35		.extra1		= SYSCTL_ZERO,
36		.extra2		= SYSCTL_ONE,
37	},
38	{
39		.procname	= "ignore_sysfs_fallback",
40		.data		= &fw_fallback_config.ignore_sysfs_fallback,
41		.maxlen         = sizeof(unsigned int),
42		.mode           = 0644,
43		.proc_handler   = proc_douintvec_minmax,
44		.extra1		= SYSCTL_ZERO,
45		.extra2		= SYSCTL_ONE,
46	},
 
47};
 
48
49static struct ctl_table_header *firmware_config_sysct_table_header;
50int register_firmware_config_sysctl(void)
51{
52	firmware_config_sysct_table_header =
53		register_sysctl("kernel/firmware_config",
54				firmware_config_table);
55	if (!firmware_config_sysct_table_header)
56		return -ENOMEM;
57	return 0;
58}
59EXPORT_SYMBOL_NS_GPL(register_firmware_config_sysctl, FIRMWARE_LOADER_PRIVATE);
60
61void unregister_firmware_config_sysctl(void)
62{
63	unregister_sysctl_table(firmware_config_sysct_table_header);
64	firmware_config_sysct_table_header = NULL;
65}
66EXPORT_SYMBOL_NS_GPL(unregister_firmware_config_sysctl, FIRMWARE_LOADER_PRIVATE);
67
68#endif /* CONFIG_SYSCTL */
v4.17
 1// SPDX-License-Identifier: GPL-2.0
 2
 3#include <linux/types.h>
 4#include <linux/kconfig.h>
 5#include <linux/list.h>
 6#include <linux/slab.h>
 
 7#include <linux/security.h>
 8#include <linux/highmem.h>
 9#include <linux/umh.h>
10#include <linux/sysctl.h>
11
12#include "fallback.h"
13#include "firmware.h"
14
15/*
16 * firmware fallback configuration table
17 */
18
19/* Module or buit-in */
20#ifdef CONFIG_FW_LOADER_USER_HELPER
21
22static unsigned int zero;
23static unsigned int one = 1;
24
25struct firmware_fallback_config fw_fallback_config = {
26	.force_sysfs_fallback = IS_ENABLED(CONFIG_FW_LOADER_USER_HELPER_FALLBACK),
27	.loading_timeout = 60,
28	.old_timeout = 60,
29};
30EXPORT_SYMBOL_GPL(fw_fallback_config);
31
32struct ctl_table firmware_config_table[] = {
 
33	{
34		.procname	= "force_sysfs_fallback",
35		.data		= &fw_fallback_config.force_sysfs_fallback,
36		.maxlen         = sizeof(unsigned int),
37		.mode           = 0644,
38		.proc_handler   = proc_douintvec_minmax,
39		.extra1		= &zero,
40		.extra2		= &one,
41	},
42	{
43		.procname	= "ignore_sysfs_fallback",
44		.data		= &fw_fallback_config.ignore_sysfs_fallback,
45		.maxlen         = sizeof(unsigned int),
46		.mode           = 0644,
47		.proc_handler   = proc_douintvec_minmax,
48		.extra1		= &zero,
49		.extra2		= &one,
50	},
51	{ }
52};
53EXPORT_SYMBOL_GPL(firmware_config_table);
54
55#endif