Skip to content

Commit 144a558

Browse files
QuzarDCQuzarDC
authored andcommitted
keyboard: Refactor status validation.
Reuse the maple enum function that already validates a device and status prior to returning it.
1 parent 9940b29 commit 144a558

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

kernel/arch/dreamcast/hardware/maple/keyboard.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -534,16 +534,12 @@ int kbd_get_key(void) {
534534
}
535535

536536
kbd_state_t *kbd_get_state(maple_device_t *device) {
537-
if(!device)
538-
return NULL;
539-
540-
if(!device->status)
541-
return NULL;
537+
kbd_state_t *state = (kbd_state_t *)maple_dev_status(device);
542538

543-
if(!(device->info.functions & MAPLE_FUNC_KEYBOARD))
539+
if(!state || !(device->info.functions & MAPLE_FUNC_KEYBOARD))
544540
return NULL;
545541

546-
return (kbd_state_t *)device->status;
542+
return state;
547543
}
548544

549545
/* Take a key off of a specific key queue. */

0 commit comments

Comments
 (0)