Thu Mar 3 05:53:49 2022 UTC ()
aue(4): Simplify.  No functional change.


(riastradh)
diff -r1.183 -r1.184 src/sys/dev/usb/if_aue.c

cvs diff -r1.183 -r1.184 src/sys/dev/usb/if_aue.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_aue.c 2022/03/03 05:53:41 1.183
+++ src/sys/dev/usb/if_aue.c 2022/03/03 05:53:48 1.184
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_aue.c,v 1.183 2022/03/03 05:53:41 riastradh Exp $ */ 1/* $NetBSD: if_aue.c,v 1.184 2022/03/03 05:53:48 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997, 1998, 1999, 2000 4 * Copyright (c) 1997, 1998, 1999, 2000
5 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. 5 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -66,27 +66,27 @@ @@ -66,27 +66,27 @@
66/* 66/*
67 * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. 67 * Ported to NetBSD and somewhat rewritten by Lennart Augustsson.
68 */ 68 */
69 69
70/* 70/*
71 * TODO: 71 * TODO:
72 * better error messages from rxstat 72 * better error messages from rxstat
73 * more error checks 73 * more error checks
74 * investigate short rx problem 74 * investigate short rx problem
75 * proper cleanup on errors 75 * proper cleanup on errors
76 */ 76 */
77 77
78#include <sys/cdefs.h> 78#include <sys/cdefs.h>
79__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.183 2022/03/03 05:53:41 riastradh Exp $"); 79__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.184 2022/03/03 05:53:48 riastradh Exp $");
80 80
81#ifdef _KERNEL_OPT 81#ifdef _KERNEL_OPT
82#include "opt_usb.h" 82#include "opt_usb.h"
83#include "opt_inet.h" 83#include "opt_inet.h"
84#endif 84#endif
85 85
86#include <sys/param.h> 86#include <sys/param.h>
87 87
88#include <dev/usb/usbnet.h> 88#include <dev/usb/usbnet.h>
89#include <dev/usb/usbhist.h> 89#include <dev/usb/usbhist.h>
90#include <dev/usb/if_auereg.h> 90#include <dev/usb/if_auereg.h>
91 91
92#ifdef INET 92#ifdef INET
@@ -938,27 +938,27 @@ aue_uno_tx_prepare(struct usbnet *un, st @@ -938,27 +938,27 @@ aue_uno_tx_prepare(struct usbnet *un, st
938 total_len = m->m_pkthdr.len + 2; 938 total_len = m->m_pkthdr.len + 2;
939 939
940 DPRINTFN(5, "aue%jd: send %jd bytes", 940 DPRINTFN(5, "aue%jd: send %jd bytes",
941 device_unit(un->un_dev), total_len, 0, 0); 941 device_unit(un->un_dev), total_len, 0, 0);
942 942
943 return total_len; 943 return total_len;
944} 944}
945 945
946static int 946static int
947aue_uno_init(struct ifnet *ifp) 947aue_uno_init(struct ifnet *ifp)
948{ 948{
949 struct usbnet * const un = ifp->if_softc; 949 struct usbnet * const un = ifp->if_softc;
950 struct aue_softc *sc = usbnet_softc(un); 950 struct aue_softc *sc = usbnet_softc(un);
951 int i, rv; 951 int i;
952 const u_char *eaddr; 952 const u_char *eaddr;
953 953
954 AUEHIST_FUNC(); 954 AUEHIST_FUNC();
955 AUEHIST_CALLARGSN(5, "aue%jd: enter link=%jd", 955 AUEHIST_CALLARGSN(5, "aue%jd: enter link=%jd",
956 device_unit(un->un_dev), usbnet_havelink(un), 0, 0); 956 device_unit(un->un_dev), usbnet_havelink(un), 0, 0);
957 957
958 if (usbnet_isdying(un)) 958 if (usbnet_isdying(un))
959 return EIO; 959 return EIO;
960 960
961 /* Cancel pending I/O */ 961 /* Cancel pending I/O */
962 if (ifp->if_flags & IFF_RUNNING) 962 if (ifp->if_flags & IFF_RUNNING)
963 return 0; 963 return 0;
964 964
@@ -970,31 +970,27 @@ aue_uno_init(struct ifnet *ifp) @@ -970,31 +970,27 @@ aue_uno_init(struct ifnet *ifp)
970 aue_csr_write_1(sc, AUE_PAR0 + i, eaddr[i]); 970 aue_csr_write_1(sc, AUE_PAR0 + i, eaddr[i]);
971 971
972 /* If we want promiscuous mode, set the allframes bit. */ 972 /* If we want promiscuous mode, set the allframes bit. */
973 if (ifp->if_flags & IFF_PROMISC) 973 if (ifp->if_flags & IFF_PROMISC)
974 AUE_SETBIT(sc, AUE_CTL2, AUE_CTL2_RX_PROMISC); 974 AUE_SETBIT(sc, AUE_CTL2, AUE_CTL2_RX_PROMISC);
975 else 975 else
976 AUE_CLRBIT(sc, AUE_CTL2, AUE_CTL2_RX_PROMISC); 976 AUE_CLRBIT(sc, AUE_CTL2, AUE_CTL2_RX_PROMISC);
977 977
978 /* Enable RX and TX */ 978 /* Enable RX and TX */
979 aue_csr_write_1(sc, AUE_CTL0, AUE_CTL0_RXSTAT_APPEND | AUE_CTL0_RX_ENB); 979 aue_csr_write_1(sc, AUE_CTL0, AUE_CTL0_RXSTAT_APPEND | AUE_CTL0_RX_ENB);
980 AUE_SETBIT(sc, AUE_CTL0, AUE_CTL0_TX_ENB); 980 AUE_SETBIT(sc, AUE_CTL0, AUE_CTL0_TX_ENB);
981 AUE_SETBIT(sc, AUE_CTL2, AUE_CTL2_EP3_CLR); 981 AUE_SETBIT(sc, AUE_CTL2, AUE_CTL2_EP3_CLR);
982 982
983 rv = usbnet_init_rx_tx(un); 983 return usbnet_init_rx_tx(un);
984 
985 //mii_mediachg(mii); 
986 
987 return rv; 
988} 984}
989 985
990static void 986static void
991aue_uno_stop(struct ifnet *ifp, int disable) 987aue_uno_stop(struct ifnet *ifp, int disable)
992{ 988{
993 struct usbnet * const un = ifp->if_softc; 989 struct usbnet * const un = ifp->if_softc;
994 struct aue_softc * const sc = usbnet_softc(un); 990 struct aue_softc * const sc = usbnet_softc(un);
995 991
996 AUEHIST_FUNC(); 992 AUEHIST_FUNC();
997 AUEHIST_CALLARGSN(5, "aue%jd: enter", device_unit(un->un_dev), 0, 0, 0); 993 AUEHIST_CALLARGSN(5, "aue%jd: enter", device_unit(un->un_dev), 0, 0, 0);
998 994
999 aue_csr_write_1(sc, AUE_CTL0, 0); 995 aue_csr_write_1(sc, AUE_CTL0, 0);
1000 aue_csr_write_1(sc, AUE_CTL1, 0); 996 aue_csr_write_1(sc, AUE_CTL1, 0);