Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Oct 2000 01:59:21 -0400 (EDT)
From:      "Matthew N. Dodd" <winter@jurai.net>
To:        new-bus@FreeBSD.ORG
Subject:   bus_generic_{get,set}_resource() functions.
Message-ID:  <Pine.BSF.4.21.0010030151220.1566-200000@sasami.jurai.net>

next in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-729685027-970552761=:1566
Content-Type: TEXT/PLAIN; charset=US-ASCII

Find attached for comment and review code implementing
bus_generic_{get,set}_resource() functions for use by bus drivers that
make use of the 'struct resource_list' method of tracking resources.

A new BUS METHOD 'BUS_GET_RESOURCE_LIST' is added which allows a bus to
retreive the resource list of a child without having to know anything
about how/where it is stored.

This allows us to reduce code duplication a fair bit.

Likely we can create bus_generic_{alloc,release}_resource() functions for
the same benefit.

Comments?

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| winter@jurai.net |       2 x '84 Volvo 245DL        | ix86,sparc,pmax |
| http://www.jurai.net/~winter | This Space For Rent  | ISO8802.5 4ever |

--0-729685027-970552761=:1566
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="rsrc_generic.diff"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.BSF.4.21.0010030159210.1566@sasami.jurai.net>
Content-Description: 
Content-Disposition: attachment; filename="rsrc_generic.diff"

SW5kZXg6IGtlcm4vc3Vicl9idXMuYw0KPT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PQ0KUkNTIGZpbGU6IC9jdnMvc3JjL3N5cy9rZXJuL3N1YnJfYnVzLmMsdg0K
cmV0cmlldmluZyByZXZpc2lvbiAxLjgwDQpkaWZmIC11IC1yMS44MCBzdWJy
X2J1cy5jDQotLS0ga2Vybi9zdWJyX2J1cy5jCTIw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2VfdCwgaW50LCBpbnQsIHVfbG9uZywgdV9sb25n
KTsNCiBpbnQJYnVzX2dlbmVyaWNfc2h1dGRvd24oZGV2aWNlX3QgZGV2KTsN
CiBpbnQJYnVzX2dlbmVyaWNfc3VzcGVuZChkZXZpY2VfdCBkZXYpOw0KIGlu
dAlidXNfZ2VuZXJpY190ZWFyZG93bl9pbnRyKGRldmljZV90IGRldiwgZGV2
aWNlX3QgY2hpbGQsDQo=
--0-729685027-970552761=:1566--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-new-bus" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0010030151220.1566-200000>