1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
2f08c3bdfSopenharmony_ci/*
3f08c3bdfSopenharmony_ci * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
4f08c3bdfSopenharmony_ci *
5f08c3bdfSopenharmony_ci * Dummy test module.
6f08c3bdfSopenharmony_ci *
7f08c3bdfSopenharmony_ci * The module accepts a single argument named "status" and it fails
8f08c3bdfSopenharmony_ci * initialization if the status is set to "invalid".
9f08c3bdfSopenharmony_ci */
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_ci#include <linux/module.h>
12f08c3bdfSopenharmony_ci#include <linux/init.h>
13f08c3bdfSopenharmony_ci#include <linux/proc_fs.h>
14f08c3bdfSopenharmony_ci#include <linux/kernel.h>
15f08c3bdfSopenharmony_ci
16f08c3bdfSopenharmony_cistatic char status[20];
17f08c3bdfSopenharmony_cimodule_param_string(status, status, 20, 0444);
18f08c3bdfSopenharmony_ci
19f08c3bdfSopenharmony_cistatic int dummy_init(void)
20f08c3bdfSopenharmony_ci{
21f08c3bdfSopenharmony_ci	struct proc_dir_entry *proc_dummy;
22f08c3bdfSopenharmony_ci
23f08c3bdfSopenharmony_ci	if (!strcmp(status, "invalid"))
24f08c3bdfSopenharmony_ci		return -EINVAL;
25f08c3bdfSopenharmony_ci
26f08c3bdfSopenharmony_ci	proc_dummy = proc_mkdir("dummy", 0);
27f08c3bdfSopenharmony_ci	return 0;
28f08c3bdfSopenharmony_ci}
29f08c3bdfSopenharmony_cimodule_init(dummy_init);
30f08c3bdfSopenharmony_ci
31f08c3bdfSopenharmony_cistatic void dummy_exit(void)
32f08c3bdfSopenharmony_ci{
33f08c3bdfSopenharmony_ci	remove_proc_entry("dummy", 0);
34f08c3bdfSopenharmony_ci}
35f08c3bdfSopenharmony_cimodule_exit(dummy_exit);
36f08c3bdfSopenharmony_ci
37f08c3bdfSopenharmony_ciMODULE_LICENSE("GPL");
38