Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/usb Backout the following changes (requested by m...
details: https://anonhg.NetBSD.org/src/rev/f3c308609911
branches: netbsd-8
changeset: 451133:f3c308609911
user: martin <martin%NetBSD.org@localhost>
date: Tue May 07 18:47:01 2019 +0000
description:
Backout the following changes (requested by mrg in ticket #1240):
sys/dev/usb/umodem_common.c: revision 1.27
sys/dev/usb/umodemvar.h: revision 1.10
sys/dev/usb/ucom.c: revision 1.122
fix umodem(4) detach.
There are different fixes upcoming.
diffstat:
sys/dev/usb/ucom.c | 16 ++----
sys/dev/usb/umodem_common.c | 92 +++++++++-----------------------------------
sys/dev/usb/umodemvar.h | 9 +--
3 files changed, 28 insertions(+), 89 deletions(-)
diffs (truncated from 332 to 300 lines):
diff -r 0c4708d6592d -r f3c308609911 sys/dev/usb/ucom.c
--- a/sys/dev/usb/ucom.c Sun May 05 08:43:44 2019 +0000
+++ b/sys/dev/usb/ucom.c Tue May 07 18:47:01 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ucom.c,v 1.118.8.3 2019/04/22 08:17:50 martin Exp $ */
+/* $NetBSD: ucom.c,v 1.118.8.4 2019/05/07 18:47:01 martin Exp $ */
/*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.118.8.3 2019/04/22 08:17:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.118.8.4 2019/05/07 18:47:01 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -441,8 +441,10 @@
mutex_spin_exit(&tty_lock);
}
/* Wait for processes to go away. */
- if (cv_timedwait(&sc->sc_detachcv, &sc->sc_lock, hz * 60))
- aprint_error_dev(self, ": didn't detach\n");
+ if (cv_timedwait(&sc->sc_detachcv, &sc->sc_lock, hz * 60)) {
+ printf("%s: %s didn't detach\n", __func__,
+ device_xname(sc->sc_dev));
+ }
}
softint_disestablish(sc->sc_si);
@@ -1269,9 +1271,7 @@
if (old && !block) {
sc->sc_rx_unblock = 1;
- kpreempt_disable();
softint_schedule(sc->sc_si);
- kpreempt_enable();
}
mutex_exit(&sc->sc_lock);
@@ -1339,9 +1339,7 @@
SIMPLEQ_INSERT_TAIL(&sc->sc_obuff_full, ub, ub_link);
- kpreempt_disable();
softint_schedule(sc->sc_si);
- kpreempt_enable();
out:
DPRINTF("... done", 0, 0, 0, 0);
@@ -1383,9 +1381,7 @@
break;
case USBD_STALLED:
ub->ub_index = 0;
- kpreempt_disable();
softint_schedule(sc->sc_si);
- kpreempt_enable();
break;
case USBD_NORMAL_COMPLETION:
usbd_get_xfer_status(ub->ub_xfer, NULL, NULL, &cc, NULL);
diff -r 0c4708d6592d -r f3c308609911 sys/dev/usb/umodem_common.c
--- a/sys/dev/usb/umodem_common.c Sun May 05 08:43:44 2019 +0000
+++ b/sys/dev/usb/umodem_common.c Tue May 07 18:47:01 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: umodem_common.c,v 1.25.8.1 2019/04/22 08:17:50 martin Exp $ */
+/* $NetBSD: umodem_common.c,v 1.25.8.2 2019/05/07 18:47:01 martin Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.25.8.1 2019/04/22 08:17:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.25.8.2 2019/05/07 18:47:01 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -94,16 +94,16 @@
#define UMODEMIBUFSIZE 4096
#define UMODEMOBUFSIZE 4096
-static usbd_status umodem_set_comm_feature(struct umodem_softc *,
+Static usbd_status umodem_set_comm_feature(struct umodem_softc *,
int, int);
-static usbd_status umodem_set_line_coding(struct umodem_softc *,
+Static usbd_status umodem_set_line_coding(struct umodem_softc *,
usb_cdc_line_state_t *);
-static void umodem_dtr(struct umodem_softc *, int);
-static void umodem_rts(struct umodem_softc *, int);
-static void umodem_break(struct umodem_softc *, int);
-static void umodem_set_line_state(struct umodem_softc *);
-static void umodem_intr(struct usbd_xfer *, void *, usbd_status);
+Static void umodem_dtr(struct umodem_softc *, int);
+Static void umodem_rts(struct umodem_softc *, int);
+Static void umodem_break(struct umodem_softc *, int);
+Static void umodem_set_line_state(struct umodem_softc *);
+Static void umodem_intr(struct usbd_xfer *, void *, usbd_status);
int
umodem_common_attach(device_t self, struct umodem_softc *sc,
@@ -120,15 +120,10 @@
sc->sc_dev = self;
sc->sc_udev = dev;
sc->sc_ctl_iface = uiaa->uiaa_iface;
- sc->sc_refcnt = 0;
- sc->sc_dying = false;
aprint_naive("\n");
aprint_normal("\n");
- mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB);
- cv_init(&sc->sc_detach_cv, "umodemdet");
-
id = usbd_get_interface_descriptor(sc->sc_ctl_iface);
devinfop = usbd_devinfo_alloc(uiaa->uiaa_device, 0);
aprint_normal_dev(self, "%s, iclass %d/%d\n",
@@ -261,7 +256,7 @@
return 0;
bad:
- sc->sc_dying = true;
+ sc->sc_dying = 1;
return 1;
}
@@ -271,15 +266,6 @@
struct umodem_softc *sc = addr;
int err;
- mutex_enter(&sc->sc_lock);
- if (sc->sc_dying) {
- mutex_exit(&sc->sc_lock);
- return EIO;
- }
-
- sc->sc_refcnt++;
- mutex_exit(&sc->sc_lock);
-
DPRINTF(("umodem_open: sc=%p\n", sc));
if (sc->sc_ctl_notify != -1 && sc->sc_notify_pipe == NULL) {
@@ -291,10 +277,6 @@
if (err) {
DPRINTF(("Failed to establish notify pipe: %s\n",
usbd_errstr(err)));
- mutex_enter(&sc->sc_lock);
- if (--sc->sc_refcnt < 0)
- cv_broadcast(&sc->sc_detach_cv);
- mutex_exit(&sc->sc_lock);
return EIO;
}
}
@@ -308,11 +290,6 @@
struct umodem_softc *sc = addr;
int err;
- mutex_enter(&sc->sc_lock);
- if (sc->sc_dying)
- goto out;
- mutex_exit(&sc->sc_lock);
-
DPRINTF(("umodem_close: sc=%p\n", sc));
if (sc->sc_notify_pipe != NULL) {
@@ -326,15 +303,9 @@
device_xname(sc->sc_dev), usbd_errstr(err));
sc->sc_notify_pipe = NULL;
}
-
- mutex_enter(&sc->sc_lock);
-out:
- if (--sc->sc_refcnt < 0)
- cv_broadcast(&sc->sc_detach_cv);
- mutex_exit(&sc->sc_lock);
}
-static void
+Static void
umodem_intr(struct usbd_xfer *xfer, void *priv,
usbd_status status)
{
@@ -467,11 +438,6 @@
usbd_status err;
usb_cdc_line_state_t ls;
- mutex_enter(&sc->sc_lock);
- if (sc->sc_dying)
- return EIO;
- mutex_exit(&sc->sc_lock);
-
DPRINTF(("umodem_param: sc=%p\n", sc));
USETDW(ls.dwDTERate, t->c_ospeed);
@@ -516,10 +482,8 @@
struct umodem_softc *sc = addr;
int error = 0;
- mutex_enter(&sc->sc_lock);
if (sc->sc_dying)
return EIO;
- mutex_exit(&sc->sc_lock);
DPRINTF(("umodem_ioctl: cmd=0x%08lx\n", cmd));
@@ -543,7 +507,7 @@
return error;
}
-static void
+void
umodem_dtr(struct umodem_softc *sc, int onoff)
{
DPRINTF(("umodem_dtr: onoff=%d\n", onoff));
@@ -555,7 +519,7 @@
umodem_set_line_state(sc);
}
-static void
+void
umodem_rts(struct umodem_softc *sc, int onoff)
{
DPRINTF(("umodem_rts: onoff=%d\n", onoff));
@@ -567,7 +531,7 @@
umodem_set_line_state(sc);
}
-static void
+void
umodem_set_line_state(struct umodem_softc *sc)
{
usb_device_request_t req;
@@ -585,7 +549,7 @@
}
-static void
+void
umodem_break(struct umodem_softc *sc, int onoff)
{
usb_device_request_t req;
@@ -609,11 +573,6 @@
{
struct umodem_softc *sc = addr;
- mutex_enter(&sc->sc_lock);
- if (sc->sc_dying)
- return;
- mutex_exit(&sc->sc_lock);
-
switch (reg) {
case UCOM_SET_DTR:
umodem_dtr(sc, onoff);
@@ -629,7 +588,7 @@
}
}
-static usbd_status
+usbd_status
umodem_set_line_coding(struct umodem_softc *sc, usb_cdc_line_state_t *state)
{
usb_device_request_t req;
@@ -662,7 +621,7 @@
return USBD_NORMAL_COMPLETION;
}
-static usbd_status
+usbd_status
umodem_set_comm_feature(struct umodem_softc *sc, int feature, int state)
{
usb_device_request_t req;
@@ -694,9 +653,7 @@
{
switch (act) {
case DVACT_DEACTIVATE:
- mutex_enter(&sc->sc_lock);
- sc->sc_dying = true;
- mutex_exit(&sc->sc_lock);
+ sc->sc_dying = 1;
return 0;
default:
return EOPNOTSUPP;
@@ -717,23 +674,12 @@
DPRINTF(("umodem_common_detach: sc=%p flags=%d\n", sc, flags));
- mutex_enter(&sc->sc_lock);
- sc->sc_dying = true;
-
- sc->sc_refcnt--;
- while (sc->sc_refcnt > 0) {
- if (cv_timedwait(&sc->sc_detach_cv, &sc->sc_lock, hz * 60))
- aprint_error_dev(sc->sc_dev, ": didn't detach\n");
- }
- mutex_exit(&sc->sc_lock);
+ sc->sc_dying = 1;
if (sc->sc_subdev != NULL)
Home |
Main Index |
Thread Index |
Old Index