summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2006-10-02 18:06:56 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2006-10-02 18:06:56 +0000
commitc9142000c8a468c1ede0c2d9c04d5fe40d7dc48c (patch)
treee70ab4d74a6e69eaff6f4c44b44c18d62f093396 /sys
parent1f0271fc9463564fc7b6cadfb18f7785f4b34a9d (diff)
Simplify device attachment. From brad@ with a tiny correction.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/cardbus/if_pgt_cardbus.c4
-rw-r--r--sys/dev/ic/pgt.c30
-rw-r--r--sys/dev/ic/pgtvar.h5
-rw-r--r--sys/dev/pci/if_pgt_pci.c4
4 files changed, 15 insertions, 28 deletions
diff --git a/sys/dev/cardbus/if_pgt_cardbus.c b/sys/dev/cardbus/if_pgt_cardbus.c
index b84a7600fae..58180722899 100644
--- a/sys/dev/cardbus/if_pgt_cardbus.c
+++ b/sys/dev/cardbus/if_pgt_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pgt_cardbus.c,v 1.1 2006/09/28 05:02:33 mglocker Exp $ */
+/* $OpenBSD: if_pgt_cardbus.c,v 1.2 2006/10/02 18:06:55 mglocker Exp $ */
/*
* Copyright (c) 2006 Marcus Glocker <mglocker@openbsd.org>
@@ -138,7 +138,7 @@ pgt_cardbus_attach(struct device *parent, struct device *self, void *aux)
printf(": irq %d\n", csc->sc_intrline);
if (rootvp == NULL)
- mountroothook_establish(pgt_attachhook, sc);
+ mountroothook_establish(pgt_attach, sc);
else
pgt_attach(sc);
diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c
index 856db67a74a..8fbd6435cec 100644
--- a/sys/dev/ic/pgt.c
+++ b/sys/dev/ic/pgt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pgt.c,v 1.20 2006/10/01 22:03:25 claudio Exp $ */
+/* $OpenBSD: pgt.c,v 1.21 2006/10/02 18:06:55 mglocker Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -205,14 +205,6 @@ void pgt_dma_free(struct pgt_softc *);
void pgt_dma_free_queue(struct pgt_softc *sc, enum pgt_queue pq);
void
-pgt_attachhook(void *xsc)
-{
- struct pgt_softc *sc = xsc;
-
- pgt_attach(sc);
-}
-
-void
pgt_write_memory_barrier(struct pgt_softc *sc)
{
bus_space_barrier(sc->sc_iotag, sc->sc_iohandle, 0, 0,
@@ -581,9 +573,10 @@ trying_again:
ieee80211_new_state(&sc->sc_ic, IEEE80211_S_INIT, -1);
}
-int
-pgt_attach(struct pgt_softc *sc)
+void
+pgt_attach(void *xsc)
{
+ struct pgt_softc *sc = xsc;
int error;
/* debug flags */
@@ -602,7 +595,7 @@ pgt_attach(struct pgt_softc *sc)
error = pgt_dma_alloc(sc);
if (error)
- return (error);
+ return;
sc->sc_ic.ic_if.if_softc = sc;
TAILQ_INIT(&sc->sc_mgmtinprog);
@@ -613,32 +606,27 @@ pgt_attach(struct pgt_softc *sc)
error = pgt_reset(sc);
if (error)
- return (error);
+ return;
tsleep(&sc->sc_flags, 0, "pftres", hz);
if (sc->sc_flags & SC_UNINITIALIZED) {
printf("%s: not responding\n", sc->sc_dev.dv_xname);
- error = ETIMEDOUT;
+ return;
} else {
/* await all interrupts */
pgt_write_4_flush(sc, PGT_REG_INT_EN, PGT_INT_STAT_SOURCES);
DELAY(PGT_WRITEIO_DELAY);
}
- if (error)
- goto failed;
error = pgt_net_attach(sc);
if (error)
- goto failed;
+ return;
if (kthread_create(pgt_per_device_kthread, sc, NULL,
sc->sc_dev.dv_xname) != 0)
- goto failed;
+ return;
ieee80211_new_state(&sc->sc_ic, IEEE80211_S_INIT, -1);
-
-failed:
- return (error);
}
int
diff --git a/sys/dev/ic/pgtvar.h b/sys/dev/ic/pgtvar.h
index 2958007a13d..9a0157950f7 100644
--- a/sys/dev/ic/pgtvar.h
+++ b/sys/dev/ic/pgtvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pgtvar.h,v 1.7 2006/09/16 10:36:12 mglocker Exp $ */
+/* $OpenBSD: pgtvar.h,v 1.8 2006/10/02 18:06:55 mglocker Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -207,9 +207,8 @@ struct pgt_softc {
#endif
};
-void pgt_attachhook(void *);
int pgt_intr(void *);
-int pgt_attach(struct pgt_softc *);
+void pgt_attach(void *);
int pgt_detach(struct pgt_softc *sc);
void pgt_reboot(struct pgt_softc *);
diff --git a/sys/dev/pci/if_pgt_pci.c b/sys/dev/pci/if_pgt_pci.c
index 68e1c57258b..71d4e27ad2b 100644
--- a/sys/dev/pci/if_pgt_pci.c
+++ b/sys/dev/pci/if_pgt_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pgt_pci.c,v 1.6 2006/09/16 10:36:12 mglocker Exp $ */
+/* $OpenBSD: if_pgt_pci.c,v 1.7 2006/10/02 18:06:55 mglocker Exp $ */
/*
* Copyright (c) 2006 Marcus Glocker <mglocker@openbsd.org>
@@ -140,7 +140,7 @@ pgt_pci_attach(struct device *parent, struct device *self, void *aux)
printf(": %s\n", intrstr);
if (rootvp == NULL)
- mountroothook_establish(pgt_attachhook, sc);
+ mountroothook_establish(pgt_attach, sc);
else
pgt_attach(sc);
}