Source-Changes-HG archive

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

[src/trunk]: src/sys/dev remove the useless (always 0) device number from car...



details:   https://anonhg.NetBSD.org/src/rev/203380c92cd0
branches:  trunk
changeset: 584117:203380c92cd0
user:      drochner <drochner%NetBSD.org@localhost>
date:      Fri Sep 09 14:50:58 2005 +0000

description:
remove the useless (always 0) device number from cardbus driver state,
autoconf attach structures and configuration cycle functions
(just leave the kernel configuration attribute for now to avoid breaking
 config(1) files)

diffstat:

 sys/dev/cardbus/cardbus.c        |  25 ++++++++-----------------
 sys/dev/cardbus/cardbus_map.c    |   8 ++++----
 sys/dev/cardbus/cardbusvar.h     |  17 ++++++-----------
 sys/dev/cardbus/ehci_cardbus.c   |   7 +++----
 sys/dev/cardbus/if_fxp_cardbus.c |   6 +++---
 sys/dev/cardbus/if_tlp_cardbus.c |   6 +++---
 sys/dev/cardbus/usb_cardbus.h    |   3 +--
 sys/dev/pci/pccbb.c              |  14 +++++++-------
 8 files changed, 35 insertions(+), 51 deletions(-)

diffs (truncated from 371 to 300 lines):

diff -r 77b0d58fa480 -r 203380c92cd0 sys/dev/cardbus/cardbus.c
--- a/sys/dev/cardbus/cardbus.c Fri Sep 09 14:11:39 2005 +0000
+++ b/sys/dev/cardbus/cardbus.c Fri Sep 09 14:50:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cardbus.c,v 1.65 2005/09/08 15:02:48 drochner Exp $    */
+/*     $NetBSD: cardbus.c,v 1.66 2005/09/09 14:50:58 drochner Exp $    */
 
 /*
  * Copyright (c) 1997, 1998, 1999 and 2000
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.65 2005/09/08 15:02:48 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.66 2005/09/09 14:50:58 drochner Exp $");
 
 #include "opt_cardbus.h"
 
@@ -120,12 +120,11 @@
        struct cbslot_attach_args *cba = aux;
 
        sc->sc_bus = cba->cba_bus;
-       sc->sc_device = 0;
        sc->sc_intrline = cba->cba_intrline;
        sc->sc_cacheline = cba->cba_cacheline;
        sc->sc_lattimer = cba->cba_lattimer;
 
-       printf(": bus %d device %d", sc->sc_bus, sc->sc_device);
+       printf(": bus %d", sc->sc_bus);
        if (bootverbose)
                printf(" cacheline 0x%x, lattimer 0x%x", sc->sc_cacheline,
                    sc->sc_lattimer);
@@ -424,11 +423,6 @@
        cc = sc->sc_cc;
        cf = sc->sc_cf;
 
-       /* XXX what a nonsense */
-       if (locators[CARDBUSCF_DEV] != CARDBUSCF_DEV_DEFAULT &&
-           locators[CARDBUSCF_DEV] != sc->sc_device)
-               return (0);
-
        /* inspect initial voltage */
        if ((cdstatus = (*cf->cardbus_ctrl)(cc, CARDBUS_CD)) == 0) {
                DPRINTF(("cardbusattach: no CardBus card on cb%d\n",
@@ -443,7 +437,7 @@
        enable_function(sc, cdstatus, 8);
        function = 0;
 
-       tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, function);
+       tag = cardbus_make_tag(cc, cf, sc->sc_bus, function);
 
        /*
         * Wait until power comes up.  Maxmum 500 ms.
@@ -486,8 +480,7 @@
                if (sc->sc_funcs[function])
                        continue;
 
-               tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device,
-                   function);
+               tag = cardbus_make_tag(cc, cf, sc->sc_bus, function);
 
                id = cardbus_conf_read(cc, cf, tag, CARDBUS_ID_REG);
                class = cardbus_conf_read(cc, cf, tag, CARDBUS_CLASS_REG);
@@ -548,7 +541,6 @@
                ct->ct_cc = sc->sc_cc;
                ct->ct_cf = sc->sc_cf;
                ct->ct_bus = sc->sc_bus;
-               ct->ct_dev = sc->sc_device;
                ct->ct_func = function;
                ct->ct_sc = sc;
                sc->sc_funcs[function] = ct;
@@ -568,7 +560,6 @@
 
                ca.ca_tag = tag;
                ca.ca_bus = sc->sc_bus;
-               ca.ca_device = sc->sc_device; /* always 0 */
                ca.ca_function = function;
                ca.ca_id = id;
                ca.ca_class = class;
@@ -590,7 +581,7 @@
                        }
                }
 
-               locs[CARDBUSCF_DEV] = sc->sc_device; /* always 0 */
+               locs[CARDBUSCF_DEV] = 0;
                locs[CARDBUSCF_FUNCTION] = function;
 
                if ((csc = config_found_sm_loc((void *)sc, "cardbus", locs,
@@ -635,7 +626,7 @@
                    ca->ca_cis.manufacturer, ca->ca_cis.product);
                aprint_normal(" %s at %s", devinfo, pnp);
        }
-       aprint_normal(" dev %d function %d", ca->ca_device, ca->ca_function);
+       aprint_normal(" function %d", ca->ca_function);
 
        return (UNCONF);
 }
@@ -781,7 +772,7 @@
 
        /* exiting critical area */
 
-       tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, func);
+       tag = cardbus_make_tag(cc, cf, sc->sc_bus, func);
 
        command = cardbus_conf_read(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG);
        command |= (CARDBUS_COMMAND_MEM_ENABLE | CARDBUS_COMMAND_IO_ENABLE |
diff -r 77b0d58fa480 -r 203380c92cd0 sys/dev/cardbus/cardbus_map.c
--- a/sys/dev/cardbus/cardbus_map.c     Fri Sep 09 14:11:39 2005 +0000
+++ b/sys/dev/cardbus/cardbus_map.c     Fri Sep 09 14:50:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cardbus_map.c,v 1.16 2005/02/27 00:26:59 perry Exp $   */
+/*     $NetBSD: cardbus_map.c,v 1.17 2005/09/09 14:50:58 drochner Exp $        */
 
 /*
  * Copyright (c) 1999 and 2000
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cardbus_map.c,v 1.16 2005/02/27 00:26:59 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cardbus_map.c,v 1.17 2005/09/09 14:50:58 drochner Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -261,7 +261,7 @@
        int flags;
        int status = 0;
 
-       cardbustag_t tag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, func);
+       cardbustag_t tag = cardbus_make_tag(cc, cf, sc->sc_bus, func);
 
        DPRINTF(("cardbus_mapreg_map called: %s %x\n", sc->sc_dev.dv_xname,
           type));
@@ -371,7 +371,7 @@
        }
 #endif
 
-       cardbustag = cardbus_make_tag(cc, cf, sc->sc_bus, sc->sc_device, func);
+       cardbustag = cardbus_make_tag(cc, cf, sc->sc_bus, func);
 
        cardbus_conf_write(cc, cf, cardbustag, reg, 0);
 
diff -r 77b0d58fa480 -r 203380c92cd0 sys/dev/cardbus/cardbusvar.h
--- a/sys/dev/cardbus/cardbusvar.h      Fri Sep 09 14:11:39 2005 +0000
+++ b/sys/dev/cardbus/cardbusvar.h      Fri Sep 09 14:50:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cardbusvar.h,v 1.33 2005/05/30 04:36:16 christos Exp $ */
+/*     $NetBSD: cardbusvar.h,v 1.34 2005/09/09 14:50:58 drochner Exp $ */
 
 /*
  * Copyright (c) 1998, 1999 and 2000
@@ -76,7 +76,7 @@
  *     int (*cardbus_power)(cardbus_chipset_tag_t ct, int voltage);
  *
  *     cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t ct,
- *         int busno, int devno, int functionno);
+ *         int busno, int functionno);
  *     void (*cardbus_free_tag)(cardbus_chipset_tag_t ct, cardbustag_t tag);
  *     cardbusreg_t (*cardbus_conf_read)(cardbus_chipset_tag_t ct,
  *         cardbustag_t tag, int offs);
@@ -95,8 +95,7 @@
        int (*cardbus_ctrl)(cardbus_chipset_tag_t, int);
        int (*cardbus_power)(cardbus_chipset_tag_t, int);
 
-       cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t, int, int,
-           int);
+       cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t, int, int);
        void (*cardbus_free_tag)(cardbus_chipset_tag_t, cardbustag_t);
        cardbusreg_t (*cardbus_conf_read)(cardbus_chipset_tag_t,
            cardbustag_t, int);
@@ -119,8 +118,7 @@
            int (*)(void *), void *);
        void (*cardbus_intr_disestablish)(cardbus_chipset_tag_t, void *);
 
-       cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t, int, int,
-           int);
+       cardbustag_t (*cardbus_make_tag)(cardbus_chipset_tag_t, int, int);
        cardbusreg_t (*cardbus_conf_read)(cardbus_chipset_tag_t,
            cardbustag_t, int);
        void (*cardbus_conf_write)(cardbus_chipset_tag_t, cardbustag_t,
@@ -162,7 +160,6 @@
        struct device sc_dev;           /* fundamental device structure */
 
        int sc_bus;                     /* cardbus bus number */
-       int sc_device;                  /* cardbus device number */
        int sc_intrline;                /* CardBus intrline */
 
        bus_space_tag_t sc_iot;         /* CardBus I/O space tag */
@@ -200,7 +197,6 @@
        cardbus_function_tag_t ct_cf;
        struct cardbus_softc *ct_sc;    /* pointer to the parent */
        int ct_bus;                     /* bus number */
-       int ct_dev;                     /* device number */
        int ct_func;                    /* function number */
 
 #if rbus
@@ -250,7 +246,6 @@
        bus_dma_tag_t ca_dmat;          /* DMA tag */
 
        u_int ca_bus;
-       u_int ca_device;
        u_int ca_function;
        cardbustag_t ca_tag;
        cardbusreg_t ca_id;
@@ -332,8 +327,8 @@
 #define Cardbus_mapreg_unmap(ct, reg, tag, handle, size) \
        cardbus_mapreg_unmap((ct)->ct_sc, (ct->ct_func), (reg), (tag), (handle), (size))
 
-#define Cardbus_make_tag(ct) (*(ct)->ct_cf->cardbus_make_tag)((ct)->ct_cc, (ct)->ct_bus, (ct)->ct_dev, (ct)->ct_func)
-#define cardbus_make_tag(cc, cf, bus, device, function) ((cf)->cardbus_make_tag)((cc), (bus), (device), (function))
+#define Cardbus_make_tag(ct) (*(ct)->ct_cf->cardbus_make_tag)((ct)->ct_cc, (ct)->ct_bus, (ct)->ct_func)
+#define cardbus_make_tag(cc, cf, bus, function) ((cf)->cardbus_make_tag)((cc), (bus), (function))
 
 #define Cardbus_free_tag(ct, tag) (*(ct)->ct_cf->cardbus_free_tag)((ct)->ct_cc, (tag))
 #define cardbus_free_tag(cc, cf, tag) (*(cf)->cardbus_free_tag)(cc, (tag))
diff -r 77b0d58fa480 -r 203380c92cd0 sys/dev/cardbus/ehci_cardbus.c
--- a/sys/dev/cardbus/ehci_cardbus.c    Fri Sep 09 14:11:39 2005 +0000
+++ b/sys/dev/cardbus/ehci_cardbus.c    Fri Sep 09 14:50:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci_cardbus.c,v 1.11 2005/02/27 00:26:59 perry Exp $  */
+/*     $NetBSD: ehci_cardbus.c,v 1.12 2005/09/09 14:50:58 drochner Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.11 2005/02/27 00:26:59 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.12 2005/09/09 14:50:58 drochner Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -182,7 +182,7 @@
         */
        ncomp = 0;
        TAILQ_FOREACH(up, &ehci_cardbus_alldevs, next) {
-               if (up->bus == ca->ca_bus && up->device == ca->ca_device) {
+               if (up->bus == ca->ca_bus) {
                        DPRINTF(("ehci_cardbus_attach: companion %s\n",
                                 USBDEVNAME(up->usb->bdev)));
                        sc->sc.sc_comps[ncomp++] = up->usb;
@@ -235,7 +235,6 @@
 {
        TAILQ_INSERT_TAIL(&ehci_cardbus_alldevs, up, next);
        up->bus = ca->ca_bus;
-       up->device = ca->ca_device;
        up->function = ca->ca_function;
        up->usb = bu;
 }
diff -r 77b0d58fa480 -r 203380c92cd0 sys/dev/cardbus/if_fxp_cardbus.c
--- a/sys/dev/cardbus/if_fxp_cardbus.c  Fri Sep 09 14:11:39 2005 +0000
+++ b/sys/dev/cardbus/if_fxp_cardbus.c  Fri Sep 09 14:50:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_fxp_cardbus.c,v 1.19 2005/02/04 02:10:36 perry Exp $        */
+/*     $NetBSD: if_fxp_cardbus.c,v 1.20 2005/09/09 14:50:58 drochner Exp $     */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.19 2005/02/04 02:10:36 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.20 2005/09/09 14:50:58 drochner Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -202,7 +202,7 @@
        pcireg_t command;
 
        cardbustag_t tag = cardbus_make_tag(cc, cf, csc->ct->ct_bus,
-           csc->ct->ct_dev, csc->ct->ct_func);
+           csc->ct->ct_func);
 
        command = Cardbus_conf_read(csc->ct, tag, CARDBUS_COMMAND_STATUS_REG);
        if (csc->base0_reg) {
diff -r 77b0d58fa480 -r 203380c92cd0 sys/dev/cardbus/if_tlp_cardbus.c
--- a/sys/dev/cardbus/if_tlp_cardbus.c  Fri Sep 09 14:11:39 2005 +0000
+++ b/sys/dev/cardbus/if_tlp_cardbus.c  Fri Sep 09 14:50:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tlp_cardbus.c,v 1.46 2005/06/13 15:27:41 tron Exp $ */
+/*     $NetBSD: if_tlp_cardbus.c,v 1.47 2005/09/09 14:50:58 drochner Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tlp_cardbus.c,v 1.46 2005/06/13 15:27:41 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tlp_cardbus.c,v 1.47 2005/09/09 14:50:58 drochner Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -261,7 +261,7 @@
        bus_addr_t adr;
        pcireg_t reg;
 
-       sc->sc_devno = ca->ca_device;



Home | Main Index | Thread Index | Old Index