Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/pcmcia/pcs/pcs.c
+++ new/usr/src/uts/common/pcmcia/pcs/pcs.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26
27 27 #include <sys/types.h>
28 28 #include <sys/byteorder.h>
29 29 #include <sys/systm.h>
30 30 #include <sys/ddi.h>
31 31 #include <sys/sunddi.h>
32 32
33 33 int pcs_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
34 34 int pcs_attach(dev_info_t *, ddi_attach_cmd_t);
35 35 int pcs_detach(dev_info_t *, ddi_detach_cmd_t);
36 36 dev_info_t *pcs_dip;
37 37
38 38 static struct dev_ops pcs_devops = {
39 39 DEVO_REV,
40 40 0,
41 41 pcs_getinfo,
42 42 nulldev,
43 43 nulldev,
44 44 pcs_attach,
45 45 pcs_detach,
46 46 nulldev,
47 47 NULL,
48 48 NULL,
49 49 NULL,
50 50 ddi_quiesce_not_needed, /* quiesce */
51 51 };
52 52 /*
53 53 * This is the loadable module wrapper.
54 54 */
55 55 #include <sys/modctl.h>
↓ open down ↓ |
55 lines elided |
↑ open up ↑ |
56 56
57 57 extern struct mod_ops mod_driverops;
58 58
59 59 static struct modldrv modldrv = {
60 60 &mod_driverops, /* Type of module. This one is a driver */
61 61 "PCMCIA Socket Driver", /* Name of the module. */
62 62 &pcs_devops, /* driver ops */
63 63 };
64 64
65 65 static struct modlinkage modlinkage = {
66 - MODREV_1, (void *)&modldrv, NULL
66 + MODREV_1, { (void *)&modldrv, NULL }
67 67 };
68 68
69 69 struct pcs_inst {
70 70 dev_info_t *dip;
71 71 } *pcs_instances;
72 72
73 73 int
74 74 _init()
75 75 {
76 76 int ret;
77 77 if ((ret = ddi_soft_state_init((void **)&pcs_instances,
78 78 sizeof (struct pcs_inst), 1)) != 0)
79 79 return (ret);
80 80 if ((ret = mod_install(&modlinkage)) != 0) {
81 81 ddi_soft_state_fini((void **)&pcs_instances);
82 82 }
83 83 return (ret);
84 84 }
85 85
86 86 int
87 87 _fini()
88 88 {
89 89 int ret;
90 90 ret = mod_remove(&modlinkage);
91 91 if (ret == 0) {
92 92 ddi_soft_state_fini((void **)&pcs_instances);
93 93 }
94 94 return (ret);
95 95 }
96 96
97 97 int
98 98 _info(struct modinfo *modinfop)
99 99 {
100 100 return (mod_info(&modlinkage, modinfop));
101 101 }
102 102
103 103 int
104 104 pcs_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **result)
105 105 {
106 106 int error = DDI_SUCCESS;
107 107 int inum;
108 108 struct pcs_inst *inst;
109 109 #ifdef lint
110 110 dip = dip;
111 111 #endif
112 112
113 113 switch (cmd) {
114 114 case DDI_INFO_DEVT2DEVINFO:
115 115 inum = getminor((dev_t)arg);
116 116 inst = (struct pcs_inst *)ddi_get_soft_state(pcs_instances,
117 117 inum);
118 118 if (inst == NULL)
119 119 error = DDI_FAILURE;
120 120 else
121 121 *result = inst->dip;
122 122 break;
123 123 case DDI_INFO_DEVT2INSTANCE:
124 124 inum = getminor((dev_t)arg);
125 125 inst = (struct pcs_inst *)ddi_get_soft_state(pcs_instances,
126 126 inum);
127 127 if (inst == NULL)
128 128 error = DDI_FAILURE;
129 129 else
130 130 *result = (void *)(uintptr_t)inum;
131 131 break;
132 132 default:
133 133 error = DDI_FAILURE;
134 134 }
135 135 return (error);
136 136 }
137 137
138 138 int
139 139 pcs_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
140 140 {
141 141 int ret = DDI_SUCCESS;
142 142 int inum;
143 143 struct pcs_inst *inst;
144 144
145 145 switch (cmd) {
146 146 case DDI_RESUME:
147 147 return (DDI_SUCCESS);
148 148 case DDI_ATTACH:
149 149 break;
150 150 default:
151 151 return (DDI_FAILURE);
152 152 }
153 153
154 154 inum = ddi_get_instance(dip);
155 155
156 156 if (ddi_soft_state_zalloc(pcs_instances, inum) == DDI_SUCCESS) {
157 157 inst = (struct pcs_inst *)ddi_get_soft_state(pcs_instances,
158 158 inum);
159 159 if (inst == NULL)
160 160 ret = DDI_FAILURE;
161 161 else
162 162 inst->dip = dip;
163 163 }
164 164
165 165 return (ret);
166 166 }
167 167
168 168 int
169 169 pcs_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
170 170 {
171 171 switch (cmd) {
172 172 case DDI_DETACH:
173 173 ddi_soft_state_free(pcs_instances, ddi_get_instance(dip));
174 174 return (DDI_SUCCESS);
175 175
176 176 case DDI_SUSPEND:
177 177 case DDI_PM_SUSPEND:
178 178 return (DDI_SUCCESS);
179 179 default:
180 180 break;
181 181 }
182 182 return (DDI_FAILURE);
183 183 }
↓ open down ↓ |
107 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX