Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/io/usb/clients/usbser/usbsprl/usbser_pl2303.c
+++ new/usr/src/uts/common/io/usb/clients/usbser/usbsprl/usbser_pl2303.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 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26
27 27 /*
28 28 * This driver supports Prolific PL-2303H/HX/X USB-to-serial adapters. It is a
29 29 * device-specific driver (DSD) working with USB generic serial driver (GSD). It
30 30 * implements the USB-to-serial device-specific driver interface (DSDI) which is
31 31 * offered by GSD. The interface is defined by ds_ops_t structure.
32 32 *
33 33 *
34 34 * PL-2303HX and PL-2303X devices have different hardware, but from the
35 35 * perspective of device driver, they have the same software interface.
36 36 */
37 37
38 38 /*
39 39 *
40 40 * USB Prolific PL2303 driver glue code
41 41 *
42 42 */
43 43 #include <sys/types.h>
44 44 #include <sys/param.h>
45 45 #include <sys/stream.h>
46 46 #include <sys/conf.h>
47 47 #include <sys/ddi.h>
48 48 #include <sys/sunddi.h>
49 49
50 50 #include <sys/usb/clients/usbser/usbser.h>
51 51 #include <sys/usb/clients/usbser/usbsprl/pl2303_var.h>
52 52
53 53
54 54 /* configuration entry points */
55 55 static int usbser_pl2303_attach(dev_info_t *, ddi_attach_cmd_t);
56 56 static int usbser_pl2303_detach(dev_info_t *, ddi_detach_cmd_t);
57 57 static int usbser_pl2303_getinfo(dev_info_t *, ddi_info_cmd_t, void *,
58 58 void **);
59 59 static int usbser_pl2303_open(queue_t *, dev_t *, int, int, cred_t *);
60 60 static void *usbser_pl2303_statep; /* soft state */
61 61
62 62 extern ds_ops_t pl2303_ds_ops; /* DSD operations */
63 63
64 64
65 65 /*
66 66 * STREAMS structures
67 67 */
68 68 struct module_info usbser_pl2303_modinfo = {
69 69 0, /* module id */
70 70 "usbsprl", /* module name */
71 71 USBSER_MIN_PKTSZ, /* min pkt size */
72 72 USBSER_MAX_PKTSZ, /* max pkt size */
73 73 USBSER_HIWAT, /* hi watermark */
74 74 USBSER_LOWAT /* low watermark */
75 75 };
76 76
77 77
78 78 static struct qinit usbser_pl2303_rinit = {
79 79 putq,
80 80 usbser_rsrv,
81 81 usbser_pl2303_open,
82 82 usbser_close,
83 83 NULL,
84 84 &usbser_pl2303_modinfo,
85 85 NULL
86 86 };
87 87
88 88
89 89 static struct qinit usbser_pl2303_winit = {
90 90 usbser_wput,
91 91 usbser_wsrv,
92 92 NULL,
93 93 NULL,
94 94 NULL,
95 95 &usbser_pl2303_modinfo,
96 96 NULL
97 97 };
98 98
99 99
100 100 struct streamtab usbser_pl2303_str_info = {
101 101 &usbser_pl2303_rinit, &usbser_pl2303_winit, NULL, NULL
102 102 };
103 103
104 104
105 105 static struct cb_ops usbser_pl2303_cb_ops = {
106 106 nodev, /* cb_open */
107 107 nodev, /* cb_close */
108 108 nodev, /* cb_strategy */
109 109 nodev, /* cb_print */
110 110 nodev, /* cb_dump */
111 111 nodev, /* cb_read */
112 112 nodev, /* cb_write */
113 113 nodev, /* cb_ioctl */
114 114 nodev, /* cb_devmap */
115 115 nodev, /* cb_mmap */
116 116 nodev, /* cb_segmap */
117 117 nochpoll, /* cb_chpoll */
118 118 ddi_prop_op, /* cb_prop_op */
119 119 &usbser_pl2303_str_info, /* cb_stream */
120 120 (int)(D_64BIT | D_NEW | D_MP | D_HOTPLUG) /* cb_flag */
121 121 };
122 122
123 123
124 124 /*
125 125 * auto configuration ops
126 126 */
127 127 struct dev_ops usbser_pl2303_ops = {
128 128 DEVO_REV, /* devo_rev */
129 129 0, /* devo_refcnt */
130 130 usbser_pl2303_getinfo, /* devo_getinfo */
131 131 nulldev, /* devo_identify */
132 132 nulldev, /* devo_probe */
133 133 usbser_pl2303_attach, /* devo_attach */
134 134 usbser_pl2303_detach, /* devo_detach */
135 135 nodev, /* devo_reset */
136 136 &usbser_pl2303_cb_ops, /* devo_cb_ops */
137 137 (struct bus_ops *)NULL, /* devo_bus_ops */
138 138 usbser_power, /* devo_power */
139 139 ddi_quiesce_not_needed, /* devo_quiesce */
140 140 };
141 141
142 142
143 143 extern struct mod_ops mod_driverops;
↓ open down ↓ |
143 lines elided |
↑ open up ↑ |
144 144
145 145
146 146 static struct modldrv modldrv = {
147 147 &mod_driverops, /* type of module - driver */
148 148 "USB Prolific PL2303 driver",
149 149 &usbser_pl2303_ops,
150 150 };
151 151
152 152
153 153 static struct modlinkage modlinkage = {
154 - MODREV_1, &modldrv, 0
154 + MODREV_1, { &modldrv, NULL }
155 155 };
156 156
157 157
158 158 /*
159 159 * entry points
160 160 * ------------
161 161 *
162 162 */
163 163 int
164 164 _init(void)
165 165 {
166 166 int error;
167 167
168 168 if ((error = mod_install(&modlinkage)) == 0) {
169 169 error = ddi_soft_state_init(&usbser_pl2303_statep,
170 170 usbser_soft_state_size(), 1);
171 171 }
172 172
173 173 return (error);
174 174 }
175 175
176 176
177 177 int
178 178 _fini(void)
179 179 {
180 180 int error;
181 181
182 182 if ((error = mod_remove(&modlinkage)) == 0) {
183 183 ddi_soft_state_fini(&usbser_pl2303_statep);
184 184 }
185 185
186 186 return (error);
187 187 }
188 188
189 189
190 190 int
191 191 _info(struct modinfo *modinfop)
192 192 {
193 193 return (mod_info(&modlinkage, modinfop));
194 194 }
195 195
196 196
197 197 int
198 198 usbser_pl2303_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg,
199 199 void **result)
200 200 {
201 201 return (usbser_getinfo(dip, infocmd, arg, result,
202 202 usbser_pl2303_statep));
203 203 }
204 204
205 205
206 206 static int
207 207 usbser_pl2303_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
208 208 {
209 209 return (usbser_attach(dip, cmd, usbser_pl2303_statep, &pl2303_ds_ops));
210 210 }
211 211
212 212
213 213 static int
214 214 usbser_pl2303_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
215 215 {
216 216 return (usbser_detach(dip, cmd, usbser_pl2303_statep));
217 217 }
218 218
219 219
220 220 static int
221 221 usbser_pl2303_open(queue_t *rq, dev_t *dev, int flag, int sflag, cred_t *cr)
222 222 {
223 223 return (usbser_open(rq, dev, flag, sflag, cr, usbser_pl2303_statep));
224 224 }
↓ open down ↓ |
60 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX