hw/kdrive: Use passed-in fd for kdrive/linux APM monitoring [v2]
This is a cleanup, proposed by Adam Jackson, but wasn't merged with the original NotifyFD changes. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
55c2e1a3aa
commit
6bf7b49f67
|
@ -173,12 +173,11 @@ static Bool LinuxApmRunning;
|
|||
static void
|
||||
LinuxApmNotify(int fd, int mask, void *blockData)
|
||||
{
|
||||
if (LinuxApmFd >= 0) {
|
||||
apm_event_t event;
|
||||
Bool running = LinuxApmRunning;
|
||||
int cmd = APM_IOC_SUSPEND;
|
||||
|
||||
while (read(LinuxApmFd, &event, sizeof(event)) == sizeof(event)) {
|
||||
while (read(fd, &event, sizeof(event)) == sizeof(event)) {
|
||||
switch (event) {
|
||||
case APM_SYS_STANDBY:
|
||||
case APM_USER_STANDBY:
|
||||
|
@ -205,8 +204,7 @@ LinuxApmNotify(int fd, int mask, void *blockData)
|
|||
else if (!running && LinuxApmRunning) {
|
||||
KdSuspend();
|
||||
LinuxApmRunning = FALSE;
|
||||
ioctl(LinuxApmFd, cmd, 0);
|
||||
}
|
||||
ioctl(fd, cmd, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue