Simon Glass | 87a5d1b | 2022-03-04 08:43:00 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Internal definitions for events |
| 4 | * |
| 5 | * Copyright 2021 Google LLC |
| 6 | * Written by Simon Glass <sjg@chromium.org> |
| 7 | */ |
| 8 | |
| 9 | #ifndef __event_internal_h |
| 10 | #define __event_internal_h |
| 11 | |
| 12 | #include <event.h> |
| 13 | #include <linux/list.h> |
| 14 | |
| 15 | /** |
| 16 | * struct event_spy - a spy that watches for an event of a particular type |
| 17 | * |
| 18 | * @id: Spy ID |
| 19 | * @type: Event type to subscribe to |
| 20 | * @func: Function to call when the event is sent |
| 21 | * @ctx: Context to pass to the function |
| 22 | */ |
| 23 | struct event_spy { |
| 24 | struct list_head sibling_node; |
| 25 | const char *id; |
| 26 | enum event_t type; |
| 27 | event_handler_t func; |
| 28 | void *ctx; |
| 29 | }; |
| 30 | |
| 31 | struct event_state { |
| 32 | struct list_head spy_head; |
| 33 | }; |
| 34 | |
| 35 | #endif |