summaryrefslogtreecommitdiffstats
path: root/sys/dev/ed
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1997-10-26 04:36:24 +0000
committernate <nate@FreeBSD.org>1997-10-26 04:36:24 +0000
commitc68183d0b8cb8cb595c0fac05b6d989132543595 (patch)
tree3e3880b90341465871c326ce768b275780757e2d /sys/dev/ed
parentbc21da1f3f59930a96cd6829bfaf0147d28b7754 (diff)
downloadFreeBSD-src-c68183d0b8cb8cb595c0fac05b6d989132543595.zip
FreeBSD-src-c68183d0b8cb8cb595c0fac05b6d989132543595.tar.gz
- Do a bunch of gratuitous changes intended to make the code easier to
follow. * Rename/reorder all of the pccard structures, change many of the member names to be descriptive, and follow more closely other 'bus' drivers naming schemes. * Rename a bunch of parameter and local variable names to be more consistant in the code. * Renamed the PCCARD 'crd' device to be the 'card' device * KNF and make the code consistant where it was obvious. * ifdef'd out some unused code
Diffstat (limited to 'sys/dev/ed')
-rw-r--r--sys/dev/ed/if_ed.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c
index 7b632b7..d839eba 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/if_ed.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_ed.c,v 1.121 1997/09/10 00:17:39 davidg Exp $
+ * $Id: if_ed.c,v 1.122 1997/10/03 16:26:15 davidg Exp $
*/
/*
@@ -151,8 +151,8 @@ static int ed_probe_HP_pclanp __P((struct isa_device *));
void *ed_attach_NE2000_pci __P((int, int));
#endif
-#include "crd.h"
-#if NCRD > 0
+#include "card.h"
+#if NCARD > 0
static int ed_probe_pccard __P((struct isa_device *, u_char *));
#endif
@@ -182,7 +182,7 @@ static void ed_setrcr(struct ed_softc *);
static u_long ds_crc(u_char *ep);
-#if NCRD > 0
+#if NCARD > 0
#include <sys/select.h>
#include <pccard/card.h>
#include <pccard/driver.h>
@@ -191,68 +191,46 @@ static u_long ds_crc(u_char *ep);
/*
* PC-Card (PCMCIA) specific code.
*/
-static int card_intr(struct pccard_dev *); /* Interrupt handler */
-static void edunload(struct pccard_dev *); /* Disable driver */
-static void edsuspend(struct pccard_dev *); /* Suspend driver */
-static int edinit(struct pccard_dev *, int); /* init device */
+static int edinit(struct pccard_devinfo *, int); /* init device */
+static void edunload(struct pccard_devinfo *); /* Disable driver */
+static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
+static void edsuspend(struct pccard_devinfo *); /* Suspend driver */
-static struct pccard_drv ed_info = {
+static struct pccard_device ed_info = {
"ed",
- card_intr,
+ edinit,
edunload,
+ card_intr,
edsuspend,
- edinit,
0, /* Attributes - presently unused */
&net_imask /* Interrupt mask for device */
/* XXX - Should this also include net_imask? */
};
/*
- * Called when a power down is requested. Shuts down the
- * device and configures the device as unavailable (but
- * still loaded...). A resume is done by calling
- * edinit with first=0. This is called when the user suspends
- * the system, or the APM code suspends the system.
- */
-static void
-edsuspend(struct pccard_dev *dp)
-{
- struct ed_softc *sc = &ed_softc[dp->isahd.id_unit];
- /*
- * Some 'ed' cards will generate a interrupt as they go away,
- * and by the time the interrupt handler gets to the card,
- * the interrupt can't be cleared.
- * By setting gone here, we tell the handler to ignore the
- * interrupt when it happens.
- */
- sc->gone = 1; /* avoid spinning endlessly in interrupt handler */
-
- printf("ed%d: suspending\n", dp->isahd.id_unit);
-}
-
-/*
* Initialize the device - called from Slot manager.
+ *
* If first is set, then check for the device's existence
* before initializing it. Once initialized, the device table may
* be set up.
*/
static int
-edinit(struct pccard_dev *dp, int first)
+edinit(struct pccard_devinfo *devi, int first)
{
- struct ed_softc *sc = &ed_softc[dp->isahd.id_unit];
+ struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
/* validate unit number. */
if (first) {
- if (dp->isahd.id_unit >= NED)
+ if (devi->isahd.id_unit >= NED)
return(ENODEV);
/*
* Probe the device. If a value is returned, the
* device was found at the location.
*/
sc->gone = 0;
- if (ed_probe_pccard(&dp->isahd,dp->misc)==0)
+ if (ed_probe_pccard(&devi->isahd, devi->misc) == 0)
return(ENXIO);
- if (ed_attach_isa(&dp->isahd)==0)
+ if (ed_attach_isa(&devi->isahd) == 0)
return(ENXIO);
} else {
sc->gone = 0; /* reenable after a suspend */
@@ -277,19 +255,19 @@ edinit(struct pccard_dev *dp, int first)
* read and write do not hang.
*/
static void
-edunload(struct pccard_dev *dp)
+edunload(struct pccard_devinfo *devi)
{
- struct ed_softc *sc = &ed_softc[dp->isahd.id_unit];
+ struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
struct ifnet *ifp = &sc->arpcom.ac_if;
if (sc->gone) {
- printf("ed%d: already unloaded\n", dp->isahd.id_unit);
+ printf("ed%d: already unloaded\n", devi->isahd.id_unit);
return;
}
ifp->if_flags &= ~IFF_RUNNING;
if_down(ifp);
sc->gone = 1;
- printf("ed%d: unload\n", dp->isahd.id_unit);
+ printf("ed%d: unload\n", devi->isahd.id_unit);
}
/*
@@ -297,12 +275,35 @@ edunload(struct pccard_dev *dp)
* front end of PC-Card handler.
*/
static int
-card_intr(struct pccard_dev *dp)
+card_intr(struct pccard_devinfo *devi)
{
- edintr_sc(&ed_softc[dp->isahd.id_unit]);
+ edintr_sc(&ed_softc[devi->isahd.id_unit]);
return(1);
}
-#endif /* NCRD > 0 */
+
+/*
+ * Called when a power down is requested. Shuts down the
+ * device and configures the device as unavailable (but
+ * still loaded...). A resume is done by calling
+ * edinit with first = 0. This is called when the user suspends
+ * the system, or the APM code suspends the system.
+ */
+static void
+edsuspend(struct pccard_devinfo *devi)
+{
+ struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
+ /*
+ * Some 'ed' cards will generate a interrupt as they go away,
+ * and by the time the interrupt handler gets to the card,
+ * the interrupt can't be cleared.
+ * By setting gone here, we tell the handler to ignore the
+ * interrupt when it happens.
+ */
+ sc->gone = 1; /* avoid spinning endlessly in interrupt handler */
+
+ printf("ed%d: suspending\n", devi->isahd.id_unit);
+}
+#endif /* NCARD > 0 */
struct isa_driver eddriver = {
ed_probe,
@@ -378,7 +379,7 @@ ed_probe(isa_dev)
{
int nports;
-#if NCRD > 0
+#if NCARD > 0
/*
* If PC-Card probe required, then register driver with
* slot manager.
@@ -1321,8 +1322,7 @@ ed_probe_Novell(isa_dev)
isa_dev->id_unit, isa_dev->id_flags);
}
-#if NCRD > 0
-
+#if NCARD > 0
/*
* Probe framework for pccards. Replicates the standard framework,
* minus the pccard driver registration and ignores the ether address
@@ -1346,7 +1346,7 @@ ed_probe_pccard(isa_dev, ether)
return (0);
}
-#endif /* NCRD > 0 */
+#endif /* NCARD > 0 */
#define ED_HPP_TEST_SIZE 16
OpenPOWER on IntegriCloud