From owner-svn-src-all@FreeBSD.ORG Sat Dec 18 19:48:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F9F1106566C; Sat, 18 Dec 2010 19:48:59 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay007.isp.belgacom.be (mailrelay007.isp.belgacom.be [195.238.6.173]) by mx1.freebsd.org (Postfix) with ESMTP id 64D618FC18; Sat, 18 Dec 2010 19:48:57 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAPqeDE1bsUgS/2dsb2JhbACkNHS7coVKBJAh Received: from 18.72-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.72.18]) by relay.skynet.be with ESMTP; 18 Dec 2010 20:48:56 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.4/8.14.4) with ESMTP id oBIJmtmW001894; Sat, 18 Dec 2010 20:48:55 +0100 (CET) (envelope-from tijl@freebsd.org) From: Tijl Coosemans To: Paul B Mahol Date: Sat, 18 Dec 2010 20:48:43 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.5.2; i386; ; ) References: <201012181421.oBIELTSd093635@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1987300.O6GHZnZapO"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201012182048.54969.tijl@freebsd.org> Cc: svn-src-head@freebsd.org, Kostik Belousov , svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r216518 - in head/sys/dev: if_ndis le malo sound/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Dec 2010 19:48:59 -0000 --nextPart1987300.O6GHZnZapO Content-Type: multipart/mixed; boundary="Boundary-01=_cARDN/Cod0Bap/P" Content-Transfer-Encoding: 7bit --Boundary-01=_cARDN/Cod0Bap/P Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Saturday 18 December 2010 19:41:13 Paul B Mahol wrote: > On 12/18/10, Tijl Coosemans wrote: >> Author: tijl >> Date: Sat Dec 18 14:21:28 2010 >> New Revision: 216518 >> URL: http://svn.freebsd.org/changeset/base/216518 >> >> Log: >> Use convenience functions where possible instead of accessing the PCI >> configuration registers directly. >> >> Remove pci_enable_io calls where they are redundant. The PCI bus driver >> will set the right bits when the corresponding bus resource is activat= ed. >> >> Remove redundant pci_* function calls from suspend/resume methods. The >> bus driver already saves and restores the PCI configuration. >> >> Reviewed by: jhb >> Approved by: kib (mentor) >=20 > Please revert change to if_ndis regarding introduction of pci_get_subvend= or(). >=20 > You compare 16bit value with 32bit value - this will always fail. Apologies. Instead of reverting, would the attached patch work for you? It moves the function calls out of the while loop and makes it more clear what subsys means. --Boundary-01=_cARDN/Cod0Bap/P Content-Type: text/x-patch; charset="ISO-8859-15"; name="if_ndis.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="if_ndis.diff" diff --git a/sys/dev/if_ndis/if_ndis_pci.c b/sys/dev/if_ndis/if_ndis_pci.c index ff93df3..2b9ad1e 100644 =2D-- a/sys/dev/if_ndis/if_ndis_pci.c +++ b/sys/dev/if_ndis/if_ndis_pci.c @@ -110,14 +110,20 @@ ndis_devcompare(bustype, t, dev) struct ndis_pci_type *t; device_t dev; { + uint16_t vid, did; + uint32_t subsys; + if (bustype !=3D PCIBus) return(FALSE); =20 + vid =3D pci_get_vendor(dev); + did =3D pci_get_device(dev); + subsys =3D pci_get_subdevice(dev); + subsys =3D (subsys << 16) | pci_get_subvendor(dev); + while(t->ndis_name !=3D NULL) { =2D if ((pci_get_vendor(dev) =3D=3D t->ndis_vid) && =2D (pci_get_device(dev) =3D=3D t->ndis_did) && =2D (pci_get_subvendor(dev) =3D=3D t->ndis_subsys || =2D t->ndis_subsys =3D=3D 0)) { + if ((t->ndis_vid =3D=3D vid) && (t->ndis_did =3D=3D did) && + (t->ndis_subsys =3D=3D subsys || t->ndis_subsys =3D=3D 0)) { device_set_desc(dev, t->ndis_name); return(TRUE); } @@ -169,6 +175,8 @@ ndis_attach_pci(dev) struct resource_list *rl; struct resource_list_entry *rle; struct drvdb_ent *db; + uint16_t vid, did; + uint32_t subsys; =20 sc =3D device_get_softc(dev); unit =3D device_get_unit(dev); @@ -300,14 +308,18 @@ ndis_attach_pci(dev) =20 /* Figure out exactly which device we matched. */ =20 + vid =3D pci_get_vendor(dev); + did =3D pci_get_device(dev); + subsys =3D pci_get_subdevice(dev); + subsys =3D (subsys << 16) | pci_get_subvendor(dev); + t =3D db->windrv_devlist; =20 while(t->ndis_name !=3D NULL) { =2D if ((pci_get_vendor(dev) =3D=3D t->ndis_vid) && =2D (pci_get_device(dev) =3D=3D t->ndis_did)) { + if (t->ndis_vid =3D=3D vid && t->ndis_did =3D=3D did) { if (t->ndis_subsys =3D=3D 0) defidx =3D devidx; =2D else if (pci_get_subvendor(dev) =3D=3D t->ndis_subsys) + else if (t->ndis_subsys =3D=3D subsys) break; } t++; --Boundary-01=_cARDN/Cod0Bap/P-- --nextPart1987300.O6GHZnZapO Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iF4EABEIAAYFAk0NECYACgkQfoCS2CCgtiu8OwD/Tds4r3N/PJpEsQnrWcTwEyNc X9QyCOZaZvdVSiCyReIBAIi6nDaMF1EEEvhgXuGmcVDR8QzP1VHjUOWmOHzfvXDt =JyA6 -----END PGP SIGNATURE----- --nextPart1987300.O6GHZnZapO--