From owner-freebsd-drivers@FreeBSD.ORG Tue Sep 5 19:28:00 2006 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B516C16A4DD; Tue, 5 Sep 2006 19:28:00 +0000 (UTC) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (gate.funkthat.com [69.17.45.168]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3585C43D49; Tue, 5 Sep 2006 19:28:00 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (0mnew3dcgucvscvk@localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.6/8.13.3) with ESMTP id k85JRv61047416; Tue, 5 Sep 2006 12:27:57 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.6/8.13.3/Submit) id k85JRt1Z047415; Tue, 5 Sep 2006 12:27:55 -0700 (PDT) (envelope-from jmg) Date: Tue, 5 Sep 2006 12:27:55 -0700 From: John-Mark Gurney To: "M. Warner Losh" Message-ID: <20060905192755.GI9421@funkthat.com> Mail-Followup-To: "M. Warner Losh" , phk@phk.freebsd.dk, freebsd-current@freebsd.org, freebsd-drivers@freebsd.org, freebsd-arch@freebsd.org References: <20060905173334.GH9421@funkthat.com> <14026.1157478288@critter.freebsd.dk> <20060905.130247.-267228160.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060905.130247.-267228160.imp@bsdimp.com> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 5.4-RELEASE-p6 i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html Cc: phk@phk.freebsd.dk, freebsd-current@freebsd.org, freebsd-drivers@freebsd.org, freebsd-arch@freebsd.org Subject: Re: bus_get_dma_tag now necessary for drivers using bus_dma X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John-Mark Gurney List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2006 19:28:00 -0000 Warner Losh wrote this message on Tue, Sep 05, 2006 at 13:02 -0600: > In message: <14026.1157478288@critter.freebsd.dk> > "Poul-Henning Kamp" writes: > : In message <20060905173334.GH9421@funkthat.com>, John-Mark Gurney writes: > : > : >This means that for each call to bus_dma_tag_create, instead of passing > : >a NULL pointer, you should call bus_get_dma_tag(yourdev) and use that > : >as the parent tag. I committed some example code to various drivers, > : >such as ahc, ata, em, and ohci. > : > : If there are never any exeptions to this requirement, why not > : pass "yourdev" and have the magic hidden, rather than add 17 > : ritual characters to the API ? > > As Scott pointed out, it won't always be NULL. I like his idea of > having a variant that takes a device_t... I thought of something similar. I like the idea of not having to call bus_get_dma_tag every time, but at the same time, I didn't like adding yet another function that does almost the same thing... If more arguments were effected, I'd be less inclined to argue, but all we'd be doing would change: bus_dma_tag_create(bus_get_dma_tag(dev), to: bus_dma_tag_dev_create(dev, Which though less typing, does create another entry point for creating a bus_dma_tag_t.... I'm split on which is the better way, so if someone wants to change it to the second, I have no objections.... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."