From owner-p4-projects@FreeBSD.ORG Mon Jun 18 14:05:44 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 04AE016A473; Mon, 18 Jun 2007 14:05:44 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A7F9416A46D for ; Mon, 18 Jun 2007 14:05:43 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 9678013C46E for ; Mon, 18 Jun 2007 14:05:43 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5IE5hQ3006481 for ; Mon, 18 Jun 2007 14:05:43 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5IE5hD0006472 for perforce@freebsd.org; Mon, 18 Jun 2007 14:05:43 GMT (envelope-from rpaulo@FreeBSD.org) Date: Mon, 18 Jun 2007 14:05:43 GMT Message-Id: <200706181405.l5IE5hD0006472@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo To: Perforce Change Reviews Cc: Subject: PERFORCE change 121913 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2007 14:05:44 -0000 http://perforce.freebsd.org/chv.cgi?CH=121913 Change 121913 by rpaulo@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)