From owner-svn-src-head@freebsd.org Sat Feb 27 03:35:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FB91AB28AF; Sat, 27 Feb 2016 03:35:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1304180B; Sat, 27 Feb 2016 03:35:29 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1R3ZSNQ027133; Sat, 27 Feb 2016 03:35:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1R3ZSPX027130; Sat, 27 Feb 2016 03:35:28 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201602270335.u1R3ZSPX027130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 27 Feb 2016 03:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296136 - in head: share/man/man9 sys/sys 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.20 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: Sat, 27 Feb 2016 03:35:30 -0000 Author: jhibbits Date: Sat Feb 27 03:35:28 2016 New Revision: 296136 URL: https://svnweb.freebsd.org/changeset/base/296136 Log: Add the bus_alloc_resource_anywhere() convenience function. Summary: Many instances of bus_alloc_resource() simply use 0 and ~0 for start and end to denote 'anywhere' with a given count. To clean this up, introduce a bus_alloc_resource_anywhere() convenience function. Bump __FreeBSD_version for the new API. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D5370 Modified: head/share/man/man9/bus_alloc_resource.9 head/sys/sys/bus.h head/sys/sys/param.h Modified: head/share/man/man9/bus_alloc_resource.9 ============================================================================== --- head/share/man/man9/bus_alloc_resource.9 Sat Feb 27 03:34:01 2016 (r296135) +++ head/share/man/man9/bus_alloc_resource.9 Sat Feb 27 03:35:28 2016 (r296136) @@ -34,6 +34,7 @@ .Sh NAME .Nm bus_alloc_resource , .Nm bus_alloc_resource_any +.Nm bus_alloc_resource_anywhere .Nd allocate resources from a parent bus .Sh SYNOPSIS .In sys/param.h @@ -49,6 +50,10 @@ .Fc .Ft struct resource * .Fn bus_alloc_resource_any "device_t dev" "int type" "int *rid" "u_int flags" +.Fc +.Ft struct resource * +.Fn bus_alloc_resource_anywhere +.Fa "device_t dev" "int type" "int *rid" "rman_res_t count" "u_int flags" .Sh DESCRIPTION This is an easy interface to the resource-management functions. It hides the indirection through the parent's method table. @@ -57,9 +62,12 @@ rare cases) never earlier. .Pp The .Fn bus_alloc_resource_any -function is a convenience wrapper for +and +.Fn bus_alloc_resource_anywhere +functions are convenience wrappers for .Fn bus_alloc_resource . -It sets the values for +.Fn bus_alloc_resource_any +sets .Fa start , .Fa end , and @@ -67,6 +75,14 @@ and to the default resource (see description of .Fa start below). +.Fn bus_alloc_resource_anywhere +sets +.Fa start +and +.Fa end +to the default resource and uses the provided +.Fa count +argument. .Pp The arguments are as follows: .Bl -item Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Sat Feb 27 03:34:01 2016 (r296135) +++ head/sys/sys/bus.h Sat Feb 27 03:35:28 2016 (r296136) @@ -481,6 +481,13 @@ bus_alloc_resource_any(device_t dev, int return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags)); } +static __inline struct resource * +bus_alloc_resource_anywhere(device_t dev, int type, int *rid, + rman_res_t count, u_int flags) +{ + return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, count, flags)); +} + /* * Access functions for device. */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Feb 27 03:34:01 2016 (r296135) +++ head/sys/sys/param.h Sat Feb 27 03:35:28 2016 (r296136) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100099 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100100 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,