Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Apr 2009 19:31:12 +0300
From:      Andriy Gapon <avg@freebsd.org>
To:        freebsd-acpi@freebsd.org
Subject:   Re: run resume code only for S1-S4 states
Message-ID:  <49E8AED0.1090008@freebsd.org>
In-Reply-To: <49E61986.7040709@root.org>
References:  <49DB639A.4090504@icyb.net.ua> <49DCF5C2.60805@root.org>	<49DDF906.8090400@icyb.net.ua> <49DF3CA4.1090309@freebsd.org> <49E4B2A7.3020302@freebsd.org> <49E61986.7040709@root.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000200060802010801030105
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit


An updated version of the patch, the only difference is: do-while(0) is gone,
breaks are replaces with gotos, indentation is reduced.

Per Nate's request I am calling for people with SMP systems to test if powering
off via power button still works with this change. It's desirable to test power
off at least two times to increase a chance of non-BSP CPU being used.

-- 
Andriy Gapon

--------------000200060802010801030105
Content-Type: text/plain;
 name="acpi_s5.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="acpi_s5.diff"

ZGlmZiAtLWdpdCBhL3N5cy9kZXYvYWNwaWNhL2FjcGkuYyBiL3N5cy9kZXYvYWNwaWNhL2Fj
cGkuYwppbmRleCA1MGI4NGE1Li42NDc3MTI1IDEwMDY0NAotLS0gYS9zeXMvZGV2L2FjcGlj
YS9hY3BpLmMKKysrIGIvc3lzL2Rldi9hY3BpY2EvYWNwaS5jCkBAIC0yNDgyLDYgKzI0ODIs
OSBAQCBhY3BpX0VudGVyU2xlZXBTdGF0ZShzdHJ1Y3QgYWNwaV9zb2Z0YyAqc2MsIGludCBz
dGF0ZSkKIAogICAgIEFDUElfRlVOQ1RJT05fVFJBQ0VfVTMyKChjaGFyICopKHVpbnRwdHJf
dClfX2Z1bmNfXywgc3RhdGUpOwogCisgICAgaWYgKHN0YXRlIDwgQUNQSV9TVEFURV9TMSB8
fCBzdGF0ZSA+IEFDUElf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GFyZSBiYWNrLiAqLwogICAgIGlmIChkZXZjdGxfcHJvY2Vzc19ydW5uaW5nKCkpCg==
--------------000200060802010801030105--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49E8AED0.1090008>