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