Thu Mar 3 05:49:51 2022 UTC ()
cue(4): Return real error code, not -1, on init when detaching.


(riastradh)
diff -r1.91 -r1.92 src/sys/dev/usb/if_cue.c

cvs diff -r1.91 -r1.92 src/sys/dev/usb/if_cue.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_cue.c 2020/03/15 23:04:50 1.91
+++ src/sys/dev/usb/if_cue.c 2022/03/03 05:49:51 1.92
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_cue.c,v 1.91 2020/03/15 23:04:50 thorpej Exp $ */ 1/* $NetBSD: if_cue.c,v 1.92 2022/03/03 05:49:51 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.
@@ -47,27 +47,27 @@ @@ -47,27 +47,27 @@
47 * The CATC USB-EL1210A provides USB ethernet support at 10Mbps. The 47 * The CATC USB-EL1210A provides USB ethernet support at 10Mbps. The
48 * RX filter uses a 512-bit multicast hash table, single perfect entry 48 * RX filter uses a 512-bit multicast hash table, single perfect entry
49 * for the station address, and promiscuous mode. Unlike the ADMtek 49 * for the station address, and promiscuous mode. Unlike the ADMtek
50 * and KLSI chips, the CATC ASIC supports read and write combining 50 * and KLSI chips, the CATC ASIC supports read and write combining
51 * mode where multiple packets can be transferred using a single bulk 51 * mode where multiple packets can be transferred using a single bulk
52 * transaction, which helps performance a great deal. 52 * transaction, which helps performance a great deal.
53 */ 53 */
54 54
55/* 55/*
56 * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. 56 * Ported to NetBSD and somewhat rewritten by Lennart Augustsson.
57 */ 57 */
58 58
59#include <sys/cdefs.h> 59#include <sys/cdefs.h>
60__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.91 2020/03/15 23:04:50 thorpej Exp $"); 60__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.92 2022/03/03 05:49:51 riastradh Exp $");
61 61
62#ifdef _KERNEL_OPT 62#ifdef _KERNEL_OPT
63#include "opt_inet.h" 63#include "opt_inet.h"
64#include "opt_usb.h" 64#include "opt_usb.h"
65#endif 65#endif
66 66
67#include <sys/param.h> 67#include <sys/param.h>
68 68
69#include <dev/usb/usbnet.h> 69#include <dev/usb/usbnet.h>
70#include <dev/usb/if_cuereg.h> 70#include <dev/usb/if_cuereg.h>
71 71
72#ifdef INET 72#ifdef INET
73#include <netinet/in.h> 73#include <netinet/in.h>
@@ -612,27 +612,27 @@ cue_uno_tx_prepare(struct usbnet *un, st @@ -612,27 +612,27 @@ cue_uno_tx_prepare(struct usbnet *un, st
612 return total_len; 612 return total_len;
613} 613}
614 614
615static int 615static int
616cue_init_locked(struct ifnet *ifp) 616cue_init_locked(struct ifnet *ifp)
617{ 617{
618 struct usbnet * const un = ifp->if_softc; 618 struct usbnet * const un = ifp->if_softc;
619 int i, ctl; 619 int i, ctl;
620 const u_char *eaddr; 620 const u_char *eaddr;
621 621
622 DPRINTFN(10,("%s: %s: enter\n", device_xname(un->un_dev),__func__)); 622 DPRINTFN(10,("%s: %s: enter\n", device_xname(un->un_dev),__func__));
623 623
624 if (usbnet_isdying(un)) 624 if (usbnet_isdying(un))
625 return -1; 625 return ENXIO;
626 626
627 /* Cancel pending I/O */ 627 /* Cancel pending I/O */
628 usbnet_stop(un, ifp, 1); 628 usbnet_stop(un, ifp, 1);
629 629
630 /* Reset the interface. */ 630 /* Reset the interface. */
631#if 1 631#if 1
632 cue_reset(un); 632 cue_reset(un);
633#endif 633#endif
634 634
635 /* Set advanced operation modes. */ 635 /* Set advanced operation modes. */
636 cue_csr_write_1(un, CUE_ADVANCED_OPMODES, 636 cue_csr_write_1(un, CUE_ADVANCED_OPMODES,
637 CUE_AOP_EMBED_RXLEN | 0x03); /* 1 wait state */ 637 CUE_AOP_EMBED_RXLEN | 0x03); /* 1 wait state */
638 638