Date: Thu, 24 Apr 2008 23:26:10 -0700 (PDT) From: Martin Voros <martin_voros@yahoo.com> To: Poul-Henning Kamp <phk@FreeBSD.org> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/speaker spkr.c Message-ID: <68457.62765.qm@web55511.mail.re4.yahoo.com>
next in thread | raw e-mail | index | archive | help
--0-708927677-1209104770=:62765 Content-Type: text/plain; charset=us-ascii Hi Poul, ----- Original Message ---- From: Poul-Henning Kamp <phk@FreeBSD.org> To: src-committers@FreeBSD.org; cvs-src@FreeBSD.org; cvs-all@FreeBSD.org Sent: Thursday, March 27, 2008 8:33:41 AM Subject: cvs commit: src/sys/dev/speaker spkr.c phk 2008-03-26 21:33:41 UTC FreeBSD src repository Modified files: sys/dev/speaker spkr.c Log: Make speaker a pseudo device driver instead of attaching to a PnP id. If somebody cleaned this code up to proper style(9), it could become a great educational starting point for aspiring kernel hackers. I have cleaned up file spkr.c to proper style. See attached patch. Probably I have not fixed all style issues but definitely there is some improvment. Martin ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ --0-708927677-1209104770=:62765 Content-Type: application/octet-stream; name="spkr-style.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="spkr-style.patch" LS0tIHN5cy9kZXYvc3BlYWtlci9zcGtyLmMJMjAwOC0wMy0yNyAwNzoxMTow MS4wMDAwMDAwMDAgKzAxMDAKKysrIC9ob21lL3Jvb3QvZGV2ZWwvc3Brci5j CTIwMDgtMDQtMjUgMTM6MTc6NTUuMDAwMDAwMDAwICswMjAwCkBAIC0zNyw4 ICszNyw4IEBACiAKIHN0YXRpYyBNQUxMT0NfREVGSU5FKE1fU1BLUiwgInNw a3IiLCAiU3BlYWtlciBidWZmZXIiKTsKIAotLyoqKioqKioqKioqKioqKiog TUFDSElORSBERVBFTkR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V90KSk7CisJCQlpZiAoZXJyb3IpCisJCQkJ cmV0dXJuKGVycm9yKTsKKworCQkJaWYgKHR0cC5kdXJhdGlvbiA9PSAwKQor CQkJCWJyZWFrOworCisJCQlpZiAodHRwLmZyZXF1ZW5jeSA9PSAwKQorCQkJ CXJlc3QodHRwLmR1cmF0aW9uKTsKKwkJCWVsc2UKKwkJCQl0b25lKHR0cC5m cmVxdWVuY3ksIHR0cC5kdXJhdGlvbik7CisJCX0KKwkJcmV0dXJuKDApOwog CX0KLQlyZXR1cm4oMCk7Ci0gICAgfQotICAgIHJldHVybihFSU5WQUwpOwor CXJldHVybihFSU5WQUwpOwogfQogCiBzdGF0aWMgc3RydWN0IGNkZXYgKnNw ZWFrZXJfZGV2Owo= --0-708927677-1209104770=:62765--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?68457.62765.qm>