Deleted Added
full compact
uipaq.c (239180) uipaq.c (239299)
1/* $NetBSD: uipaq.c,v 1.4 2006/11/16 01:33:27 christos Exp $ */
2/* $OpenBSD: uipaq.c,v 1.1 2005/06/17 23:50:33 deraadt Exp $ */
3
4/*
5 * Copyright (c) 2000-2005 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation

--- 28 unchanged lines hidden (view full) ---

37 * 19 July 2003: Incorporated changes suggested by Sam Lawrance from
38 * the uppc module
39 *
40 *
41 * Contact isis@cs.umd.edu if you have any questions/comments about this driver
42 */
43
44#include <sys/cdefs.h>
1/* $NetBSD: uipaq.c,v 1.4 2006/11/16 01:33:27 christos Exp $ */
2/* $OpenBSD: uipaq.c,v 1.1 2005/06/17 23:50:33 deraadt Exp $ */
3
4/*
5 * Copyright (c) 2000-2005 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation

--- 28 unchanged lines hidden (view full) ---

37 * 19 July 2003: Incorporated changes suggested by Sam Lawrance from
38 * the uppc module
39 *
40 *
41 * Contact isis@cs.umd.edu if you have any questions/comments about this driver
42 */
43
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/sys/dev/usb/serial/uipaq.c 239180 2012-08-10 15:29:41Z hselasky $");
45__FBSDID("$FreeBSD: head/sys/dev/usb/serial/uipaq.c 239299 2012-08-15 15:42:57Z hselasky $");
46
47#include <sys/stdint.h>
48#include <sys/stddef.h>
49#include <sys/param.h>
50#include <sys/queue.h>
51#include <sys/types.h>
52#include <sys/systm.h>
53#include <sys/kernel.h>

--- 44 unchanged lines hidden (view full) ---

98
99 uint8_t sc_lsr; /* local status register */
100 uint8_t sc_msr; /* modem status register */
101};
102
103static device_probe_t uipaq_probe;
104static device_attach_t uipaq_attach;
105static device_detach_t uipaq_detach;
46
47#include <sys/stdint.h>
48#include <sys/stddef.h>
49#include <sys/param.h>
50#include <sys/queue.h>
51#include <sys/types.h>
52#include <sys/systm.h>
53#include <sys/kernel.h>

--- 44 unchanged lines hidden (view full) ---

98
99 uint8_t sc_lsr; /* local status register */
100 uint8_t sc_msr; /* modem status register */
101};
102
103static device_probe_t uipaq_probe;
104static device_attach_t uipaq_attach;
105static device_detach_t uipaq_detach;
106static device_free_softc_t uipaq_free_softc;
106static void uipaq_free_softc(struct uipaq_softc *);
107
108static usb_callback_t uipaq_write_callback;
109static usb_callback_t uipaq_read_callback;
110
111static void uipaq_free(struct ucom_softc *);
112static void uipaq_start_read(struct ucom_softc *);
113static void uipaq_stop_read(struct ucom_softc *);
114static void uipaq_start_write(struct ucom_softc *);

--- 953 unchanged lines hidden (view full) ---

1068 /* ViewSonic Pocket PC V30 */
1069 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x1923, 0)},
1070};
1071
1072static device_method_t uipaq_methods[] = {
1073 DEVMETHOD(device_probe, uipaq_probe),
1074 DEVMETHOD(device_attach, uipaq_attach),
1075 DEVMETHOD(device_detach, uipaq_detach),
107
108static usb_callback_t uipaq_write_callback;
109static usb_callback_t uipaq_read_callback;
110
111static void uipaq_free(struct ucom_softc *);
112static void uipaq_start_read(struct ucom_softc *);
113static void uipaq_stop_read(struct ucom_softc *);
114static void uipaq_start_write(struct ucom_softc *);

--- 953 unchanged lines hidden (view full) ---

1068 /* ViewSonic Pocket PC V30 */
1069 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x1923, 0)},
1070};
1071
1072static device_method_t uipaq_methods[] = {
1073 DEVMETHOD(device_probe, uipaq_probe),
1074 DEVMETHOD(device_attach, uipaq_attach),
1075 DEVMETHOD(device_detach, uipaq_detach),
1076 DEVMETHOD(device_free_softc, uipaq_free_softc),
1077 DEVMETHOD_END
1078};
1079
1080static devclass_t uipaq_devclass;
1081
1082static driver_t uipaq_driver = {
1083 .name = "uipaq",
1084 .methods = uipaq_methods,

--- 92 unchanged lines hidden (view full) ---

1177int
1178uipaq_detach(device_t dev)
1179{
1180 struct uipaq_softc *sc = device_get_softc(dev);
1181
1182 ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
1183 usbd_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER);
1184
1076 DEVMETHOD_END
1077};
1078
1079static devclass_t uipaq_devclass;
1080
1081static driver_t uipaq_driver = {
1082 .name = "uipaq",
1083 .methods = uipaq_methods,

--- 92 unchanged lines hidden (view full) ---

1176int
1177uipaq_detach(device_t dev)
1178{
1179 struct uipaq_softc *sc = device_get_softc(dev);
1180
1181 ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
1182 usbd_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER);
1183
1184 device_claim_softc(dev);
1185
1186 uipaq_free_softc(sc);
1187
1185 return (0);
1186}
1187
1188UCOM_UNLOAD_DRAIN(uipaq);
1189
1190static void
1188 return (0);
1189}
1190
1191UCOM_UNLOAD_DRAIN(uipaq);
1192
1193static void
1191uipaq_free_softc(device_t dev, void *arg)
1194uipaq_free_softc(struct uipaq_softc *sc)
1192{
1195{
1193 struct uipaq_softc *sc = arg;
1194
1195 if (ucom_unref(&sc->sc_super_ucom)) {
1196 if (ucom_unref(&sc->sc_super_ucom)) {
1196 if (mtx_initialized(&sc->sc_mtx))
1197 mtx_destroy(&sc->sc_mtx);
1198 device_free_softc(dev, sc);
1197 mtx_destroy(&sc->sc_mtx);
1198 device_free_softc(sc);
1199 }
1200}
1201
1202static void
1203uipaq_free(struct ucom_softc *ucom)
1204{
1199 }
1200}
1201
1202static void
1203uipaq_free(struct ucom_softc *ucom)
1204{
1205 uipaq_free_softc(NULL, ucom->sc_parent);
1205 uipaq_free_softc(ucom->sc_parent);
1206}
1207
1208static void
1209uipaq_start_read(struct ucom_softc *ucom)
1210{
1211 struct uipaq_softc *sc = ucom->sc_parent;
1212
1213 /* start read endpoint */

--- 161 unchanged lines hidden ---
1206}
1207
1208static void
1209uipaq_start_read(struct ucom_softc *ucom)
1210{
1211 struct uipaq_softc *sc = ucom->sc_parent;
1212
1213 /* start read endpoint */

--- 161 unchanged lines hidden ---