Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  * Created by: Jason Wessel <jason.wessel@windriver.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (c) 2010 Wind River Systems, Inc.  All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * This file is licensed under the terms of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * License version 2. This program is licensed "as is" without any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * warranty of any kind, whether express or implied.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/kdb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * All kdb shell command call backs receive argc and argv, where
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * argv[0] is the command the end user typed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static int kdb_hello_cmd(int argc, const char **argv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	if (argc > 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 		return KDB_ARGCOUNT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	if (argc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 		kdb_printf("Hello %s.\n", argv[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		kdb_printf("Hello world!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static int __init kdb_hello_cmd_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	 * Registration of a dynamically added kdb command is done with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	 * kdb_register() with the arguments being:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	 *   1: The name of the shell command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	 *   2: The function that processes the command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	 *   3: Description of the usage of any arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	 *   4: Descriptive text when you run help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	 *   5: Number of characters to complete the command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	 *      0 == type the whole command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	 *      1 == match both "g" and "go" for example
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	kdb_register("hello", kdb_hello_cmd, "[string]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		     "Say Hello World or Hello [string]", 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static void __exit kdb_hello_cmd_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	kdb_unregister("hello");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) module_init(kdb_hello_cmd_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) module_exit(kdb_hello_cmd_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) MODULE_AUTHOR("WindRiver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) MODULE_DESCRIPTION("KDB example to add a hello command");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) MODULE_LICENSE("GPL");