diff options
author | Aurora zuma automerger <aurora-zuma-automerger@google.com> | 2022-07-28 08:34:15 +0000 |
---|---|---|
committer | davidchiang <davidchiang@google.com> | 2022-07-29 07:35:45 +0000 |
commit | 858b375a15a5431e3371ed96ec7661a8c6d1b363 (patch) | |
tree | 5285e36c500052465fe0217e987b160c207cd357 /gxp-eventfd.h | |
parent | fc050e034fba0a4c339d3d108d29e4c219c21832 (diff) | |
download | zuma-858b375a15a5431e3371ed96ec7661a8c6d1b363.tar.gz |
[Copybara Auto Merge] Merge branch 'zuma' into 'android13-gs-pixel-5.15'
Initial commit for porting Zuma GXP drivers.
Bug: 239766974
GitOrigin-RevId: c3436b0c942dd009060c865c9b11d21b24de8d1b
Change-Id: Icf7b5fea1929c1786d2ed979460d5290c3a11f13
Diffstat (limited to 'gxp-eventfd.h')
-rw-r--r-- | gxp-eventfd.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/gxp-eventfd.h b/gxp-eventfd.h new file mode 100644 index 0000000..6a23200 --- /dev/null +++ b/gxp-eventfd.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * GXP eventfd + * + * Copyright (C) 2022 Google LLC + */ +#ifndef __GXP_EVENTFD_H__ +#define __GXP_EVENTFD_H__ + +#include "gxp-internal.h" + +struct gxp_eventfd; + +/** + * gxp_eventfd_create() - Open and initialize an eventfd + * @fd: A file descriptor from user-space describing an eventfd + * + * If successful, the gxp_eventfd will be returned with a reference count of 1. + * + * Return: A pointer to the new gxp_eventfd or an ERR_PTR on failure + * * -ENOMEM: Insufficient memory to create the gxp_eventfd + * * other: Failed to obtain an eventfd from @fd + */ +struct gxp_eventfd *gxp_eventfd_create(int fd); + +/** + * gxp_eventfd_get() - Increment an existing gxp_eventfd's reference count + * @eventfd: The gxp_eventfd to get a reference to + * + * Return: true on success, false if the eventfd's reference count was already 0 + */ +bool gxp_eventfd_get(struct gxp_eventfd *eventfd); + +/** + * gxp_eventfd_put() - Decrement an eventfd's reference count + * @eventfd: The gxp_eventfd to close a reference to, and potentially free + * + * If the reference count drops to 0, the @eventfd will be freed. + * + * Return: true if the reference count dropped to 0 and the gxp_eventfd was + * released, otherwise false + */ +bool gxp_eventfd_put(struct gxp_eventfd *eventfd); + +/** + * gxp_eventfd_signal() - Signal an eventfd. + * @eventfd: The gxp_eventfd to signal + * + * Return: true on success, false if the gxp_eventfd had a reference count of 0 + */ +bool gxp_eventfd_signal(struct gxp_eventfd *eventfd); + +#endif /* __GXP_EVENTFD_H__ */ |