Hi,

This is a straightforward ticks-to-milliseconds conversion, but IIRC
pirofti@ wanted me to get some tests before committing it.

The only users of acpi_sleep() are (a) acpitz(4) and (b) any AML code
that uses AMLOP_SLEEP.  AMLOP_SLEEP seems to trigger just before a
suspend.  I don't know when else it is used.

If you have an acpi(4) laptop with suspend/resume support, please
apply this patch and let me know if anything doesn't work,
particularly with suspend/resume.

I've been running with this since November without apparent issue...
But this driver impacts many people, so I think I need more tests.

Cheers,

Scott

Index: dsdt.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
retrieving revision 1.249
diff -u -p -r1.249 dsdt.c
--- dsdt.c      16 Oct 2019 01:43:50 -0000      1.249
+++ dsdt.c      16 Mar 2020 02:26:25 -0000
@@ -465,15 +465,11 @@ void
 acpi_sleep(int ms, char *reason)
 {
        static int acpinowait;
-       int to = ms * hz / 1000;
 
        if (cold)
                delay(ms * 1000);
-       else {
-               if (to <= 0)
-                       to = 1;
-               tsleep(&acpinowait, PWAIT, reason, to);
-       }
+       else
+               tsleep_nsec(&acpinowait, PWAIT, reason, MSEC_TO_NSEC(ms));
 }
 
 void

Reply via email to