Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/mca Fix a bug that the supported media can't passed ...



details:   https://anonhg.NetBSD.org/src/rev/f5205e73cb58
branches:  trunk
changeset: 455649:f5205e73cb58
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Apr 09 04:04:04 2019 +0000

description:
Fix a bug that the supported media can't passed correctly. Not tested.

diffstat:

 sys/dev/mca/if_le_mca.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (60 lines):

diff -r 645dbe13e039 -r f5205e73cb58 sys/dev/mca/if_le_mca.c
--- a/sys/dev/mca/if_le_mca.c   Tue Apr 09 03:56:08 2019 +0000
+++ b/sys/dev/mca/if_le_mca.c   Tue Apr 09 04:04:04 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_le_mca.c,v 1.20 2019/04/09 03:56:08 msaitoh Exp $   */
+/*     $NetBSD: if_le_mca.c,v 1.21 2019/04/09 04:04:04 msaitoh Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_le_mca.c,v 1.20 2019/04/09 03:56:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_mca.c,v 1.21 2019/04/09 04:04:04 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -104,7 +104,7 @@
 static const uint8_t sknet_mcp_irq[] = {
        3, 5, 10, 11
 };
-static const uint8_t sknet_mcp_media[] = {
+static const int sknet_mcp_media[] = {
        IFM_ETHER | IFM_10_2,
        IFM_ETHER | IFM_10_T,
        IFM_ETHER | IFM_10_5,
@@ -131,7 +131,8 @@
        struct le_mca_softc *lesc = device_private(self);
        struct lance_softc *sc = &lesc->sc_am7990.lsc;
        struct mca_attach_args *ma = aux;
-       int i, pos2, pos3, pos4, irq, membase, supmedia=0;
+       int i, pos2, pos3, pos4, irq, membase;
+       const int *supmedia = NULL;
        const char *typestr;
 
        sc->sc_dev = self;
@@ -205,7 +206,7 @@
                membase = 0xc0000 + ((pos3 & 0x0f) * 0x4000);
 
                /* Get configured media type */
-               supmedia = sknet_mcp_media[(pos4 & 0xc0) >> 6];
+               supmedia = &sknet_mcp_media[(pos4 & 0xc0) >> 6];
                break;
        default:
                aprint_error(": unknown product %d\n", ma->ma_id);
@@ -250,10 +251,10 @@
         * This is merely cosmetic since it's not possible to switch
         * the media anyway, even for MC2+.
         */
-       if (supmedia != 0) {
-               sc->sc_supmedia = &supmedia;
+       if (supmedia != NULL) {
+               sc->sc_supmedia = supmedia;
                sc->sc_nsupmedia = 1;
-               sc->sc_defaultmedia = supmedia;
+               sc->sc_defaultmedia = *supmedia;
        }
 
        lesc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_NET,



Home | Main Index | Thread Index | Old Index