PERFORCE change 121913 for review
Rui Paulo
rpaulo at FreeBSD.org
Mon Jun 18 14:05:44 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=121913
Change 121913 by rpaulo at rpaulo_epsilon on 2007/06/18 14:04:50
Don't depend on INTR_FILTER compile time option to setup
a fast interrupt handler. bus_setup_intr() takes care of that
already.
New code adapted from sio(4) (which setups a fast interrupt
handler). It's probably not the best way to do this, but I'm
following existing practices.
Discussed with: Attilio Rao, John Baldwin
Affected files ...
.. //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#14 edit
Differences ...
==== //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#14 (text+ko) ====
@@ -23,7 +23,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#13 $
+ * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#14 $
*
*/
@@ -77,11 +77,8 @@
static int asmc_temp_getvalue(device_t, const char *);
static int asmc_sms_read(device_t, const char *, int16_t *);
static void asmc_sms_calibrate(device_t);
-#ifdef INTR_FILTER
static int asmc_sms_intr(void *);
-#else
static void asmc_sms_fastintr(void *);
-#endif
static void asmc_sms_printintr(device_t, uint8_t);
/*
@@ -236,7 +233,7 @@
asmc_attach(device_t dev)
{
int i, j;
- int error;
+ int ret;
char name[2];
struct asmc_softc *sc = device_get_softc(dev);
struct asmc_model *model;
@@ -378,16 +375,21 @@
goto out;
}
-#ifdef INTR_FILTER
- error = bus_setup_intr(dev, sc->sc_res,
- INTR_TYPE_MISC | INTR_MPSAFE,
- asmc_sms_intr, NULL, dev, &sc->sc_cookie);
-#else
- error = bus_setup_intr(dev, sc->sc_res,
- INTR_TYPE_MISC | INTR_MPSAFE | INTR_FAST,
- NULL, asmc_sms_fastintr, dev, &sc->sc_cookie);
-#endif
- if (error) {
+ ret = bus_setup_intr(dev, sc->sc_res,
+ INTR_TYPE_MISC | INTR_MPSAFE,
+ asmc_sms_intr, NULL, dev, &sc->sc_cookie);
+
+ if (ret) {
+ ret = bus_setup_intr(dev, sc->sc_res,
+ INTR_TYPE_MISC | INTR_MPSAFE,
+ NULL, asmc_sms_fastintr, dev,
+ &sc->sc_cookie);
+ if (ret == 0)
+ device_printf(dev, "unable to setup fast interrupt. "
+ "Using normal mode.\n");
+ }
+
+ if (ret) {
device_printf(dev, "unable to setup SMS IRQ\n");
bus_release_resource(dev, SYS_RES_IRQ, sc->sc_rid,
sc->sc_res);
@@ -760,7 +762,6 @@
asmc_sms_read(dev, ASMC_KEY_SMS_Z, &sc->sms_rest_z);
}
-#ifdef INTR_FILTER
static int
asmc_sms_intr(void *arg)
{
@@ -776,7 +777,7 @@
return (FILTER_HANDLED);
}
-#else
+
static void
asmc_sms_fastintr(void *arg)
{
@@ -790,7 +791,7 @@
asmc_sms_printintr(dev, type);
}
-#endif /* INTR_FILTER */
+
static void
asmc_sms_printintr(device_t dev, uint8_t type)
More information about the p4-projects
mailing list