Skip to content

Commit

Permalink
winesync: Introduce WINESYNC_IOC_PULSE_EVENT
Browse files Browse the repository at this point in the history
  • Loading branch information
Zebediah Figura authored and xanmod committed May 30, 2022
1 parent 5b8c031 commit 68f8f65
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/misc/winesync.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,8 @@ static int winesync_kill_owner(struct winesync_device *dev, void __user *argp)
return 0;
}

static int winesync_set_event(struct winesync_device *dev, void __user *argp)
static int winesync_set_event(struct winesync_device *dev, void __user *argp,
bool pulse)
{
struct winesync_event_args __user *user_args = argp;
struct winesync_event_args args;
Expand All @@ -726,6 +727,8 @@ static int winesync_set_event(struct winesync_device *dev, void __user *argp)
event->u.event.signaled = true;
try_wake_all_obj(dev, event);
try_wake_any_event(event);
if (pulse)
event->u.event.signaled = false;

spin_unlock(&event->lock);
spin_unlock(&dev->wait_all_lock);
Expand All @@ -735,6 +738,8 @@ static int winesync_set_event(struct winesync_device *dev, void __user *argp)
prev_state = event->u.event.signaled;
event->u.event.signaled = true;
try_wake_any_event(event);
if (pulse)
event->u.event.signaled = false;

spin_unlock(&event->lock);
}
Expand Down Expand Up @@ -1070,6 +1075,8 @@ static long winesync_char_ioctl(struct file *file, unsigned int cmd,
return winesync_delete(dev, argp);
case WINESYNC_IOC_KILL_OWNER:
return winesync_kill_owner(dev, argp);
case WINESYNC_IOC_PULSE_EVENT:
return winesync_set_event(dev, argp, true);
case WINESYNC_IOC_PUT_MUTEX:
return winesync_put_mutex(dev, argp);
case WINESYNC_IOC_PUT_SEM:
Expand All @@ -1081,7 +1088,7 @@ static long winesync_char_ioctl(struct file *file, unsigned int cmd,
case WINESYNC_IOC_RESET_EVENT:
return winesync_reset_event(dev, argp);
case WINESYNC_IOC_SET_EVENT:
return winesync_set_event(dev, argp);
return winesync_set_event(dev, argp, false);
case WINESYNC_IOC_WAIT_ALL:
return winesync_wait_all(dev, argp);
case WINESYNC_IOC_WAIT_ANY:
Expand Down
2 changes: 2 additions & 0 deletions include/uapi/linux/winesync.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,7 @@ struct winesync_wait_args {
struct winesync_event_args)
#define WINESYNC_IOC_RESET_EVENT _IOWR(WINESYNC_IOC_BASE, 12, \
struct winesync_event_args)
#define WINESYNC_IOC_PULSE_EVENT _IOWR(WINESYNC_IOC_BASE, 13, \
struct winesync_event_args)

#endif

0 comments on commit 68f8f65

Please sign in to comment.