9348 mii: duplicate 'const' declaration specifier
[unleashed.git] / usr / src / uts / common / io / options.c
blobab4436c33a9182ac7160f2e66228d039e6fbf487
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 #include <sys/types.h>
29 #include <sys/errno.h>
30 #include <sys/conf.h>
31 #include <sys/ddi.h>
32 #include <sys/sunddi.h>
35 * Configuration information
38 static int options_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg,
39 void **result);
40 static int options_attach(dev_info_t *devi, ddi_attach_cmd_t cmd);
41 static int options_detach(dev_info_t *devi, ddi_detach_cmd_t cmd);
42 static dev_info_t *options_devi;
44 struct dev_ops options_ops = {
46 DEVO_REV, /* devo_rev, */
47 0, /* refcnt */
48 options_info, /* info */
49 nulldev, /* identify */
50 nulldev, /* probe */
51 options_attach, /* attach */
52 options_detach, /* detach */
53 nodev, /* reset */
54 (struct cb_ops *)0, /* driver operations */
55 (struct bus_ops *)0, /* bus operations */
56 nulldev, /* power */
57 ddi_quiesce_not_needed, /* quiesce */
62 * Autoload Data and Autoload Entry
65 #include <sys/modctl.h>
67 extern struct mod_ops mod_driverops;
68 static struct modldrv modldrv = {
69 &mod_driverops, /* Type of module. This one is a driver */
70 "options driver", /* Name of the module. */
71 &options_ops, /* driver ops */
74 static struct modlinkage modlinkage = {
75 MODREV_1, (void *)&modldrv
79 * This is the driver initialization routine.
82 int
83 _init()
85 return (mod_install(&modlinkage));
88 int
89 _fini()
91 return (EBUSY);
94 int
95 _info(modinfop)
96 struct modinfo *modinfop;
98 return (mod_info(&modlinkage, modinfop));
101 /* ARGSUSED */
102 static int
103 options_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
105 register int error;
107 switch (infocmd) {
108 case DDI_INFO_DEVT2DEVINFO:
109 if (options_devi == NULL) {
110 error = DDI_FAILURE;
111 } else {
112 *result = (void *) options_devi;
113 error = DDI_SUCCESS;
115 break;
116 case DDI_INFO_DEVT2INSTANCE:
117 *result = (void *)0;
118 error = DDI_SUCCESS;
119 break;
120 default:
121 error = DDI_FAILURE;
123 return (error);
126 static int
127 options_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
129 switch (cmd) {
130 case DDI_ATTACH:
131 options_devi = devi;
132 return (DDI_SUCCESS);
134 case DDI_RESUME:
135 return (DDI_SUCCESS);
137 default:
138 return (DDI_FAILURE);
142 /*ARGSUSED*/
143 static int
144 options_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
146 switch (cmd) {
147 case DDI_SUSPEND:
148 return (DDI_SUCCESS);
150 case DDI_DETACH:
151 default:
152 return (DDI_FAILURE);