Deleted Added
full compact
uplcom.c (239180) uplcom.c (239299)
1/* $NetBSD: uplcom.c,v 1.21 2001/11/13 06:24:56 lukem Exp $ */
2
3#include <sys/cdefs.h>
1/* $NetBSD: uplcom.c,v 1.21 2001/11/13 06:24:56 lukem Exp $ */
2
3#include <sys/cdefs.h>
4__FBSDID("$FreeBSD: head/sys/dev/usb/serial/uplcom.c 239180 2012-08-10 15:29:41Z hselasky $");
4__FBSDID("$FreeBSD: head/sys/dev/usb/serial/uplcom.c 239299 2012-08-15 15:42:57Z hselasky $");
5
6/*-
7 * Copyright (c) 2001-2003, 2005 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:

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

188static void uplcom_stop_write(struct ucom_softc *);
189static void uplcom_cfg_get_status(struct ucom_softc *, uint8_t *,
190 uint8_t *);
191static void uplcom_poll(struct ucom_softc *ucom);
192
193static device_probe_t uplcom_probe;
194static device_attach_t uplcom_attach;
195static device_detach_t uplcom_detach;
5
6/*-
7 * Copyright (c) 2001-2003, 2005 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:

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

188static void uplcom_stop_write(struct ucom_softc *);
189static void uplcom_cfg_get_status(struct ucom_softc *, uint8_t *,
190 uint8_t *);
191static void uplcom_poll(struct ucom_softc *ucom);
192
193static device_probe_t uplcom_probe;
194static device_attach_t uplcom_attach;
195static device_detach_t uplcom_detach;
196static device_free_softc_t uplcom_free_softc;
196static void uplcom_free_softc(struct uplcom_softc *);
197
198static usb_callback_t uplcom_intr_callback;
199static usb_callback_t uplcom_write_callback;
200static usb_callback_t uplcom_read_callback;
201
202static const struct usb_config uplcom_config_data[UPLCOM_N_TRANSFER] = {
203
204 [UPLCOM_BULK_DT_WR] = {

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

313 UPLCOM_DEV(YCCABLE, PL2303), /* YC Cable USB-Serial */
314};
315#undef UPLCOM_DEV
316
317static device_method_t uplcom_methods[] = {
318 DEVMETHOD(device_probe, uplcom_probe),
319 DEVMETHOD(device_attach, uplcom_attach),
320 DEVMETHOD(device_detach, uplcom_detach),
197
198static usb_callback_t uplcom_intr_callback;
199static usb_callback_t uplcom_write_callback;
200static usb_callback_t uplcom_read_callback;
201
202static const struct usb_config uplcom_config_data[UPLCOM_N_TRANSFER] = {
203
204 [UPLCOM_BULK_DT_WR] = {

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

313 UPLCOM_DEV(YCCABLE, PL2303), /* YC Cable USB-Serial */
314};
315#undef UPLCOM_DEV
316
317static device_method_t uplcom_methods[] = {
318 DEVMETHOD(device_probe, uplcom_probe),
319 DEVMETHOD(device_attach, uplcom_attach),
320 DEVMETHOD(device_detach, uplcom_detach),
321 DEVMETHOD(device_free_softc, uplcom_free_softc),
322 DEVMETHOD_END
323};
324
325static devclass_t uplcom_devclass;
326
327static driver_t uplcom_driver = {
328 .name = "uplcom",
329 .methods = uplcom_methods,

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

466{
467 struct uplcom_softc *sc = device_get_softc(dev);
468
469 DPRINTF("sc=%p\n", sc);
470
471 ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
472 usbd_transfer_unsetup(sc->sc_xfer, UPLCOM_N_TRANSFER);
473
321 DEVMETHOD_END
322};
323
324static devclass_t uplcom_devclass;
325
326static driver_t uplcom_driver = {
327 .name = "uplcom",
328 .methods = uplcom_methods,

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

465{
466 struct uplcom_softc *sc = device_get_softc(dev);
467
468 DPRINTF("sc=%p\n", sc);
469
470 ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
471 usbd_transfer_unsetup(sc->sc_xfer, UPLCOM_N_TRANSFER);
472
473 device_claim_softc(dev);
474
475 uplcom_free_softc(sc);
476
474 return (0);
475}
476
477UCOM_UNLOAD_DRAIN(uplcom);
478
479static void
477 return (0);
478}
479
480UCOM_UNLOAD_DRAIN(uplcom);
481
482static void
480uplcom_free_softc(device_t dev, void *arg)
483uplcom_free_softc(struct uplcom_softc *sc)
481{
484{
482 struct uplcom_softc *sc = arg;
483
484 if (ucom_unref(&sc->sc_super_ucom)) {
485 if (ucom_unref(&sc->sc_super_ucom)) {
485 if (mtx_initialized(&sc->sc_mtx))
486 mtx_destroy(&sc->sc_mtx);
487 device_free_softc(dev, sc);
486 mtx_destroy(&sc->sc_mtx);
487 device_free_softc(sc);
488 }
489}
490
491static void
492uplcom_free(struct ucom_softc *ucom)
493{
488 }
489}
490
491static void
492uplcom_free(struct ucom_softc *ucom)
493{
494 uplcom_free_softc(NULL, ucom->sc_parent);
494 uplcom_free_softc(ucom->sc_parent);
495}
496
497static usb_error_t
498uplcom_reset(struct uplcom_softc *sc, struct usb_device *udev)
499{
500 struct usb_device_request req;
501
502 req.bmRequestType = UT_WRITE_VENDOR_DEVICE;

--- 430 unchanged lines hidden ---
495}
496
497static usb_error_t
498uplcom_reset(struct uplcom_softc *sc, struct usb_device *udev)
499{
500 struct usb_device_request req;
501
502 req.bmRequestType = UT_WRITE_VENDOR_DEVICE;

--- 430 unchanged lines hidden ---