From owner-svn-src-head@FreeBSD.ORG Thu Dec 16 17:05:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DEC8106566C; Thu, 16 Dec 2010 17:05:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BF6D8FC0A; Thu, 16 Dec 2010 17:05:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBGH5Skt069036; Thu, 16 Dec 2010 17:05:28 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBGH5SdC069032; Thu, 16 Dec 2010 17:05:28 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201012161705.oBGH5SdC069032@svn.freebsd.org> From: John Baldwin Date: Thu, 16 Dec 2010 17:05:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216490 - in head/sys: dev/acpica x86/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Dec 2010 17:05:28 -0000 Author: jhb Date: Thu Dec 16 17:05:28 2010 New Revision: 216490 URL: http://svn.freebsd.org/changeset/base/216490 Log: Small style fixes: - Avoid side-effect assignments in if statements when possible. - Don't use ! to check for NULL pointers, explicitly check against NULL. - Explicitly check error return values against 0. - Don't use INTR_MPSAFE for interrupt handlers with only filters as it is meaningless. - Remove unneeded function casts. Modified: head/sys/dev/acpica/acpi_hpet.c head/sys/x86/isa/atrtc.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Thu Dec 16 16:56:44 2010 (r216489) +++ head/sys/dev/acpica/acpi_hpet.c Thu Dec 16 17:05:28 2010 (r216490) @@ -558,16 +558,15 @@ hpet_attach(device_t dev) } if (t->irq >= 0) { t->intr_rid = hpet_find_irq_rid(dev, t->irq, t->irq); - if (!(t->intr_res = - bus_alloc_resource(dev, SYS_RES_IRQ, &t->intr_rid, - t->irq, t->irq, 1, RF_ACTIVE))) { + t->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, + &t->intr_rid, t->irq, t->irq, 1, RF_ACTIVE); + if (t->intr_res == NULL) { t->irq = -1; device_printf(dev, "Can't map interrupt for t%d.\n", i); - } else if ((bus_setup_intr(dev, t->intr_res, - INTR_MPSAFE | INTR_TYPE_CLK, - (driver_filter_t *)hpet_intr_single, NULL, - t, &t->intr_handle))) { + } else if (bus_setup_intr(dev, t->intr_res, + INTR_TYPE_CLK, hpet_intr_single, NULL, t, + &t->intr_handle) != 0) { t->irq = -1; device_printf(dev, "Can't setup interrupt for t%d.\n", i); @@ -614,13 +613,12 @@ hpet_attach(device_t dev) while (j > 0 && (cvectors & (1 << (j - 1))) != 0) j--; sc->intr_rid = hpet_find_irq_rid(dev, j, i); - if (!(sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, - &sc->intr_rid, j, i, 1, RF_SHAREABLE | RF_ACTIVE))) - device_printf(dev,"Can't map interrupt.\n"); - else if ((bus_setup_intr(dev, sc->intr_res, - INTR_MPSAFE | INTR_TYPE_CLK, - (driver_filter_t *)hpet_intr, NULL, - sc, &sc->intr_handle))) { + sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, + &sc->intr_rid, j, i, 1, RF_SHAREABLE | RF_ACTIVE); + if (sc->intr_res == NULL) + device_printf(dev, "Can't map interrupt.\n"); + else if (bus_setup_intr(dev, sc->intr_res, INTR_TYPE_CLK, + hpet_intr, NULL, sc, &sc->intr_handle) != 0) { device_printf(dev, "Can't setup interrupt.\n"); } else { sc->irq = rman_get_start(sc->intr_res); Modified: head/sys/x86/isa/atrtc.c ============================================================================== --- head/sys/x86/isa/atrtc.c Thu Dec 16 16:56:44 2010 (r216489) +++ head/sys/x86/isa/atrtc.c Thu Dec 16 17:05:28 2010 (r216490) @@ -245,9 +245,10 @@ atrtc_attach(device_t dev) int i; sc = device_get_softc(dev); - if (!(sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->port_rid, IO_RTC, IO_RTC + 1, 2, RF_ACTIVE))) - device_printf(dev,"Warning: Couldn't map I/O.\n"); + sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, + IO_RTC, IO_RTC + 1, 2, RF_ACTIVE); + if (sc->port_res == NULL) + device_printf(dev, "Warning: Couldn't map I/O.\n"); atrtc_start(); clock_register(dev, 1000000); bzero(&sc->et, sizeof(struct eventtimer)); @@ -258,14 +259,13 @@ atrtc_attach(device_t dev) while (bus_get_resource(dev, SYS_RES_IRQ, sc->intr_rid, &s, NULL) == 0 && s != 8) sc->intr_rid++; - if (!(sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, - &sc->intr_rid, 8, 8, 1, RF_ACTIVE))) { - device_printf(dev,"Can't map interrupt.\n"); + sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, + &sc->intr_rid, 8, 8, 1, RF_ACTIVE); + if (sc->intr_res == NULL) { + device_printf(dev, "Can't map interrupt.\n"); return (0); - } else if ((bus_setup_intr(dev, sc->intr_res, - INTR_MPSAFE | INTR_TYPE_CLK, - (driver_filter_t *)rtc_intr, NULL, - sc, &sc->intr_handler))) { + } else if ((bus_setup_intr(dev, sc->intr_res, INTR_TYPE_CLK, + rtc_intr, NULL, sc, &sc->intr_handler))) { device_printf(dev, "Can't setup interrupt.\n"); return (0); } else {