xref: /netbsd-src/sys/external/bsd/drm2/ttm/ttm_module.c (revision 76f861686fe150c7f1e0cbb17e341d3171a21edd)
1*76f86168Sriastradh /*	$NetBSD: ttm_module.c,v 1.1 2022/07/17 15:36:05 riastradh Exp $	*/
2*76f86168Sriastradh 
3*76f86168Sriastradh /*-
4*76f86168Sriastradh  * Copyright (c) 2022 The NetBSD Foundation, Inc.
5*76f86168Sriastradh  * All rights reserved.
6*76f86168Sriastradh  *
7*76f86168Sriastradh  * Redistribution and use in source and binary forms, with or without
8*76f86168Sriastradh  * modification, are permitted provided that the following conditions
9*76f86168Sriastradh  * are met:
10*76f86168Sriastradh  * 1. Redistributions of source code must retain the above copyright
11*76f86168Sriastradh  *    notice, this list of conditions and the following disclaimer.
12*76f86168Sriastradh  * 2. Redistributions in binary form must reproduce the above copyright
13*76f86168Sriastradh  *    notice, this list of conditions and the following disclaimer in the
14*76f86168Sriastradh  *    documentation and/or other materials provided with the distribution.
15*76f86168Sriastradh  *
16*76f86168Sriastradh  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*76f86168Sriastradh  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*76f86168Sriastradh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*76f86168Sriastradh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*76f86168Sriastradh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*76f86168Sriastradh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*76f86168Sriastradh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*76f86168Sriastradh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*76f86168Sriastradh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*76f86168Sriastradh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*76f86168Sriastradh  * POSSIBILITY OF SUCH DAMAGE.
27*76f86168Sriastradh  */
28*76f86168Sriastradh 
29*76f86168Sriastradh #include <sys/cdefs.h>
30*76f86168Sriastradh __KERNEL_RCSID(0, "$NetBSD: ttm_module.c,v 1.1 2022/07/17 15:36:05 riastradh Exp $");
31*76f86168Sriastradh 
32*76f86168Sriastradh #include <sys/errno.h>
33*76f86168Sriastradh #include <sys/module.h>
34*76f86168Sriastradh 
35*76f86168Sriastradh MODULE(MODULE_CLASS_DRIVER, drmkms_ttm, "drmkms");
36*76f86168Sriastradh 
37*76f86168Sriastradh static int
drmkms_ttm_modcmd(modcmd_t cmd,void * arg)38*76f86168Sriastradh drmkms_ttm_modcmd(modcmd_t cmd, void *arg)
39*76f86168Sriastradh {
40*76f86168Sriastradh 
41*76f86168Sriastradh 	switch (cmd) {
42*76f86168Sriastradh 	case MODULE_CMD_INIT:
43*76f86168Sriastradh 		return 0;
44*76f86168Sriastradh 	case MODULE_CMD_AUTOUNLOAD:
45*76f86168Sriastradh 		return EBUSY;
46*76f86168Sriastradh 	case MODULE_CMD_FINI:
47*76f86168Sriastradh 		return 0;
48*76f86168Sriastradh 	default:
49*76f86168Sriastradh 		return ENOTTY;
50*76f86168Sriastradh 	}
51*76f86168Sriastradh }
52