Sat May 30 16:44:28 2015 UTC ()
Null suspend/resume handler for uplcom(4).


(riastradh)
diff -r1.74 -r1.75 src/sys/dev/usb/uplcom.c

cvs diff -r1.74 -r1.75 src/sys/dev/usb/uplcom.c (expand / switch to unified diff)

--- src/sys/dev/usb/uplcom.c 2014/07/14 12:04:48 1.74
+++ src/sys/dev/usb/uplcom.c 2015/05/30 16:44:28 1.75
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uplcom.c,v 1.74 2014/07/14 12:04:48 ryoon Exp $ */ 1/* $NetBSD: uplcom.c,v 1.75 2015/05/30 16:44:28 riastradh Exp $ */
2/* 2/*
3 * Copyright (c) 2001 The NetBSD Foundation, Inc. 3 * Copyright (c) 2001 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Ichiro FUKUHARA (ichiro@ichiro.org). 7 * by Ichiro FUKUHARA (ichiro@ichiro.org).
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE. 28 * POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31/* 31/*
32 * General information: http://www.prolific.com.tw/fr_pl2303.htm 32 * General information: http://www.prolific.com.tw/fr_pl2303.htm
33 * http://www.hitachi-hitec.com/jyouhou/prolific/2303.pdf 33 * http://www.hitachi-hitec.com/jyouhou/prolific/2303.pdf
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.74 2014/07/14 12:04:48 ryoon Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.75 2015/05/30 16:44:28 riastradh Exp $");
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kernel.h> 41#include <sys/kernel.h>
42#include <sys/malloc.h> 42#include <sys/malloc.h>
43#include <sys/ioctl.h> 43#include <sys/ioctl.h>
44#include <sys/conf.h> 44#include <sys/conf.h>
45#include <sys/tty.h> 45#include <sys/tty.h>
46#include <sys/file.h> 46#include <sys/file.h>
47#include <sys/select.h> 47#include <sys/select.h>
48#include <sys/proc.h> 48#include <sys/proc.h>
49#include <sys/device.h> 49#include <sys/device.h>
50#include <sys/poll.h> 50#include <sys/poll.h>
@@ -408,26 +408,29 @@ uplcom_attach(device_t parent, device_t  @@ -408,26 +408,29 @@ uplcom_attach(device_t parent, device_t
408 aprint_error_dev(self, "reset failed, %s\n", usbd_errstr(err)); 408 aprint_error_dev(self, "reset failed, %s\n", usbd_errstr(err));
409 sc->sc_dying = 1; 409 sc->sc_dying = 1;
410 return; 410 return;
411 } 411 }
412 412
413 usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, 413 usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
414 sc->sc_dev); 414 sc->sc_dev);
415 415
416 DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n", 416 DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n",
417 uca.bulkin, uca.bulkout, sc->sc_intr_number )); 417 uca.bulkin, uca.bulkout, sc->sc_intr_number ));
418 sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, 418 sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca,
419 ucomprint, ucomsubmatch); 419 ucomprint, ucomsubmatch);
420 420
 421 if (!pmf_device_register(self, NULL, NULL))
 422 aprint_error_dev(self, "couldn't establish power handler\n");
 423
421 return; 424 return;
422} 425}
423 426
424void 427void
425uplcom_childdet(device_t self, device_t child) 428uplcom_childdet(device_t self, device_t child)
426{ 429{
427 struct uplcom_softc *sc = device_private(self); 430 struct uplcom_softc *sc = device_private(self);
428 431
429 KASSERT(sc->sc_subdev == child); 432 KASSERT(sc->sc_subdev == child);
430 sc->sc_subdev = NULL; 433 sc->sc_subdev = NULL;
431} 434}
432 435
433int  436int
@@ -442,26 +445,29 @@ uplcom_detach(device_t self, int flags) @@ -442,26 +445,29 @@ uplcom_detach(device_t self, int flags)
442 usbd_abort_pipe(sc->sc_intr_pipe); 445 usbd_abort_pipe(sc->sc_intr_pipe);
443 usbd_close_pipe(sc->sc_intr_pipe); 446 usbd_close_pipe(sc->sc_intr_pipe);
444 free(sc->sc_intr_buf, M_USBDEV); 447 free(sc->sc_intr_buf, M_USBDEV);
445 sc->sc_intr_pipe = NULL; 448 sc->sc_intr_pipe = NULL;
446 } 449 }
447 450
448 sc->sc_dying = 1; 451 sc->sc_dying = 1;
449 if (sc->sc_subdev != NULL) 452 if (sc->sc_subdev != NULL)
450 rv = config_detach(sc->sc_subdev, flags); 453 rv = config_detach(sc->sc_subdev, flags);
451 454
452 usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, 455 usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
453 sc->sc_dev); 456 sc->sc_dev);
454 457
 458 if (rv == 0)
 459 pmf_device_deregister(self);
 460
455 return (rv); 461 return (rv);
456} 462}
457 463
458int 464int
459uplcom_activate(device_t self, enum devact act) 465uplcom_activate(device_t self, enum devact act)
460{ 466{
461 struct uplcom_softc *sc = device_private(self); 467 struct uplcom_softc *sc = device_private(self);
462 468
463 switch (act) { 469 switch (act) {
464 case DVACT_DEACTIVATE: 470 case DVACT_DEACTIVATE:
465 sc->sc_dying = 1; 471 sc->sc_dying = 1;
466 return 0; 472 return 0;
467 default: 473 default: