PERFORCE change 100965 for review

Warner Losh imp at FreeBSD.org
Sat Jul 8 07:40:22 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=100965

Change 100965 by imp at imp_lighthouse on 2006/07/08 07:39:39

	Fix style to match other at91 drivers.  I oopsed.

Affected files ...

.. //depot/projects/arm/src/sys/arm/at91/at91_tc.c#3 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/at91/at91_tc.c#3 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2005 Olivier Houchard.  All rights reserved.
+ * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,7 +25,7 @@
 #include "opt_at91.h"
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/at91_st.c,v 1.3 2006/05/13 23:41:15 cognet Exp $");
+__FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -46,21 +46,21 @@
 #include <machine/intr.h>
 #include <arm/at91/at91_tcreg.h>
 
-struct at91tc_softc;
+struct at91_tc_softc;
 
 #define MAX_COUNTER 3
 
-struct at91tc_counter {
+struct at91_tc_counter {
 	void *intrhand;			/* Interrupt handle */
 	struct resource *irq_res;	/* IRQ resource */
-	struct at91tc_softc *sc;
+	struct at91_tc_softc *sc;
 	bus_size_t offset;
 };
 
-struct at91tc_softc {
+struct at91_tc_softc {
 	struct resource	*mem_res;	/* Memory resource */
 	device_t dev;
-	struct at91tc_counter tc[MAX_COUNTER];
+	struct at91_tc_counter tc[MAX_COUNTER];
 	struct mtx sc_mtx;		/* basically a perimeter lock */
 	struct cdev *cdev;
 	int overflows;
@@ -75,36 +75,36 @@
 #define WR4sc(sc, off, val) \
 	bus_write_4(sc->mem_res, (off), (val))
 
-#define AT91TC_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
-#define	AT91TC_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)
-#define AT91TC_LOCK_INIT(_sc) \
+#define AT91_TC_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
+#define	AT91_TC_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)
+#define AT91_TC_LOCK_INIT(_sc) \
 	mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \
 	    "tc", MTX_DEF)
-#define AT91TC_LOCK_DESTROY(_sc)	mtx_destroy(&_sc->sc_mtx);
-#define AT91TC_ASSERT_LOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_OWNED);
-#define AT91TC_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED);
+#define AT91_TC_LOCK_DESTROY(_sc)	mtx_destroy(&_sc->sc_mtx);
+#define AT91_TC_ASSERT_LOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_OWNED);
+#define AT91_TC_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED);
 #define CDEV2SOFTC(dev)		((dev)->si_drv1)
 
 
 /* helper routines */
-static int at91tc_activate(device_t dev);
-static void at91tc_deactivate(device_t dev);
-static void at91tc_counter_init(struct at91tc_softc *, struct at91tc_counter *,
+static int at91_tc_activate(device_t dev);
+static void at91_tc_deactivate(device_t dev);
+static void at91_tc_counter_init(struct at91_tc_softc *, struct at91_tc_counter *,
     int unit);
 
 #ifdef AT91_TSC
-static driver_intr_t at91tc_counter_isr;
+static driver_intr_t at91_tc_counter_isr;
 
-static struct at91tc_counter *at91tc_tc;
+static struct at91_tc_counter *at91_tc_tc;
 
 static unsigned
-at91tc_get_timecount(struct timecounter *tc)
+at91_tc_get_timecount(struct timecounter *tc)
 {
-	return (RD4(at91tc_tc, TC_CV));
+	return (RD4(at91_tc_tc, TC_CV));
 }
 
-static struct timecounter at91tc_timecounter = {
-	at91tc_get_timecount, /* get_timecount */
+static struct timecounter at91_tc_timecounter = {
+	at91_tc_get_timecount, /* get_timecount */
 	NULL, /* no poll_pps */
 	0xfffffu, /* counter_mask */
 	5000000, /* frequency */
@@ -114,7 +114,7 @@
 #endif
 
 static int
-at91tc_probe(device_t dev)
+at91_tc_probe(device_t dev)
 {
 
 	if (device_get_unit(dev) == 0)
@@ -125,16 +125,16 @@
 }
 
 static int
-at91tc_attach(device_t dev)
+at91_tc_attach(device_t dev)
 {
-	struct at91tc_softc *sc = device_get_softc(dev);
+	struct at91_tc_softc *sc = device_get_softc(dev);
 	int err, i;
 
 	sc->dev = dev;
-	err = at91tc_activate(dev);
+	err = at91_tc_activate(dev);
 	if (err)
 		goto out;
-	AT91TC_LOCK_INIT(sc);
+	AT91_TC_LOCK_INIT(sc);
 
 	sc->tc[0].offset = TC_TC0_OFFSET;
 	sc->tc[1].offset = TC_TC1_OFFSET;
@@ -147,13 +147,13 @@
 		WR4sc(sc, TC_BMR, TC_BMR_XC1_TIOA2);
 #endif
 	for (i = 0; i < MAX_COUNTER; i++)
-		at91tc_counter_init(sc, &sc->tc[i], i);
+		at91_tc_counter_init(sc, &sc->tc[i], i);
 #ifdef AT91_TSC
 	if (device_get_unit(dev) == 0) {
 		// XXX need cdev
 		// Init our timecounter.
-		at91tc_tc = &sc->tc[0];
-		tc_init(&at91tc_timecounter);
+		at91_tc_tc = &sc->tc[0];
+		tc_init(&at91_tc_timecounter);
 	}
 #endif
 out:;
@@ -161,9 +161,9 @@
 }
 
 static int
-at91tc_activate(device_t dev)
+at91_tc_activate(device_t dev)
 {
-	struct at91tc_softc *sc;
+	struct at91_tc_softc *sc;
 	int rid;
 
 	sc = device_get_softc(dev);
@@ -174,12 +174,12 @@
 		goto errout;
 	return (0);
 errout:;
-	at91tc_deactivate(dev);
+	at91_tc_deactivate(dev);
 	return (ENOMEM);
 }
 
 static void
-at91tc_tc_deactivate(struct at91tc_counter *tc)
+at91_tc_tc_deactivate(struct at91_tc_counter *tc)
 {
 	if (tc->intrhand)
 		bus_teardown_intr(tc->sc->dev, tc->irq_res, tc->intrhand);
@@ -191,14 +191,14 @@
 }
 
 static void
-at91tc_deactivate(device_t dev)
+at91_tc_deactivate(device_t dev)
 {
-	struct at91tc_softc *sc;
+	struct at91_tc_softc *sc;
 	int i;
 
 	sc = device_get_softc(dev);
 	for (i = 0; i < MAX_COUNTER; i++)
-		at91tc_tc_deactivate(&sc->tc[i]);
+		at91_tc_tc_deactivate(&sc->tc[i]);
 	bus_generic_detach(sc->dev);
 	if (sc->mem_res)
 		bus_release_resource(dev, SYS_RES_IOPORT,
@@ -208,7 +208,7 @@
 }
 
 static void
-at91tc_counter_init(struct at91tc_softc *sc, struct at91tc_counter *tc,
+at91_tc_counter_init(struct at91_tc_softc *sc, struct at91_tc_counter *tc,
     int unit)
 {
 #ifdef AT91_TSC
@@ -232,7 +232,7 @@
 	if (tc->irq_res == NULL)
 		return;
 	if (bus_setup_intr(sc->dev, tc->irq_res, INTR_TYPE_MISC | INTR_FAST,
-	    at91tc_counter_isr, tc, &tc->intrhand) != 0)
+	    at91_tc_counter_isr, tc, &tc->intrhand) != 0)
 		return;
 
 	// Setup TC1 into Capture Mode (WAVE=0), clocked by our external
@@ -250,9 +250,9 @@
 
 #ifdef AT91_TSC
 static void
-at91tc_counter_isr(void *argp)
+at91_tc_counter_isr(void *argp)
 {
-	struct at91tc_counter *tc = argp;
+	struct at91_tc_counter *tc = argp;
 	uint32_t status;
 
 	status = RD4(tc, TC_SR);
@@ -267,17 +267,17 @@
 }
 #endif
 
-static device_method_t at91tc_methods[] = {
-	DEVMETHOD(device_probe, at91tc_probe),
-	DEVMETHOD(device_attach, at91tc_attach),
+static device_method_t at91_tc_methods[] = {
+	DEVMETHOD(device_probe, at91_tc_probe),
+	DEVMETHOD(device_attach, at91_tc_attach),
 	{0, 0},
 };
 
-static driver_t at91tc_driver = {
+static driver_t at91_tc_driver = {
 	"at91_tc",
-	at91tc_methods,
-	sizeof(struct at91tc_softc),
+	at91_tc_methods,
+	sizeof(struct at91_tc_softc),
 };
-static devclass_t at91tc_devclass;
+static devclass_t at91_tc_devclass;
 
-DRIVER_MODULE(at91_st, atmelarm, at91tc_driver, at91tc_devclass, 0, 0);
+DRIVER_MODULE(at91_tc, atmelarm, at91_tc_driver, at91_tc_devclass, 0, 0);


More information about the p4-projects mailing list