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/usbftdi/usbser_uftdi.c
+++ new/usr/src/uts/common/io/usb/clients/usbser/usbftdi/usbser_uftdi.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 /*
23 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 /*
28 28 * This driver supports FTDI FT232R USB-to-serial adapters. It is a
29 29 * device-specific driver (DSD) working with the USB generic serial
30 30 * driver (GSD) usbser.
31 31 *
32 32 * It implements the USB-to-serial device-specific driver interface (DSDI)
33 33 * which is exported by GSD. The DSDI is defined by ds_ops_t structure.
34 34 *
35 35 * Also may work with the older FTDI 8U232AM devices.
36 36 */
37 37
38 38 #include <sys/types.h>
39 39 #include <sys/param.h>
40 40 #include <sys/stream.h>
41 41 #include <sys/conf.h>
42 42 #include <sys/ddi.h>
43 43 #include <sys/sunddi.h>
44 44
45 45 #include <sys/usb/clients/usbser/usbser.h>
46 46 #include <sys/usb/clients/usbser/usbftdi/uftdi_var.h>
47 47
48 48 static void *usbser_uftdi_statep; /* soft state handle for usbser */
49 49
50 50 extern ds_ops_t uftdi_ds_ops; /* DSD operations */
51 51
52 52 static int
53 53 usbser_uftdi_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg,
54 54 void **result)
55 55 {
56 56 return (usbser_getinfo(dip, infocmd, arg, result, usbser_uftdi_statep));
57 57 }
58 58
59 59
60 60 static int
61 61 usbser_uftdi_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
62 62 {
63 63 return (usbser_attach(dip, cmd, usbser_uftdi_statep, &uftdi_ds_ops));
64 64 }
65 65
66 66
67 67 static int
68 68 usbser_uftdi_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
69 69 {
70 70 return (usbser_detach(dip, cmd, usbser_uftdi_statep));
71 71 }
72 72
73 73
74 74 static int
75 75 usbser_uftdi_open(queue_t *rq, dev_t *dev, int flag, int sflag, cred_t *cr)
76 76 {
77 77 return (usbser_open(rq, dev, flag, sflag, cr, usbser_uftdi_statep));
78 78 }
79 79
80 80 /*
81 81 * Several linked data structures to tie it together ..
82 82 */
83 83 struct module_info uftdi_modinfo = {
84 84 0, /* module id */
85 85 "uftdi", /* module name */
86 86 USBSER_MIN_PKTSZ, /* min pkt size */
87 87 USBSER_MAX_PKTSZ, /* max pkt size */
88 88 USBSER_HIWAT, /* hi watermark */
89 89 USBSER_LOWAT /* low watermark */
90 90 };
91 91
92 92 static struct qinit uftdi_rinit = {
93 93 putq,
94 94 usbser_rsrv,
95 95 usbser_uftdi_open,
96 96 usbser_close,
97 97 NULL,
98 98 &uftdi_modinfo,
99 99 };
100 100
101 101 static struct qinit uftdi_winit = {
102 102 usbser_wput,
103 103 usbser_wsrv,
104 104 NULL,
105 105 NULL,
106 106 NULL,
107 107 &uftdi_modinfo,
108 108 };
109 109
110 110 static struct streamtab uftdi_str_info = {
111 111 &uftdi_rinit,
112 112 &uftdi_winit,
113 113 };
114 114
115 115 static struct cb_ops uftdi_cb_ops = {
116 116 nodev, /* cb_open */
117 117 nodev, /* cb_close */
118 118 nodev, /* cb_strategy */
119 119 nodev, /* cb_print */
120 120 nodev, /* cb_dump */
121 121 nodev, /* cb_read */
122 122 nodev, /* cb_write */
123 123 nodev, /* cb_ioctl */
124 124 nodev, /* cb_devmap */
125 125 nodev, /* cb_mmap */
126 126 nodev, /* cb_segmap */
127 127 nochpoll, /* cb_chpoll */
128 128 ddi_prop_op, /* cb_prop_op */
129 129 &uftdi_str_info, /* cb_stream */
130 130 (int)(D_64BIT | D_NEW | D_MP | D_HOTPLUG) /* cb_flag */
131 131 };
132 132
133 133 static struct dev_ops uftdi_ops = {
134 134 DEVO_REV, /* devo_rev */
135 135 0, /* devo_refcnt */
136 136 usbser_uftdi_getinfo,
137 137 nulldev, /* devo_identify */
138 138 nulldev, /* devo_probe */
139 139 usbser_uftdi_attach,
140 140 usbser_uftdi_detach,
141 141 nodev, /* devo_reset */
142 142 &uftdi_cb_ops,
143 143 (struct bus_ops *)NULL, /* devo_bus_ops */
144 144 usbser_power, /* devo_power */
145 145 ddi_quiesce_not_needed
↓ open down ↓ |
145 lines elided |
↑ open up ↑ |
146 146 };
147 147
148 148 static struct modldrv modldrv = {
149 149 &mod_driverops,
150 150 "FTDI FT232R USB UART driver",
151 151 &uftdi_ops,
152 152 };
153 153
154 154 static struct modlinkage modlinkage = {
155 155 MODREV_1,
156 - &modldrv
156 + { &modldrv, NULL }
157 157 };
158 158
159 159 int
160 160 _init(void)
161 161 {
162 162 int error;
163 163
164 164 if ((error = mod_install(&modlinkage)) != 0)
165 165 return (error);
166 166 if ((error = ddi_soft_state_init(&usbser_uftdi_statep,
167 167 usbser_soft_state_size(), 1)) != 0)
168 168 (void) mod_remove(&modlinkage);
169 169 return (error);
170 170 }
171 171
172 172
173 173 int
174 174 _fini(void)
175 175 {
176 176 int error;
177 177
178 178 if ((error = mod_remove(&modlinkage)) == 0)
179 179 ddi_soft_state_fini(&usbser_uftdi_statep);
180 180 return (error);
181 181 }
182 182
183 183
184 184 int
185 185 _info(struct modinfo *modinfop)
186 186 {
187 187 return (mod_info(&modlinkage, modinfop));
188 188 }
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX