Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb don't pass two different softcs that just happen...
details: https://anonhg.NetBSD.org/src/rev/5f4d758d6dc0
branches: trunk
changeset: 998848:5f4d758d6dc0
user: mrg <mrg%NetBSD.org@localhost>
date: Sat May 04 23:52:18 2019 +0000
description:
don't pass two different softcs that just happen to overlap, but
shim the umodem functions directly and call them with the sub-softc.
diffstat:
sys/dev/usb/ukyopon.c | 71 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 54 insertions(+), 17 deletions(-)
diffs (122 lines):
diff -r 2dfbda0e802c -r 5f4d758d6dc0 sys/dev/usb/ukyopon.c
--- a/sys/dev/usb/ukyopon.c Sat May 04 23:36:14 2019 +0000
+++ b/sys/dev/usb/ukyopon.c Sat May 04 23:52:18 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ukyopon.c,v 1.21 2019/05/04 08:04:13 mrg Exp $ */
+/* $NetBSD: ukyopon.c,v 1.22 2019/05/04 23:52:18 mrg Exp $ */
/*
* Copyright (c) 1998, 2005 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukyopon.c,v 1.21 2019/05/04 08:04:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukyopon.c,v 1.22 2019/05/04 23:52:18 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -86,27 +86,31 @@
#define UKYOPON_MODEM_IFACE_INDEX 0
#define UKYOPON_DATA_IFACE_INDEX 3
-Static void ukyopon_get_status(void *, int, u_char *, u_char *);
-Static int ukyopon_ioctl(void *, int, u_long, void *, int, proc_t *);
+static void ukyopon_get_status(void *, int, u_char *, u_char *);
+static int ukyopon_ioctl(void *, int, u_long, void *, int, proc_t *);
+static void ukyopon_set(void *, int, int, int);
+static int ukyopon_param(void *, int, struct termios *);
+static int ukyopon_open(void *, int);
+static void ukyopon_close(void *, int);
-Static struct ucom_methods ukyopon_methods = {
+static struct ucom_methods ukyopon_methods = {
.ucom_get_status = ukyopon_get_status,
- .ucom_set = umodem_set,
- .ucom_param = umodem_param,
+ .ucom_set = ukyopon_set,
+ .ucom_param = ukyopon_param,
.ucom_ioctl = ukyopon_ioctl,
- .ucom_open = umodem_open,
- .ucom_close = umodem_close,
+ .ucom_open = ukyopon_open,
+ .ucom_close = ukyopon_close,
};
-int ukyopon_match(device_t, cfdata_t, void *);
-void ukyopon_attach(device_t, device_t, void *);
-int ukyopon_detach(device_t, int);
-int ukyopon_activate(device_t, enum devact);
+static int ukyopon_match(device_t, cfdata_t, void *);
+static void ukyopon_attach(device_t, device_t, void *);
+static int ukyopon_detach(device_t, int);
+static int ukyopon_activate(device_t, enum devact);
extern struct cfdriver ukyopon_cd;
CFATTACH_DECL_NEW(ukyopon, sizeof(struct ukyopon_softc), ukyopon_match,
ukyopon_attach, ukyopon_detach, ukyopon_activate);
-int
+static int
ukyopon_match(device_t parent, cfdata_t match, void *aux)
{
struct usbif_attach_arg *uiaa = aux;
@@ -120,7 +124,7 @@
return UMATCH_NONE;
}
-void
+static void
ukyopon_attach(device_t parent, device_t self, void *aux)
{
struct ukyopon_softc *sc = device_private(self);
@@ -138,7 +142,7 @@
return;
}
-Static void
+static void
ukyopon_get_status(void *addr, int portno, u_char *lsr, u_char *msr)
{
struct ukyopon_softc *sc = addr;
@@ -153,7 +157,40 @@
umodem_get_status(addr, portno, lsr, msr);
}
-Static int
+static void
+ukyopon_set(void *addr, int portno, int reg, int onoff)
+{
+ struct ukyopon_softc *sc = addr;
+
+ umodem_set(&sc->sc_umodem, portno, reg, onoff);
+}
+
+static int
+ukyopon_param(void *addr, int portno, struct termios *t)
+{
+ struct ukyopon_softc *sc = addr;
+
+ return umodem_param(&sc->sc_umodem, portno, t);
+}
+
+static int
+ukyopon_open(void *addr, int portno)
+{
+ struct ukyopon_softc *sc = addr;
+
+ return umodem_open(&sc->sc_umodem, portno);
+}
+
+static void
+ukyopon_close(void *addr, int portno)
+{
+ struct ukyopon_softc *sc = addr;
+
+ umodem_close(&sc->sc_umodem, portno);
+}
+
+
+static int
ukyopon_ioctl(void *addr, int portno, u_long cmd, void *data, int flag,
proc_t *p)
{
Home |
Main Index |
Thread Index |
Old Index