Queued and signaled describe boolean states of events.
So let's use type bool and rename the structure members to is_queued
and is_signaled.
Update the comments for is_queued and is_signaled.
Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
* @nofify_function: Function to call when the event is triggered
* @notify_context: Data to be passed to the notify function
* @trigger_type: Type of timer, see efi_set_timer
* @nofify_function: Function to call when the event is triggered
* @notify_context: Data to be passed to the notify function
* @trigger_type: Type of timer, see efi_set_timer
- * @queued: The notification functionis queued
- * @signaled: The event occured
+ * @queued: The notification function is queued
+ * @signaled: The event occurred. The event is in the signaled state.
*/
struct efi_event {
uint32_t type;
*/
struct efi_event {
uint32_t type;
u64 trigger_next;
u64 trigger_time;
enum efi_timer_delay trigger_type;
u64 trigger_next;
u64 trigger_time;
enum efi_timer_delay trigger_type;
- int queued;
- int signaled;
+ bool is_queued;
+ bool is_signaled;
void efi_signal_event(struct efi_event *event)
{
if (event->notify_function) {
void efi_signal_event(struct efi_event *event)
{
if (event->notify_function) {
+ event->is_queued = true;
/* Check TPL */
if (efi_tpl >= event->notify_tpl)
return;
EFI_CALL_VOID(event->notify_function(event,
event->notify_context));
}
/* Check TPL */
if (efi_tpl >= event->notify_tpl)
return;
EFI_CALL_VOID(event->notify_function(event,
event->notify_context));
}
+ event->is_queued = false;
}
static efi_status_t efi_unsupported(const char *funcname)
}
static efi_status_t efi_unsupported(const char *funcname)
efi_events[i].notify_context = notify_context;
/* Disable timers on bootup */
efi_events[i].trigger_next = -1ULL;
efi_events[i].notify_context = notify_context;
/* Disable timers on bootup */
efi_events[i].trigger_next = -1ULL;
- efi_events[i].queued = 0;
- efi_events[i].signaled = 0;
+ efi_events[i].is_queued = false;
+ efi_events[i].is_signaled = false;
*event = &efi_events[i];
return EFI_SUCCESS;
}
*event = &efi_events[i];
return EFI_SUCCESS;
}
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (!efi_events[i].type)
continue;
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (!efi_events[i].type)
continue;
- if (efi_events[i].queued)
+ if (efi_events[i].is_queued)
efi_signal_event(&efi_events[i]);
if (!(efi_events[i].type & EVT_TIMER) ||
now < efi_events[i].trigger_next)
efi_signal_event(&efi_events[i]);
if (!(efi_events[i].type & EVT_TIMER) ||
now < efi_events[i].trigger_next)
- efi_events[i].signaled = 1;
+ efi_events[i].is_signaled = true;
efi_signal_event(&efi_events[i]);
}
WATCHDOG_RESET();
efi_signal_event(&efi_events[i]);
}
WATCHDOG_RESET();
}
event->trigger_type = type;
event->trigger_time = trigger_time;
}
event->trigger_type = type;
event->trigger_time = trigger_time;
+ event->is_signaled = false;
return EFI_SUCCESS;
}
return EFI_INVALID_PARAMETER;
return EFI_SUCCESS;
}
return EFI_INVALID_PARAMETER;
known_event:
if (!event[i]->type || event[i]->type & EVT_NOTIFY_SIGNAL)
return EFI_EXIT(EFI_INVALID_PARAMETER);
known_event:
if (!event[i]->type || event[i]->type & EVT_NOTIFY_SIGNAL)
return EFI_EXIT(EFI_INVALID_PARAMETER);
- if (!event[i]->signaled)
+ if (!event[i]->is_signaled)
efi_signal_event(event[i]);
}
/* Wait for signal */
for (;;) {
for (i = 0; i < num_events; ++i) {
efi_signal_event(event[i]);
}
/* Wait for signal */
for (;;) {
for (i = 0; i < num_events; ++i) {
- if (event[i]->signaled)
+ if (event[i]->is_signaled)
goto out;
}
/* Allow events to occur. */
goto out;
}
/* Allow events to occur. */
* Reset the signal which is passed to the caller to allow periodic
* events to occur.
*/
* Reset the signal which is passed to the caller to allow periodic
* events to occur.
*/
- event[i]->signaled = 0;
+ event[i]->is_signaled = false;
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (event != &efi_events[i])
continue;
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (event != &efi_events[i])
continue;
+ if (event->is_signaled)
+ event->is_signaled = true;
if (event->type & EVT_NOTIFY_SIGNAL)
efi_signal_event(event);
break;
if (event->type & EVT_NOTIFY_SIGNAL)
efi_signal_event(event);
break;
if (event == &efi_events[i]) {
event->type = 0;
event->trigger_next = -1ULL;
if (event == &efi_events[i]) {
event->type = 0;
event->trigger_next = -1ULL;
- event->queued = 0;
- event->signaled = 0;
+ event->is_queued = false;
+ event->is_signaled = false;
return EFI_EXIT(EFI_SUCCESS);
}
}
return EFI_EXIT(EFI_SUCCESS);
}
}
continue;
if (!event->type || event->type & EVT_NOTIFY_SIGNAL)
break;
continue;
if (!event->type || event->type & EVT_NOTIFY_SIGNAL)
break;
+ if (!event->is_signaled)
+ if (event->is_signaled)
return EFI_EXIT(EFI_SUCCESS);
return EFI_EXIT(EFI_NOT_READY);
}
return EFI_EXIT(EFI_SUCCESS);
return EFI_EXIT(EFI_NOT_READY);
}
{
EFI_ENTRY("%p, %p", event, context);
if (tstc()) {
{
EFI_ENTRY("%p, %p", event, context);
if (tstc()) {
- efi_con_in.wait_for_key->signaled = 1;
+ efi_con_in.wait_for_key->is_signaled = true;
efi_signal_event(efi_con_in.wait_for_key);
}
EFI_EXIT(EFI_SUCCESS);
efi_signal_event(efi_con_in.wait_for_key);
}
EFI_EXIT(EFI_SUCCESS);