Module Name: src
Committed By: tsutsui
Date: Fri Sep 18 12:23:16 UTC 2009
Modified Files:
src/sys/dev/sbus: be.c bwtwo_sbus.c cgthree_sbus.c cs4231_sbus.c
genfb_sbus.c if_en.c qe.c qec.c sio16.c stp4020.c xbox.c
Log Message:
- use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer
XXX: many inconsistent use of aprint_*(9) and printf(9)
To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/sbus/be.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sbus/bwtwo_sbus.c \
src/sys/dev/sbus/if_en.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sbus/cgthree_sbus.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/sbus/cs4231_sbus.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/sbus/genfb_sbus.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sbus/qe.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/sbus/qec.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sbus/sio16.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/sbus/stp4020.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/sbus/xbox.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/sbus/be.c
diff -u src/sys/dev/sbus/be.c:1.66 src/sys/dev/sbus/be.c:1.67
--- src/sys/dev/sbus/be.c:1.66 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/be.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: be.c,v 1.66 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: be.c,v 1.67 2009/09/18 12:23:16 tsutsui Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.66 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.67 2009/09/18 12:23:16 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@@ -219,8 +219,8 @@
beattach(device_t parent, device_t self, void *aux)
{
struct sbus_attach_args *sa = aux;
- struct qec_softc *qec = (struct qec_softc *)parent;
- struct be_softc *sc = (struct be_softc *)self;
+ struct qec_softc *qec = device_private(parent);
+ struct be_softc *sc = device_private(self);
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
struct mii_data *mii = &sc->sc_mii;
struct mii_softc *child;
@@ -368,7 +368,7 @@
if ((v & MGMT_PAL_EXT_MDIO) != 0) {
- mii_attach(&sc->sc_dev, mii, 0xffffffff, BE_PHY_EXTERNAL,
+ mii_attach(self, mii, 0xffffffff, BE_PHY_EXTERNAL,
MII_OFFSET_ANY, 0);
child = LIST_FIRST(&mii->mii_phys);
@@ -386,14 +386,16 @@
*/
#ifdef DIAGNOSTIC
if (LIST_NEXT(child, mii_list) != NULL) {
- aprint_error_dev(&sc->sc_dev, "spurious MII device %s attached\n",
- device_xname(child->mii_dev));
+ aprint_error_dev(self,
+ "spurious MII device %s attached\n",
+ device_xname(child->mii_dev));
}
#endif
if (child->mii_phy != BE_PHY_EXTERNAL ||
child->mii_inst > 0) {
- aprint_error_dev(&sc->sc_dev, "cannot accommodate MII device %s"
- " at phy %d, instance %d\n",
+ aprint_error_dev(self,
+ "cannot accommodate MII device %s"
+ " at phy %d, instance %d\n",
device_xname(child->mii_dev),
child->mii_phy, child->mii_inst);
} else {
@@ -446,11 +448,11 @@
ifmedia_set(&sc->sc_media,
IFM_MAKEWORD(IFM_ETHER,IFM_AUTO,0,instance));
} else
- be_mii_writereg((void *)sc,
+ be_mii_writereg(self,
BE_PHY_INTERNAL, MII_BMCR, BMCR_ISO);
}
- memcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
+ memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
ifp->if_softc = sc;
ifp->if_start = bestart;
ifp->if_ioctl = beioctl;
@@ -603,7 +605,7 @@
void
bestart(struct ifnet *ifp)
{
- struct be_softc *sc = (struct be_softc *)ifp->if_softc;
+ struct be_softc *sc = ifp->if_softc;
struct qec_xd *txd = sc->sc_rb.rb_txd;
struct mbuf *m;
unsigned int bix, len;
@@ -710,9 +712,9 @@
}
int
-beintr(void *v)
+beintr(void *arg)
{
- struct be_softc *sc = (struct be_softc *)v;
+ struct be_softc *sc = arg;
bus_space_tag_t t = sc->sc_bustag;
u_int32_t whyq, whyb, whyc;
int r = 0;
@@ -743,6 +745,7 @@
int
beqint(struct be_softc *sc, u_int32_t why)
{
+ device_t self = &sc->sc_dev;
int r = 0, rst = 0;
if (why & BE_CR_STAT_TXIRQ)
@@ -753,19 +756,19 @@
if (why & BE_CR_STAT_BERROR) {
r |= 1;
rst = 1;
- aprint_error_dev(&sc->sc_dev, "bigmac error\n");
+ aprint_error_dev(self, "bigmac error\n");
}
if (why & BE_CR_STAT_TXDERR) {
r |= 1;
rst = 1;
- aprint_error_dev(&sc->sc_dev, "bogus tx descriptor\n");
+ aprint_error_dev(self, "bogus tx descriptor\n");
}
if (why & (BE_CR_STAT_TXLERR | BE_CR_STAT_TXPERR | BE_CR_STAT_TXSERR)) {
r |= 1;
rst = 1;
- aprint_error_dev(&sc->sc_dev, "tx DMA error ( ");
+ aprint_error_dev(self, "tx DMA error ( ");
if (why & BE_CR_STAT_TXLERR)
printf("Late ");
if (why & BE_CR_STAT_TXPERR)
@@ -778,19 +781,19 @@
if (why & BE_CR_STAT_RXDROP) {
r |= 1;
rst = 1;
- aprint_error_dev(&sc->sc_dev, "out of rx descriptors\n");
+ aprint_error_dev(self, "out of rx descriptors\n");
}
if (why & BE_CR_STAT_RXSMALL) {
r |= 1;
rst = 1;
- aprint_error_dev(&sc->sc_dev, "rx descriptor too small\n");
+ aprint_error_dev(self, "rx descriptor too small\n");
}
if (why & (BE_CR_STAT_RXLERR | BE_CR_STAT_RXPERR | BE_CR_STAT_RXSERR)) {
r |= 1;
rst = 1;
- aprint_error_dev(&sc->sc_dev, "rx DMA error ( ");
+ aprint_error_dev(self, "rx DMA error ( ");
if (why & BE_CR_STAT_RXLERR)
printf("Late ");
if (why & BE_CR_STAT_RXPERR)
@@ -802,12 +805,12 @@
if (!r) {
rst = 1;
- aprint_error_dev(&sc->sc_dev, "unexpected error interrupt %08x\n",
+ aprint_error_dev(self, "unexpected error interrupt %08x\n",
why);
}
if (rst) {
- printf("%s: resetting\n", device_xname(&sc->sc_dev));
+ printf("%s: resetting\n", device_xname(self));
bereset(sc);
}
@@ -820,32 +823,33 @@
int
beeint(struct be_softc *sc, u_int32_t why)
{
+ device_t self = &sc->sc_dev;
int r = 0, rst = 0;
if (why & BE_BR_STAT_RFIFOVF) {
r |= 1;
rst = 1;
- aprint_error_dev(&sc->sc_dev, "receive fifo overrun\n");
+ aprint_error_dev(self, "receive fifo overrun\n");
}
if (why & BE_BR_STAT_TFIFO_UND) {
r |= 1;
rst = 1;
- aprint_error_dev(&sc->sc_dev, "transmit fifo underrun\n");
+ aprint_error_dev(self, "transmit fifo underrun\n");
}
if (why & BE_BR_STAT_MAXPKTERR) {
r |= 1;
rst = 1;
- aprint_error_dev(&sc->sc_dev, "max packet size error\n");
+ aprint_error_dev(self, "max packet size error\n");
}
if (!r) {
rst = 1;
- aprint_error_dev(&sc->sc_dev, "unexpected error interrupt %08x\n",
+ aprint_error_dev(self, "unexpected error interrupt %08x\n",
why);
}
if (rst) {
- printf("%s: resetting\n", device_xname(&sc->sc_dev));
+ printf("%s: resetting\n", device_xname(self));
bereset(sc);
}
@@ -950,8 +954,8 @@
beioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct be_softc *sc = ifp->if_softc;
- struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
+ struct ifaddr *ifa = data;
+ struct ifreq *ifr = data;
int s, error = 0;
s = splnet();
@@ -1320,7 +1324,7 @@
static int
be_mii_readreg(device_t self, int phy, int reg)
{
- struct be_softc *sc = (struct be_softc *)self;
+ struct be_softc *sc = device_private(self);
int val = 0, i;
/*
@@ -1348,7 +1352,7 @@
void
be_mii_writereg(device_t self, int phy, int reg, int val)
{
- struct be_softc *sc = (struct be_softc *)self;
+ struct be_softc *sc = device_private(self);
int i;
/*
@@ -1370,20 +1374,21 @@
int
be_mii_reset(struct be_softc *sc, int phy)
{
+ device_t self = &sc->sc_dev;
int n;
- be_mii_writereg((device_t)sc, phy, MII_BMCR,
+ be_mii_writereg(self, phy, MII_BMCR,
BMCR_LOOP | BMCR_PDOWN | BMCR_ISO);
- be_mii_writereg((device_t)sc, phy, MII_BMCR, BMCR_RESET);
+ be_mii_writereg(self, phy, MII_BMCR, BMCR_RESET);
for (n = 16; n >= 0; n--) {
- int bmcr = be_mii_readreg((device_t)sc, phy, MII_BMCR);
+ int bmcr = be_mii_readreg(self, phy, MII_BMCR);
if ((bmcr & BMCR_RESET) == 0)
break;
DELAY(20);
}
if (n == 0) {
- aprint_error_dev(&sc->sc_dev, "bmcr reset failed\n");
+ aprint_error_dev(self, "bmcr reset failed\n");
return (EIO);
}
@@ -1406,7 +1411,7 @@
void
be_mii_statchg(device_t self)
{
- struct be_softc *sc = (struct be_softc *)self;
+ struct be_softc *sc = device_private(self);
bus_space_tag_t t = sc->sc_bustag;
bus_space_handle_t br = sc->sc_br;
u_int instance;
@@ -1470,6 +1475,7 @@
be_intphy_service(struct be_softc *sc, struct mii_data *mii, int cmd)
{
struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
+ device_t self = &sc->sc_dev;
int bmcr, bmsr;
int error;
@@ -1490,10 +1496,9 @@
* isolate ourselves.
*/
if (IFM_INST(ife->ifm_media) != sc->sc_mii_inst) {
- bmcr = be_mii_readreg((void *)sc,
- BE_PHY_INTERNAL, MII_BMCR);
- be_mii_writereg((void *)sc,
- BE_PHY_INTERNAL, MII_BMCR, bmcr | BMCR_ISO);
+ bmcr = be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMCR);
+ be_mii_writereg(self,
+ BE_PHY_INTERNAL, MII_BMCR, bmcr | BMCR_ISO);
sc->sc_mii_flags &= ~MIIF_HAVELINK;
sc->sc_intphy_curspeed = 0;
return (0);
@@ -1503,7 +1508,7 @@
if ((error = be_mii_reset(sc, BE_PHY_INTERNAL)) != 0)
return (error);
- bmcr = be_mii_readreg((void *)sc, BE_PHY_INTERNAL, MII_BMCR);
+ bmcr = be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMCR);
/*
* Select the new mode and take out of isolation
@@ -1528,7 +1533,7 @@
else
bmcr &= ~BMCR_FDX;
- be_mii_writereg((void *)sc, BE_PHY_INTERNAL, MII_BMCR, bmcr);
+ be_mii_writereg(self, BE_PHY_INTERNAL, MII_BMCR, bmcr);
break;
case MII_TICK:
@@ -1553,29 +1558,28 @@
*/
/* Read twice in case the register is latched */
- bmsr = be_mii_readreg((void *)sc, BE_PHY_INTERNAL, MII_BMSR) |
- be_mii_readreg((void *)sc, BE_PHY_INTERNAL, MII_BMSR);
+ bmsr = be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMSR) |
+ be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMSR);
if ((bmsr & BMSR_LINK) != 0) {
/* We have a carrier */
- bmcr = be_mii_readreg((void *)sc,
- BE_PHY_INTERNAL, MII_BMCR);
+ bmcr = be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMCR);
if ((sc->sc_mii_flags & MIIF_DOINGAUTO) != 0) {
- bmcr = be_mii_readreg((void *)sc,
- BE_PHY_INTERNAL, MII_BMCR);
+ bmcr = be_mii_readreg(self,
+ BE_PHY_INTERNAL, MII_BMCR);
sc->sc_mii_flags |= MIIF_HAVELINK;
sc->sc_intphy_curspeed = (bmcr & BMCR_S100);
sc->sc_mii_flags &= ~MIIF_DOINGAUTO;
bmcr &= ~BMCR_ISO;
- be_mii_writereg((void *)sc,
- BE_PHY_INTERNAL, MII_BMCR, bmcr);
+ be_mii_writereg(self,
+ BE_PHY_INTERNAL, MII_BMCR, bmcr);
printf("%s: link up at %s Mbps\n",
- device_xname(&sc->sc_dev),
- (bmcr & BMCR_S100) ? "100" : "10");
+ device_xname(self),
+ (bmcr & BMCR_S100) ? "100" : "10");
}
return (0);
}
@@ -1584,7 +1588,7 @@
sc->sc_mii_flags |= MIIF_DOINGAUTO;
sc->sc_mii_flags &= ~MIIF_HAVELINK;
sc->sc_intphy_curspeed = 0;
- printf("%s: link down\n", device_xname(&sc->sc_dev));
+ printf("%s: link down\n", device_xname(self));
}
/* Only retry autonegotiation every 5 seconds. */
@@ -1592,18 +1596,18 @@
return(0);
sc->sc_mii_ticks = 0;
- bmcr = be_mii_readreg((void *)sc, BE_PHY_INTERNAL, MII_BMCR);
+ bmcr = be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMCR);
/* Just flip the fast speed bit */
bmcr ^= BMCR_S100;
- be_mii_writereg((void *)sc, BE_PHY_INTERNAL, MII_BMCR, bmcr);
+ be_mii_writereg(self, BE_PHY_INTERNAL, MII_BMCR, bmcr);
break;
case MII_DOWN:
/* Isolate this phy */
- bmcr = be_mii_readreg((void *)sc, BE_PHY_INTERNAL, MII_BMCR);
- be_mii_writereg((void *)sc,
- BE_PHY_INTERNAL, MII_BMCR, bmcr | BMCR_ISO);
+ bmcr = be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMCR);
+ be_mii_writereg(self,
+ BE_PHY_INTERNAL, MII_BMCR, bmcr | BMCR_ISO);
return (0);
}
@@ -1612,7 +1616,7 @@
/* Callback if something changed. */
if (sc->sc_mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
- (*mii->mii_statchg)((device_t)sc);
+ (*mii->mii_statchg)(self);
sc->sc_mii_active = mii->mii_media_active;
}
return (0);
@@ -1625,6 +1629,7 @@
be_intphy_status(struct be_softc *sc)
{
struct mii_data *mii = &sc->sc_mii;
+ device_t self = &sc->sc_dev;
int media_active, media_status;
int bmcr, bmsr;
@@ -1634,7 +1639,7 @@
/*
* Internal transceiver; do the work here.
*/
- bmcr = be_mii_readreg((device_t)sc, BE_PHY_INTERNAL, MII_BMCR);
+ bmcr = be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMCR);
switch (bmcr & (BMCR_S100 | BMCR_FDX)) {
case (BMCR_S100 | BMCR_FDX):
@@ -1652,8 +1657,8 @@
}
/* Read twice in case the register is latched */
- bmsr = be_mii_readreg((device_t)sc, BE_PHY_INTERNAL, MII_BMSR)|
- be_mii_readreg((device_t)sc, BE_PHY_INTERNAL, MII_BMSR);
+ bmsr = be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMSR)|
+ be_mii_readreg(self, BE_PHY_INTERNAL, MII_BMSR);
if (bmsr & BMSR_LINK)
media_status |= IFM_ACTIVE;
Index: src/sys/dev/sbus/bwtwo_sbus.c
diff -u src/sys/dev/sbus/bwtwo_sbus.c:1.26 src/sys/dev/sbus/bwtwo_sbus.c:1.27
--- src/sys/dev/sbus/bwtwo_sbus.c:1.26 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/bwtwo_sbus.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: bwtwo_sbus.c,v 1.26 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: bwtwo_sbus.c,v 1.27 2009/09/18 12:23:16 tsutsui Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bwtwo_sbus.c,v 1.26 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwtwo_sbus.c,v 1.27 2009/09/18 12:23:16 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -130,7 +130,7 @@
void
bwtwoattach_sbus(device_t parent, device_t self, void *args)
{
- struct bwtwo_softc *sc = (struct bwtwo_softc *)self;
+ struct bwtwo_softc *sc = device_private(self);
struct sbus_attach_args *sa = args;
struct fbdevice *fb = &sc->sc_fb;
bus_space_handle_t bh;
@@ -143,7 +143,7 @@
sc->sc_bustag = sa->sa_bustag;
sc->sc_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_slot, sa->sa_offset);
- fb->fb_flags = device_cfdata(&sc->sc_dev)->cf_flags;
+ fb->fb_flags = device_cfdata(self)->cf_flags;
fb->fb_type.fb_depth = 1;
fb_setsize_obp(fb, fb->fb_type.fb_depth, 1152, 900, node);
Index: src/sys/dev/sbus/if_en.c
diff -u src/sys/dev/sbus/if_en.c:1.26 src/sys/dev/sbus/if_en.c:1.27
--- src/sys/dev/sbus/if_en.c:1.26 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/if_en.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_en.c,v 1.26 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: if_en.c,v 1.27 2009/09/18 12:23:16 tsutsui Exp $ */
/*
*
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_en.c,v 1.26 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_en.c,v 1.27 2009/09/18 12:23:16 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -118,7 +118,7 @@
en_sbus_attach(device_t parent, device_t self, void *aux)
{
struct sbus_attach_args *sa = aux;
- struct en_sbus_softc *ssc = (void *)self;
+ struct en_sbus_softc *ssc = device_private(self);
struct en_softc *sc = &ssc->sc_en;
printf("\n");
Index: src/sys/dev/sbus/cgthree_sbus.c
diff -u src/sys/dev/sbus/cgthree_sbus.c:1.27 src/sys/dev/sbus/cgthree_sbus.c:1.28
--- src/sys/dev/sbus/cgthree_sbus.c:1.27 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/cgthree_sbus.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: cgthree_sbus.c,v 1.27 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: cgthree_sbus.c,v 1.28 2009/09/18 12:23:16 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgthree_sbus.c,v 1.27 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgthree_sbus.c,v 1.28 2009/09/18 12:23:16 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -131,7 +131,7 @@
void
cgthreeattach_sbus(device_t parent, device_t self, void *args)
{
- struct cgthree_softc *sc = (struct cgthree_softc *)self;
+ struct cgthree_softc *sc = device_private(self);
struct sbus_attach_args *sa = args;
struct fbdevice *fb = &sc->sc_fb;
int node = sa->sa_node;
@@ -143,8 +143,8 @@
sc->sc_bustag = sa->sa_bustag;
sc->sc_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_slot, sa->sa_offset);
- fb->fb_device = &sc->sc_dev;
- fb->fb_flags = device_cfdata(&sc->sc_dev)->cf_flags & FB_USERMASK;
+ fb->fb_device = self;
+ fb->fb_flags = device_cfdata(self)->cf_flags & FB_USERMASK;
fb->fb_type.fb_type = FBTYPE_SUN3COLOR;
fb->fb_type.fb_depth = 8;
Index: src/sys/dev/sbus/cs4231_sbus.c
diff -u src/sys/dev/sbus/cs4231_sbus.c:1.46 src/sys/dev/sbus/cs4231_sbus.c:1.47
--- src/sys/dev/sbus/cs4231_sbus.c:1.46 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/cs4231_sbus.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: cs4231_sbus.c,v 1.46 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: cs4231_sbus.c,v 1.47 2009/09/18 12:23:16 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 1999, 2002, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.46 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.47 2009/09/18 12:23:16 tsutsui Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -154,7 +154,7 @@
struct sbus_attach_args *sa;
bus_space_handle_t bh;
- sbsc = (struct cs4231_sbus_softc *)self;
+ sbsc = device_private(self);
sc = &sbsc->sc_cs4231;
sa = aux;
sbsc->sc_bt = sc->sc_bustag = sa->sa_bustag;
@@ -193,7 +193,7 @@
sa->sa_pri, IPL_SCHED,
cs4231_sbus_intr, sbsc);
- audio_attach_mi(&audiocs_sbus_hw_if, sbsc, &sc->sc_ad1848.sc_dev);
+ audio_attach_mi(&audiocs_sbus_hw_if, sbsc, self);
}
Index: src/sys/dev/sbus/genfb_sbus.c
diff -u src/sys/dev/sbus/genfb_sbus.c:1.8 src/sys/dev/sbus/genfb_sbus.c:1.9
--- src/sys/dev/sbus/genfb_sbus.c:1.8 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/genfb_sbus.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_sbus.c,v 1.8 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: genfb_sbus.c,v 1.9 2009/09/18 12:23:16 tsutsui Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -29,7 +29,7 @@
/* an SBus frontend for the generic fb console driver */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_sbus.c,v 1.8 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_sbus.c,v 1.9 2009/09/18 12:23:16 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -69,7 +69,7 @@
* Match a graphics device.
*/
static int
-genfb_match_sbus(device_t parent, cfdata_t cf, void *aux)
+genfb_match_sbus(device_t parent, cfdata_t cf, void *aux)
{
struct sbus_attach_args *sa = aux;
@@ -89,7 +89,7 @@
static void
genfb_attach_sbus(device_t parent, device_t self, void *args)
{
- struct genfb_sbus_softc *sc = (struct genfb_sbus_softc *)self;
+ struct genfb_sbus_softc *sc = device_private(self);
struct sbus_attach_args *sa = args;
struct genfb_ops ops;
prop_dictionary_t dict;
Index: src/sys/dev/sbus/qe.c
diff -u src/sys/dev/sbus/qe.c:1.52 src/sys/dev/sbus/qe.c:1.53
--- src/sys/dev/sbus/qe.c:1.52 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/qe.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: qe.c,v 1.52 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: qe.c,v 1.53 2009/09/18 12:23:16 tsutsui Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.52 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.53 2009/09/18 12:23:16 tsutsui Exp $");
#define QEDEBUG
@@ -187,8 +187,8 @@
qeattach(device_t parent, device_t self, void *aux)
{
struct sbus_attach_args *sa = aux;
- struct qec_softc *qec = (struct qec_softc *)parent;
- struct qe_softc *sc = (struct qe_softc *)self;
+ struct qec_softc *qec = device_private(parent);
+ struct qe_softc *sc = device_private(self);
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
int node = sa->sa_node;
bus_dma_tag_t dmatag = sa->sa_dmatag;
@@ -303,7 +303,7 @@
0, NULL);
ifmedia_set(&sc->sc_ifmedia, IFM_ETHER|IFM_AUTO);
- memcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
+ memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
ifp->if_softc = sc;
ifp->if_start = qestart;
ifp->if_ioctl = qeioctl;
@@ -452,7 +452,7 @@
void
qestart(struct ifnet *ifp)
{
- struct qe_softc *sc = (struct qe_softc *)ifp->if_softc;
+ struct qe_softc *sc = ifp->if_softc;
struct qec_xd *txd = sc->sc_rb.rb_txd;
struct mbuf *m;
unsigned int bix, len;
@@ -563,7 +563,7 @@
int
qeintr(void *arg)
{
- struct qe_softc *sc = (struct qe_softc *)arg;
+ struct qe_softc *sc = arg;
bus_space_tag_t t = sc->sc_bustag;
u_int32_t qecstat, qestat;
int r = 0;
@@ -721,22 +721,23 @@
qe_eint(struct qe_softc *sc, u_int32_t why)
{
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+ device_t self = &sc->sc_dev;
int r = 0, rst = 0;
if (why & QE_CR_STAT_EDEFER) {
- printf("%s: excessive tx defers.\n", device_xname(&sc->sc_dev));
+ printf("%s: excessive tx defers.\n", device_xname(self));
r |= 1;
ifp->if_oerrors++;
}
if (why & QE_CR_STAT_CLOSS) {
- printf("%s: no carrier, link down?\n", device_xname(&sc->sc_dev));
+ printf("%s: no carrier, link down?\n", device_xname(self));
ifp->if_oerrors++;
r |= 1;
}
if (why & QE_CR_STAT_ERETRIES) {
- printf("%s: excessive tx retries\n", device_xname(&sc->sc_dev));
+ printf("%s: excessive tx retries\n", device_xname(self));
ifp->if_oerrors++;
r |= 1;
rst = 1;
@@ -744,26 +745,26 @@
if (why & QE_CR_STAT_LCOLL) {
- printf("%s: late tx transmission\n", device_xname(&sc->sc_dev));
+ printf("%s: late tx transmission\n", device_xname(self));
ifp->if_oerrors++;
r |= 1;
rst = 1;
}
if (why & QE_CR_STAT_FUFLOW) {
- printf("%s: tx fifo underflow\n", device_xname(&sc->sc_dev));
+ printf("%s: tx fifo underflow\n", device_xname(self));
ifp->if_oerrors++;
r |= 1;
rst = 1;
}
if (why & QE_CR_STAT_JERROR) {
- printf("%s: jabber seen\n", device_xname(&sc->sc_dev));
+ printf("%s: jabber seen\n", device_xname(self));
r |= 1;
}
if (why & QE_CR_STAT_BERROR) {
- printf("%s: babble seen\n", device_xname(&sc->sc_dev));
+ printf("%s: babble seen\n", device_xname(self));
r |= 1;
}
@@ -774,27 +775,27 @@
}
if (why & QE_CR_STAT_TXDERROR) {
- printf("%s: tx descriptor is bad\n", device_xname(&sc->sc_dev));
+ printf("%s: tx descriptor is bad\n", device_xname(self));
rst = 1;
r |= 1;
}
if (why & QE_CR_STAT_TXLERR) {
- printf("%s: tx late error\n", device_xname(&sc->sc_dev));
+ printf("%s: tx late error\n", device_xname(self));
ifp->if_oerrors++;
rst = 1;
r |= 1;
}
if (why & QE_CR_STAT_TXPERR) {
- printf("%s: tx DMA parity error\n", device_xname(&sc->sc_dev));
+ printf("%s: tx DMA parity error\n", device_xname(self));
ifp->if_oerrors++;
rst = 1;
r |= 1;
}
if (why & QE_CR_STAT_TXSERR) {
- printf("%s: tx DMA sbus error ack\n", device_xname(&sc->sc_dev));
+ printf("%s: tx DMA sbus error ack\n", device_xname(self));
ifp->if_oerrors++;
rst = 1;
r |= 1;
@@ -817,13 +818,13 @@
}
if (why & QE_CR_STAT_RXFOFLOW) {
- printf("%s: rx fifo overflow\n", device_xname(&sc->sc_dev));
+ printf("%s: rx fifo overflow\n", device_xname(self));
ifp->if_ierrors++;
r |= 1;
}
if (why & QE_CR_STAT_RLCOLL) {
- printf("%s: rx late collision\n", device_xname(&sc->sc_dev));
+ printf("%s: rx late collision\n", device_xname(self));
ifp->if_ierrors++;
ifp->if_collisions++;
r |= 1;
@@ -840,45 +841,45 @@
}
if (why & QE_CR_STAT_RXDROP) {
- printf("%s: rx packet dropped\n", device_xname(&sc->sc_dev));
+ printf("%s: rx packet dropped\n", device_xname(self));
ifp->if_ierrors++;
r |= 1;
}
if (why & QE_CR_STAT_RXSMALL) {
- printf("%s: rx buffer too small\n", device_xname(&sc->sc_dev));
+ printf("%s: rx buffer too small\n", device_xname(self));
ifp->if_ierrors++;
r |= 1;
rst = 1;
}
if (why & QE_CR_STAT_RXLERR) {
- printf("%s: rx late error\n", device_xname(&sc->sc_dev));
+ printf("%s: rx late error\n", device_xname(self));
ifp->if_ierrors++;
r |= 1;
rst = 1;
}
if (why & QE_CR_STAT_RXPERR) {
- printf("%s: rx DMA parity error\n", device_xname(&sc->sc_dev));
+ printf("%s: rx DMA parity error\n", device_xname(self));
ifp->if_ierrors++;
r |= 1;
rst = 1;
}
if (why & QE_CR_STAT_RXSERR) {
- printf("%s: rx DMA sbus error ack\n", device_xname(&sc->sc_dev));
+ printf("%s: rx DMA sbus error ack\n", device_xname(self));
ifp->if_ierrors++;
r |= 1;
rst = 1;
}
if (r == 0)
- aprint_error_dev(&sc->sc_dev, "unexpected interrupt error: %08x\n",
+ aprint_error_dev(self, "unexpected interrupt error: %08x\n",
why);
if (rst) {
- printf("%s: resetting...\n", device_xname(&sc->sc_dev));
+ printf("%s: resetting...\n", device_xname(self));
qereset(sc);
return (-1);
}
@@ -890,8 +891,8 @@
qeioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct qe_softc *sc = ifp->if_softc;
- struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
+ struct ifaddr *ifa = data;
+ struct ifreq *ifr = data;
int s, error = 0;
s = splnet();
Index: src/sys/dev/sbus/qec.c
diff -u src/sys/dev/sbus/qec.c:1.45 src/sys/dev/sbus/qec.c:1.46
--- src/sys/dev/sbus/qec.c:1.45 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/qec.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: qec.c,v 1.45 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: qec.c,v 1.46 2009/09/18 12:23:16 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: qec.c,v 1.45 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qec.c,v 1.46 2009/09/18 12:23:16 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -98,7 +98,7 @@
qecattach(device_t parent, device_t self, void *aux)
{
struct sbus_attach_args *sa = aux;
- struct qec_softc *sc = (void *)self;
+ struct qec_softc *sc = device_private(self);
struct sbus_softc *sbsc = device_private(parent);
int node;
int sbusburst;
@@ -206,7 +206,7 @@
struct sbus_attach_args sax;
sbus_setup_attach_args(sbsc,
sbt, sc->sc_dmatag, node, &sax);
- (void)config_found(&sc->sc_dev, (void *)&sax, qecprint);
+ (void)config_found(self, (void *)&sax, qecprint);
sbus_destroy_attach_args(&sax);
}
}
Index: src/sys/dev/sbus/sio16.c
diff -u src/sys/dev/sbus/sio16.c:1.22 src/sys/dev/sbus/sio16.c:1.23
--- src/sys/dev/sbus/sio16.c:1.22 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/sio16.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sio16.c,v 1.22 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: sio16.c,v 1.23 2009/09/18 12:23:16 tsutsui Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sio16.c,v 1.22 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sio16.c,v 1.23 2009/09/18 12:23:16 tsutsui Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -125,7 +125,7 @@
sio16_attach(device_t parent, device_t self, void *aux)
{
struct sbus_attach_args *sa = aux;
- struct sio16_softc *sc = (struct sio16_softc *)self;
+ struct sio16_softc *sc = device_private(self);
bus_space_handle_t h;
char *mode, *model;
int i;
@@ -281,7 +281,7 @@
static void
clcd_attach(device_t parent, device_t self, void *aux)
{
- struct cd18xx_softc *sc = (struct cd18xx_softc *)self;
+ struct cd18xx_softc *sc = device_private(self);
struct sio16_attach_args *args = aux;
sc->sc_tag = args->cd_tag;
Index: src/sys/dev/sbus/stp4020.c
diff -u src/sys/dev/sbus/stp4020.c:1.62 src/sys/dev/sbus/stp4020.c:1.63
--- src/sys/dev/sbus/stp4020.c:1.62 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/stp4020.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: stp4020.c,v 1.62 2009/09/17 16:28:12 tsutsui Exp $ */
+/* $NetBSD: stp4020.c,v 1.63 2009/09/18 12:23:16 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.62 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.63 2009/09/18 12:23:16 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -325,7 +325,7 @@
stp4020attach(device_t parent, device_t self, void *aux)
{
struct sbus_attach_args *sa = aux;
- struct stp4020_softc *sc = (void *)self;
+ struct stp4020_softc *sc = device_private(self);
bus_space_tag_t tag;
int rev, i, sbus_intno, hw_ipl;
bus_space_handle_t bh;
Index: src/sys/dev/sbus/xbox.c
diff -u src/sys/dev/sbus/xbox.c:1.19 src/sys/dev/sbus/xbox.c:1.20
--- src/sys/dev/sbus/xbox.c:1.19 Tue May 12 14:43:59 2009
+++ src/sys/dev/sbus/xbox.c Fri Sep 18 12:23:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: xbox.c,v 1.19 2009/05/12 14:43:59 cegger Exp $ */
+/* $NetBSD: xbox.c,v 1.20 2009/09/18 12:23:16 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbox.c,v 1.19 2009/05/12 14:43:59 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbox.c,v 1.20 2009/09/18 12:23:16 tsutsui Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@@ -122,7 +122,7 @@
void
xbox_attach(device_t parent, device_t self, void *aux)
{
- struct xbox_softc *sc = (struct xbox_softc *)self;
+ struct xbox_softc *sc = device_private(self);
struct sbus_attach_args *sa = aux;
int node = sa->sa_node;
struct xbox_attach_args xa;
@@ -150,5 +150,5 @@
xa.xa_bustag = sa->sa_bustag;
xa.xa_dmatag = sa->sa_dmatag;
- (void) config_found(&sc->sc_dev, (void *)&xa, xbox_print);
+ (void) config_found(self, (void *)&xa, xbox_print);
}