From owner-svn-src-head@FreeBSD.ORG Tue Aug 6 19:14:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B7C6B9E3; Tue, 6 Aug 2013 19:14:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8B5E220D4; Tue, 6 Aug 2013 19:14:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r76JE2YU024427; Tue, 6 Aug 2013 19:14:02 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r76JE2cR024426; Tue, 6 Aug 2013 19:14:02 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201308061914.r76JE2cR024426@svn.freebsd.org> From: Marius Strobl Date: Tue, 6 Aug 2013 19:14:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254005 - head/sys/dev/aac X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Tue, 06 Aug 2013 19:14:02 -0000 Author: marius Date: Tue Aug 6 19:14:02 2013 New Revision: 254005 URL: http://svnweb.freebsd.org/changeset/base/254005 Log: - Fix a bug in the MSI allocation logic so an MSI is also employed if a controller supports only a single message. I haven't seen such an adapter out in the wild, though, so this change likely is a NOP. While at it, further simplify the MSI allocation logic; there's no need to check the number of available messages on our own as pci_alloc_msi(9) will just fail if it can't provide us with the single message we want. - Nuke the unused softc of aacch(4). MFC after: 1 month Modified: head/sys/dev/aac/aac_pci.c Modified: head/sys/dev/aac/aac_pci.c ============================================================================== --- head/sys/dev/aac/aac_pci.c Tue Aug 6 18:55:59 2013 (r254004) +++ head/sys/dev/aac/aac_pci.c Tue Aug 6 19:14:02 2013 (r254005) @@ -425,18 +425,13 @@ aac_pci_attach(device_t dev) * Allocate the interrupt. */ rid = 0; - count = 0; - if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0 && - (count = pci_msi_count(dev)) != 0) { - if (count > 1) - count = 1; - else - count = 0; - if (count == 1 && pci_alloc_msi(dev, &count) == 0) + if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0) { + count = 1; + if (pci_alloc_msi(dev, &count) == 0) rid = 1; } if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ, - &rid, RF_ACTIVE | (count != 0 ? 0 : RF_SHAREABLE))) == NULL) { + &rid, RF_ACTIVE | (rid != 0 ? 0 : RF_SHAREABLE))) == NULL) { device_printf(dev, "can't allocate interrupt\n"); goto out; } @@ -489,14 +484,10 @@ static device_method_t aacch_methods[] = DEVMETHOD_END }; -struct aacch_softc { - device_t dev; -}; - static driver_t aacch_driver = { "aacch", aacch_methods, - sizeof(struct aacch_softc) + 1 /* no softc */ }; static devclass_t aacch_devclass; @@ -515,19 +506,14 @@ aacch_probe(device_t dev) } static int -aacch_attach(device_t dev) +aacch_attach(device_t dev __unused) { - struct aacch_softc *sc; - - sc = device_get_softc(dev); - - sc->dev = dev; return (0); } static int -aacch_detach(device_t dev) +aacch_detach(device_t dev __unused) { return (0);