From owner-freebsd-multimedia@FreeBSD.ORG Tue Jul 10 21:22:16 2007 Return-Path: X-Original-To: multimedia@freebsd.org Delivered-To: freebsd-multimedia@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 991EB16A400; Tue, 10 Jul 2007 21:22:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 449C413C44B; Tue, 10 Jul 2007 21:22:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id l6AL7tWg077685; Tue, 10 Jul 2007 17:07:55 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org, John-Mark Gurney Date: Tue, 10 Jul 2007 15:13:50 -0400 User-Agent: KMail/1.9.6 References: <20070710020921.GB1221@funkthat.com> In-Reply-To: <20070710020921.GB1221@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707101513.50869.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 10 Jul 2007 17:07:55 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/3626/Tue Jul 10 15:09:15 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: multimedia@freebsd.org Subject: Re: Audio driver template X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2007 21:22:16 -0000 On Monday 09 July 2007 10:09:21 pm John-Mark Gurney wrote: > Christopher Davis wrote this message on Mon, Jul 09, 2007 at 11:47 -0700: > > http://people.freebsd.org/~cg/template.c > > > > Thought I would take a look at the audio driver template as > > part of my task to modernize drivers, soc2007. I would simplify > > the read and write functions to avoid using the bus tag and > > handle, but I'm not sure what else to do to bring it up to date. > > > > How else can it be improved? > > Use bus_alloc_resources instead of using bus_alloc_resource... > Maybe use pci_enable_busmaster and friends instead of using > pci_write_config... (In the future for suspend/resume, I would hope > our pci layer would save the state, which it might not if you write > directly to the config registers.) It already saves the state, and it does so by reading all the regs during suspend, so that backdoor writes are saved and restored. -- John Baldwin