xref: /illumos-gate/usr/src/uts/common/io/sdcard/impl/sda_mod.c (revision 07a48826732249fcd3aa8dd53c8389595e9f1fbc)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * SD card module support.
28  */
29 
30 #include <sys/modctl.h>
31 #include <sys/sdcard/sda_impl.h>
32 
33 /*
34  * Static Variables.
35  */
36 
37 static struct modlmisc modlmisc = {
38 	&mod_miscops,
39 	"SD Card Architecture",
40 };
41 
42 static struct modlinkage modlinkage = {
43 	MODREV_1, { &modlmisc, NULL }
44 };
45 
46 /*
47  * DDI entry points.
48  */
49 
50 int
51 _init(void)
52 {
53 	int	rv;
54 
55 	sda_cmd_init();
56 	sda_nexus_init();
57 
58 	if ((rv = mod_install(&modlinkage)) != 0) {
59 		sda_cmd_fini();
60 		sda_nexus_fini();
61 	}
62 
63 	return (rv);
64 }
65 
66 int
67 _fini(void)
68 {
69 	int	rv;
70 
71 	if ((rv = mod_remove(&modlinkage)) == 0) {
72 		sda_cmd_fini();
73 		sda_nexus_fini();
74 	}
75 	return (rv);
76 }
77 
78 int
79 _info(struct modinfo *modinfop)
80 {
81 	return (mod_info(&modlinkage, modinfop));
82 }
83