From owner-freebsd-arm@FreeBSD.ORG Wed Jan 16 19:44:50 2013 Return-Path: Delivered-To: arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DAC36E52 for ; Wed, 16 Jan 2013 19:44:50 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [88.198.91.248]) by mx1.freebsd.org (Postfix) with ESMTP id 8D6E48CB for ; Wed, 16 Jan 2013 19:44:50 +0000 (UTC) Received: from [88.198.91.248] (helo=[IPv6:::1]) by id.bluezbox.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1TvYuc-0009bZ-8w for arm@freebsd.org; Wed, 16 Jan 2013 11:44:43 -0800 Message-ID: <50F70325.5070507@bluezbox.com> Date: Wed, 16 Jan 2013 11:44:37 -0800 From: Oleksandr Tymoshenko User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: arm@freebsd.org Subject: bus_space_(write|read)_X cleanup Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Hello, One of the practices in ARM codebase that caught my eye recently was using bus_space_write_4 (and read) where it's not strictly required. The way it usually goes: memory resource is allocated in driver's attach method then busspace tag/handle obtained by calling rman_get_bustag and rman_get_bushandle, stored in softc and used as a parameters of bus_space calls. No other operations on handle/tag are performed. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2013 19:44:50 -0000 Hello, One of the practices in ARM codebase that caught my eye recently was using bus_space_write_4 (and read) where it's not strictly required. The way it usually goes: memory resource is allocated in driver's attach method then busspace tag/handle obtained by calling rman_get_bustag and rman_get_bushandle, stored in softc and used as a parameters of bus_space calls. No other operations on handle/tag are performed. There are bus_read/bus_write wrappers that provide cleaner API and reduce code complexity. I believe it might be worth going through the code and fixing cases of excessive use of bus_space_ functions. Unless I missed something.