summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-06 04:48:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-06 04:48:55 +0000
commit5d40c54417a0d93e9121804b102533aa538ed5af (patch)
tree75dfb14669a3262bb0d1fc3b88d1b2d67ac244b8 /sys
parent749fd17f08b39635d88e3fdda20531e25bf6e720 (diff)
Unify a few attach-time patterns between usb *com drivers, and remove
extra zero'ing of variables not needed because softc is pre-zero'd. ok jsg
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/uchcom.c3
-rw-r--r--sys/dev/usb/ucycom.c6
-rw-r--r--sys/dev/usb/uslhcom.c8
3 files changed, 7 insertions, 10 deletions
diff --git a/sys/dev/usb/uchcom.c b/sys/dev/usb/uchcom.c
index 3cccc648673..3484aad47e8 100644
--- a/sys/dev/usb/uchcom.c
+++ b/sys/dev/usb/uchcom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uchcom.c,v 1.25 2016/09/02 09:14:59 mpi Exp $ */
+/* $OpenBSD: uchcom.c,v 1.26 2017/04/06 04:48:54 deraadt Exp $ */
/* $NetBSD: uchcom.c,v 1.1 2007/09/03 17:57:37 tshiozak Exp $ */
/*
@@ -253,7 +253,6 @@ uchcom_attach(struct device *parent, struct device *self, void *aux)
sc->sc_udev = dev;
sc->sc_dtr = sc->sc_rts = -1;
- sc->sc_lsr = sc->sc_msr = 0;
DPRINTF(("\n\nuchcom attach: sc=%p\n", sc));
diff --git a/sys/dev/usb/ucycom.c b/sys/dev/usb/ucycom.c
index d6f098c4b4e..40519ba7673 100644
--- a/sys/dev/usb/ucycom.c
+++ b/sys/dev/usb/ucycom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ucycom.c,v 1.34 2016/01/09 04:14:42 jcs Exp $ */
+/* $OpenBSD: ucycom.c,v 1.35 2017/04/06 04:48:54 deraadt Exp $ */
/* $NetBSD: ucycom.c,v 1.3 2005/08/05 07:27:47 skrll Exp $ */
/*
@@ -201,8 +201,6 @@ ucycom_attach(struct device *parent, struct device *self, void *aux)
sc->sc_udev = dev;
- sc->sc_msr = sc->sc_mcr = 0;
-
err = uhidev_open(&sc->sc_hdev);
if (err) {
DPRINTF(("ucycom_open: uhidev_open %d\n", err));
@@ -216,11 +214,11 @@ ucycom_attach(struct device *parent, struct device *self, void *aux)
/* bulkin, bulkout set above */
bzero(&uca, sizeof uca);
uca.bulkin = uca.bulkout = -1;
- uca.uhidev = sc->sc_hdev.sc_parent;
uca.ibufsize = sc->sc_ilen - 1;
uca.obufsize = sc->sc_olen - 1;
uca.ibufsizepad = 1;
uca.opkthdrlen = 0;
+ uca.uhidev = sc->sc_hdev.sc_parent;
uca.device = uaa->device;
uca.iface = uaa->iface;
uca.methods = &ucycom_methods;
diff --git a/sys/dev/usb/uslhcom.c b/sys/dev/usb/uslhcom.c
index 976bedba2c5..01e1208ce27 100644
--- a/sys/dev/usb/uslhcom.c
+++ b/sys/dev/usb/uslhcom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uslhcom.c,v 1.4 2016/01/09 04:14:42 jcs Exp $ */
+/* $OpenBSD: uslhcom.c,v 1.5 2017/04/06 04:48:54 deraadt Exp $ */
/*
* Copyright (c) 2015 SASANO Takayoshi <uaa@openbsd.org>
@@ -134,12 +134,9 @@ uslhcom_attach(struct device *parent, struct device *self, void *aux)
int err, repid, size, rsize;
void *desc;
- sc->sc_udev = dev;
- sc->sc_lsr = sc->sc_msr = 0;
sc->sc_hdev.sc_intr = uslhcom_intr;
sc->sc_hdev.sc_parent = uha->parent;
sc->sc_hdev.sc_report_id = uha->reportid;
- sc->sc_hdev.sc_isize = sc->sc_hdev.sc_osize = sc->sc_hdev.sc_fsize = 0;
uhidev_get_report_desc(uha->parent, &desc, &size);
for (repid = 0; repid < uha->parent->sc_nrepid; repid++) {
@@ -153,6 +150,8 @@ uslhcom_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
+ sc->sc_udev = dev;
+
err = uhidev_open(&sc->sc_hdev);
if (err) {
DPRINTF(("uslhcom_attach: uhidev_open %d\n", err));
@@ -172,6 +171,7 @@ uslhcom_attach(struct device *parent, struct device *self, void *aux)
version.product_id, version.product_revision);
/* setup ucom layer */
+ bzero(&uca, sizeof uca);
uca.portno = UCOM_UNK_PORTNO;
uca.bulkin = uca.bulkout = -1;
uca.ibufsize = uca.ibufsizepad = 0;