00cac4a5e2299f4f4e26b47968658dcb5bc0ad1f
[cascardo/linux.git] / net / bluetooth / selftest.c
1 /*
2    BlueZ - Bluetooth protocol stack for Linux
3
4    Copyright (C) 2014 Intel Corporation
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License version 2 as
8    published by the Free Software Foundation;
9
10    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
13    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
14    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
15    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
19    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
20    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
21    SOFTWARE IS DISCLAIMED.
22 */
23
24 #include <net/bluetooth/bluetooth.h>
25
26 #include "selftest.h"
27
28 static int __init run_selftest(void)
29 {
30         BT_INFO("Starting self testing");
31
32         BT_INFO("Finished self testing");
33
34         return 0;
35 }
36
37 #if IS_MODULE(CONFIG_BT)
38
39 /* This is run when CONFIG_BT_SELFTEST=y and CONFIG_BT=m and is just a
40  * wrapper to allow running this at module init.
41  *
42  * If CONFIG_BT_SELFTEST=n, then this code is not compiled at all.
43  */
44 int __init bt_selftest(void)
45 {
46         return run_selftest();
47 }
48
49 #else
50
51 /* This is run when CONFIG_BT_SELFTEST=y and CONFIG_BT=y and is run
52  * via late_initcall() as last item in the initialization sequence.
53  *
54  * If CONFIG_BT_SELFTEST=n, then this code is not compiled at all.
55  */
56 static int __init bt_selftest_init(void)
57 {
58         return run_selftest();
59 }
60 late_initcall(bt_selftest_init);
61
62 #endif