Date: Wed, 15 Mar 2000 22:53:08 +0000 (GMT) From: Nick Hibma <n_hibma@calcaphon.com> To: FreeBSD Newbus Mailing List <new-bus@FreeBSD.org> Subject: Patch for review Message-ID: <Pine.BSF.4.20.0003152250090.571-200000@localhost>
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-659987233-953160788=:571 Content-Type: TEXT/PLAIN; charset=US-ASCII The attached patch removes the use of nextunit and replaces it with a linear search for the first element available. This avoids the unit number from ever increasing and memory being wasted if you unplug & plug two devices alternatingly. It also flags that we have called DEVICE_NOMATCH and should not call it again during a reprobe. Let me know if this is anything you would not like to see implemented. Nick -- n_hibma@webweaving.org n_hibma@freebsd.org USB project http://www.etla.net/~n_hibma/ --0-659987233-953160788=:571 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="subr_bus.diff" Content-Transfer-Encoding: BASE64 Content-ID: <Pine.BSF.4.20.0003152253080.571@localhost> Content-Description: Content-Disposition: attachment; filename="subr_bus.diff" SW5kZXg6IGtlcm4vc3Vicl9idXMuYw0KPT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PQ0KUkNTIGZpbGU6IC9ob21lL25jdnMvc3JjL3N5cy9rZXJuL3N1YnJfYnVz LmMsdg0KcmV0cmlldmluZyByZXZpc2lvbiAxLjU0DQpkaWZmIC11IC1yMS41 NCBzdWJyX2J1cy5jDQotLS0ga2Vybi9zdWJyX2J1cy5jCTIwMDAvMDIvMjkg MDk6MzY6MjUJMS41NA0KKysrIGtlcm4vc3Vicl9idXMuYwkyMDAwLzAzLzE1 IDIyOjQ5OjQ3DQpAQCAtMjY3LDcgKzI2Nyw2IEBADQogCXN0cmNweShkYy0+ bmFtZSwgY2xhc3NuYW1lKTsNCiAJZGMtPmRldmljZXMgPSBOVUxMOw0KIAlk Yy0+bWF4dW5pdCA9I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h0IHVudXNlZCB1bml0IG51bWJlciAqLw0KIH07 DQogDQogLyoNCkBAIC0xMzQsNiArMTMzLDcgQEANCiAjZGVmaW5lIERGX1dJ TERDQVJECTQJLyogdW5pdCB3YXMgb3JpZ2luYWxseSB3aWxkY2FyZCAqLw0K ICNkZWZpbmUgREZfREVTQ01BTExPQ0VECTgJLyogZGVzY3JpcHRpb24gd2Fz IG1hbGxvY2VkICovDQogI2RlZmluZSBERl9RVUlFVAkxNgkvKiBkb24ndCBw cmludCB2ZXJib3NlIGF0dGFjaCBtZXNzYWdlICovDQorI2RlZmluZSBERl9E T05FTk9NQVRDSAkzMgkvKiBkb24ndCBleGVjdXRlIERFVklDRV9OT01BVENI IGFnYWluICovDQogICAgIHVfY2hhcgkJb3JkZXI7CS8qIG9yZGVyIGZyb20g ZGV2aWNlX2FkZF9jaGlsZF9vcmRlcmVkKCkgKi8NCiAgICAgdV9jaGFyCQlw YWQ7DQogI2lmZGVmIERFVklDRV9TWVNDVExTDQo= --0-659987233-953160788=:571-- 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.20.0003152250090.571-200000>