> Add an ioctl, EVIOCSSUSPENDBLOCK, to enable a suspend_blocker that will block > suspend while the event queue is not empty. This allows userspace code to > process input events while the device appears to be asleep. > > Signed-off-by: Arve Hj??nnev??g <arve@xxxxxxxxxxx> Looks ok to me, but I guess you should cc input maintainers. > @@ -582,6 +591,19 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, > else > return evdev_ungrab(evdev, client); > > + case EVIOCGSUSPENDBLOCK: > + return put_user(client->use_suspend_blocker, ip); > + > + case EVIOCSSUSPENDBLOCK: > + spin_lock_irq(&client->buffer_lock); > + if (!client->use_suspend_blocker && p) > + suspend_blocker_init(&client->suspend_blocker, "evdev"); > + else if (client->use_suspend_blocker && !p) > + suspend_blocker_destroy(&client->suspend_blocker); > + client->use_suspend_blocker = !!p; > + spin_unlock_irq(&client->buffer_lock); > + return 0; This returns 0 even when you destroy already destroyed blocker (etc). Is that ok? -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm