Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pcmcia device_t/softc split.
details: https://anonhg.NetBSD.org/src/rev/f482522b771a
branches: trunk
changeset: 749742:f482522b771a
user: dyoung <dyoung%NetBSD.org@localhost>
date: Sun Dec 06 23:05:39 2009 +0000
description:
device_t/softc split.
diffstat:
sys/dev/pcmcia/if_xi.c | 22 +++++++++++-----------
sys/dev/pcmcia/if_xivar.h | 4 ++--
sys/dev/pcmcia/mhzc.c | 27 ++++++++++++++-------------
sys/dev/pcmcia/pcmcom.c | 10 ++++++----
sys/dev/pcmcia/xirc.c | 26 ++++++++++++++------------
5 files changed, 47 insertions(+), 42 deletions(-)
diffs (truncated from 358 to 300 lines):
diff -r 4554a776471d -r f482522b771a sys/dev/pcmcia/if_xi.c
--- a/sys/dev/pcmcia/if_xi.c Sun Dec 06 23:05:06 2009 +0000
+++ b/sys/dev/pcmcia/if_xi.c Sun Dec 06 23:05:39 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xi.c,v 1.68 2009/11/13 01:14:35 dyoung Exp $ */
+/* $NetBSD: if_xi.c,v 1.69 2009/12/06 23:05:39 dyoung Exp $ */
/* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */
/*
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.68 2009/11/13 01:14:35 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.69 2009/12/06 23:05:39 dyoung Exp $");
#include "opt_inet.h"
#include "opt_ipx.h"
@@ -211,11 +211,11 @@
/* Reset and initialize the card. */
xi_full_reset(sc);
- printf("%s: MAC address %s\n", device_xname(&sc->sc_dev), ether_sprintf(myea));
+ printf("%s: MAC address %s\n", device_xname(sc->sc_dev), ether_sprintf(myea));
ifp = &sc->sc_ethercom.ec_if;
/* Initialize the ifnet structure. */
- strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
+ strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
ifp->if_softc = sc;
ifp->if_start = xi_start;
ifp->if_ioctl = xi_ioctl;
@@ -242,9 +242,9 @@
ifmedia_init(&sc->sc_mii.mii_media, 0, xi_mediachange,
ether_mediastatus);
DPRINTF(XID_MII | XID_CONFIG,
- ("xi: bmsr %x\n", xi_mdi_read(&sc->sc_dev, 0, 1)));
+ ("xi: bmsr %x\n", xi_mdi_read(sc->sc_dev, 0, 1)));
- mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
+ mii_attach(sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
MII_OFFSET_ANY, 0);
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL)
ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO, 0,
@@ -252,7 +252,7 @@
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO);
#if NRND > 0
- rnd_attach_source(&sc->sc_rnd_source, device_xname(&sc->sc_dev), RND_TYPE_NET, 0);
+ rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0);
#endif
}
@@ -288,8 +288,7 @@
DPRINTF(XID_CONFIG, ("xi_intr()\n"));
- if (sc->sc_enabled == 0 ||
- !device_is_active(&sc->sc_dev))
+ if (sc->sc_enabled == 0 || !device_is_active(sc->sc_dev))
return (0);
ifp->if_timer = 0; /* turn watchdog timer off */
@@ -307,7 +306,8 @@
/* Check to see if card has been ejected. */
if (isr == 0xff) {
#ifdef DIAGNOSTIC
- printf("%s: interrupt for dead card\n", device_xname(&sc->sc_dev));
+ printf("%s: interrupt for dead card\n",
+ device_xname(sc->sc_dev));
#endif
goto end;
}
@@ -664,7 +664,7 @@
{
struct xi_softc *sc = ifp->if_softc;
- printf("%s: device timeout\n", device_xname(&sc->sc_dev));
+ printf("%s: device timeout\n", device_xname(sc->sc_dev));
++ifp->if_oerrors;
xi_reset(sc);
diff -r 4554a776471d -r f482522b771a sys/dev/pcmcia/if_xivar.h
--- a/sys/dev/pcmcia/if_xivar.h Sun Dec 06 23:05:06 2009 +0000
+++ b/sys/dev/pcmcia/if_xivar.h Sun Dec 06 23:05:39 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xivar.h,v 1.5 2009/05/12 14:42:18 cegger Exp $ */
+/* $NetBSD: if_xivar.h,v 1.6 2009/12/06 23:05:39 dyoung Exp $ */
/*
* Copyright (c) 2004 Charles M. Hannum. All rights reserved.
@@ -25,7 +25,7 @@
#endif
struct xi_softc {
- struct device sc_dev; /* Generic device info */
+ device_t sc_dev; /* Generic device info */
struct ethercom sc_ethercom; /* Ethernet common part */
struct mii_data sc_mii; /* MII media information */
diff -r 4554a776471d -r f482522b771a sys/dev/pcmcia/mhzc.c
--- a/sys/dev/pcmcia/mhzc.c Sun Dec 06 23:05:06 2009 +0000
+++ b/sys/dev/pcmcia/mhzc.c Sun Dec 06 23:05:39 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mhzc.c,v 1.47 2009/11/13 01:14:35 dyoung Exp $ */
+/* $NetBSD: mhzc.c,v 1.48 2009/12/06 23:05:39 dyoung Exp $ */
/*-
* Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mhzc.c,v 1.47 2009/11/13 01:14:35 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mhzc.c,v 1.48 2009/12/06 23:05:39 dyoung Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@@ -95,7 +95,7 @@
#include "mhzc.h"
struct mhzc_softc {
- struct device sc_dev; /* generic device glue */
+ device_t sc_dev; /* generic device glue */
struct pcmcia_function *sc_pf; /* our PCMCIA function */
void *sc_ih; /* interrupt handle */
@@ -132,8 +132,8 @@
void mhzc_childdet(device_t, device_t);
int mhzc_detach(device_t, int);
-CFATTACH_DECL(mhzc, sizeof(struct mhzc_softc),
- mhzc_match, mhzc_attach, mhzc_detach, NULL);
+CFATTACH_DECL2_NEW(mhzc, sizeof(struct mhzc_softc),
+ mhzc_match, mhzc_attach, mhzc_detach, NULL, NULL, mhzc_childdet);
int mhzc_em3336_enaddr(struct mhzc_softc *, u_int8_t *);
int mhzc_em3336_enable(struct mhzc_softc *);
@@ -183,6 +183,7 @@
struct pcmcia_config_entry *cfe;
int error;
+ sc->sc_dev = self;
sc->sc_pf = pa->pf;
sc->sc_product = pcmcia_product_lookup(pa, mhzc_products,
@@ -232,14 +233,14 @@
if (pcmcia_io_map(sc->sc_pf, PCMCIA_WIDTH_IO8, &sc->sc_modem_pcioh,
&sc->sc_modem_io_window)) {
- aprint_error_dev(&sc->sc_dev, "unable to map I/O space\n");
+ aprint_error_dev(sc->sc_dev, "unable to map I/O space\n");
goto fail;
}
sc->sc_flags |= MHZC_MODEM_MAPPED;
if (pcmcia_io_map(sc->sc_pf, PCMCIA_WIDTH_AUTO, &sc->sc_ethernet_pcioh,
&sc->sc_ethernet_io_window)) {
- aprint_error_dev(&sc->sc_dev, "unable to map I/O space\n");
+ aprint_error_dev(sc->sc_dev, "unable to map I/O space\n");
goto fail;
}
sc->sc_flags |= MHZC_ETHERNET_MAPPED;
@@ -393,7 +394,7 @@
int error;
if ((sc->sc_flags & flag) == flag) {
- printf("%s: already enabled\n", device_xname(&sc->sc_dev));
+ printf("%s: already enabled\n", device_xname(sc->sc_dev));
return (0);
}
@@ -443,7 +444,7 @@
{
if ((sc->sc_flags & flag) == 0) {
- printf("%s: already disabled\n", device_xname(&sc->sc_dev));
+ printf("%s: already disabled\n", device_xname(sc->sc_dev));
return;
}
@@ -468,10 +469,10 @@
{
/* Get the station address from CIS tuple 0x81. */
- if (pcmcia_scan_cis(device_parent(&sc->sc_dev),
+ if (pcmcia_scan_cis(device_parent(sc->sc_dev),
mhzc_em3336_lannid_ciscallback, myla) != 1) {
printf("%s: unable to get Ethernet address from CIS\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
return (0);
}
@@ -493,13 +494,13 @@
/* Map the ISRPOWEREG. */
if (pcmcia_mem_alloc(sc->sc_pf, 0x1000, &memh) != 0) {
- aprint_error_dev(&sc->sc_dev, "unable to allocate memory space\n");
+ aprint_error_dev(sc->sc_dev, "unable to allocate memory space\n");
return (1);
}
if (pcmcia_mem_map(sc->sc_pf, PCMCIA_MEM_ATTR, 0, 0x1000,
&memh, &memoff, &memwin)) {
- aprint_error_dev(&sc->sc_dev, "unable to map memory space\n");
+ aprint_error_dev(sc->sc_dev, "unable to map memory space\n");
pcmcia_mem_free(sc->sc_pf, &memh);
return (1);
}
diff -r 4554a776471d -r f482522b771a sys/dev/pcmcia/pcmcom.c
--- a/sys/dev/pcmcia/pcmcom.c Sun Dec 06 23:05:06 2009 +0000
+++ b/sys/dev/pcmcia/pcmcom.c Sun Dec 06 23:05:39 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcmcom.c,v 1.38 2009/11/12 22:46:47 dyoung Exp $ */
+/* $NetBSD: pcmcom.c,v 1.39 2009/12/06 23:05:39 dyoung Exp $ */
/*-
* Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.38 2009/11/12 22:46:47 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.39 2009/12/06 23:05:39 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,7 +68,7 @@
#include "locators.h"
struct pcmcom_softc {
- struct device sc_dev; /* generic device glue */
+ device_t sc_dev; /* generic device glue */
struct pcmcia_function *sc_pf; /* our PCMCIA function */
void *sc_ih; /* interrupt handle */
@@ -144,6 +144,8 @@
int error;
int locs[PCMCOMCF_NLOCS];
+ sc->sc_dev = self;
+
sc->sc_pf = pa->pf;
error = pcmcia_function_configure(pa->pf, pcmcom_validate_config);
@@ -171,7 +173,7 @@
locs[PCMCOMCF_SLAVE] = slave;
- sc->sc_slaves[slave] = config_found_sm_loc(&sc->sc_dev,
+ sc->sc_slaves[slave] = config_found_sm_loc(sc->sc_dev,
"pcmcom", locs,
&pca, pcmcom_print, config_stdsubmatch);
}
diff -r 4554a776471d -r f482522b771a sys/dev/pcmcia/xirc.c
--- a/sys/dev/pcmcia/xirc.c Sun Dec 06 23:05:06 2009 +0000
+++ b/sys/dev/pcmcia/xirc.c Sun Dec 06 23:05:39 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xirc.c,v 1.30 2009/11/13 01:14:35 dyoung Exp $ */
+/* $NetBSD: xirc.c,v 1.31 2009/12/06 23:05:39 dyoung Exp $ */
/*-
* Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xirc.c,v 1.30 2009/11/13 01:14:35 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xirc.c,v 1.31 2009/12/06 23:05:39 dyoung Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@@ -89,7 +89,7 @@
#include <dev/pcmcia/if_xireg.h>
struct xirc_softc {
- struct device sc_dev; /* generic device glue */
+ device_t sc_dev; /* generic device glue */
struct pcmcia_function *sc_pf; /* our PCMCIA function */
void *sc_ih; /* interrupt handle */
@@ -126,8 +126,8 @@
int xirc_detach(device_t, int);
void xirc_childdet(device_t, device_t);
-CFATTACH_DECL(xirc, sizeof(struct xirc_softc),
- xirc_match, xirc_attach, xirc_detach, NULL);
+CFATTACH_DECL2_NEW(xirc, sizeof(struct xirc_softc),
+ xirc_match, xirc_attach, xirc_detach, NULL, NULL, xirc_childdet);
int xirc_print(void *, const char *);
@@ -176,6 +176,8 @@
int rv;
int error;
+ sc->sc_dev = self;
+
sc->sc_pf = pa->pf;
Home |
Main Index |
Thread Index |
Old Index