diff --git a/input/drivers_hid/apple_hid.c b/input/drivers_hid/apple_hid.c index d137f76f1c..f55b6268b2 100644 --- a/input/drivers_hid/apple_hid.c +++ b/input/drivers_hid/apple_hid.c @@ -424,9 +424,11 @@ static int apple_hid_manager_set_device_matching(apple_hid_t *hid) return 0; } -static void *apple_hid_init(void) +static bool apple_hid_init(void *data) { - apple_hid_t *hid_apple = (apple_hid_t*)calloc(1, sizeof(*hid_apple)); + apple_hid_t *hid_apple = (apple_hid_t*)data; + + hid_apple = (apple_hid_t*)calloc(1, sizeof(*hid_apple)); if (!hid_apple) goto error; @@ -437,12 +439,12 @@ static void *apple_hid_init(void) hid_apple->slots = (joypad_connection_t*)pad_connection_init(MAX_USERS); - return hid_apple; + return true; error: if (hid_apple) free(hid_apple); - return NULL; + return false; } static void apple_hid_free(void *data) diff --git a/input/input_hid_driver.c b/input/input_hid_driver.c index 2d4d4dfd6d..087ea0a73b 100644 --- a/input/input_hid_driver.c +++ b/input/input_hid_driver.c @@ -103,39 +103,6 @@ const char* config_get_hid_driver_options(void) return options; } -/** - * input_hid_init_driver: - * @ident : identifier of driver to initialize. - * - * Initialize a HID driver of name @ident. - * - * If ident points to NULL or a zero-length string, - * equivalent to calling input_hid_init_first(). - * - * Returns: HID driver if found, otherwise NULL. - **/ -const hid_driver_t *input_hid_init_driver(const char *ident) -{ - unsigned i; - driver_t *driver = driver_get_ptr(); - - if (!ident || !*ident) - return input_hid_init_first(driver->hid_data); - - for (i = 0; hid_drivers[i]; i++) - { - if (strcmp(ident, hid_drivers[i]->ident) == 0 - && hid_drivers[i]->init()) - { - RARCH_LOG("Found HID driver: \"%s\".\n", - hid_drivers[i]->ident); - return hid_drivers[i]; - } - } - - return input_hid_init_first(driver->hid_data); -} - /** * input_hid_init_first: * @@ -149,9 +116,9 @@ const hid_driver_t *input_hid_init_first(void *data) for (i = 0; hid_drivers[i]; i++) { - data = hid_drivers[i]->init(); + bool ret = hid_drivers[i]->init(data); - if (data) + if (ret) { RARCH_LOG("Found HID driver: \"%s\".\n", hid_drivers[i]->ident); diff --git a/input/input_hid_driver.h b/input/input_hid_driver.h index 59bcb90efa..ff5711b13d 100644 --- a/input/input_hid_driver.h +++ b/input/input_hid_driver.h @@ -30,7 +30,7 @@ typedef struct hid_driver hid_driver_t; struct hid_driver { - void *(*init)(void); + bool (*init)(void *); bool (*query_pad)(void *, unsigned); void (*free)(void *); bool (*button)(void *, unsigned, uint16_t); @@ -72,19 +72,6 @@ const char *hid_driver_find_ident(int index); **/ const char* config_get_hid_driver_options(void); -/** - * input_hid_init_driver: - * @ident : identifier of driver to initialize. - * - * Initialize a HID driver of name @ident. - * - * If ident points to NULL or a zero-length string, - * equivalent to calling input_hid_init_first(). - * - * Returns: HID driver if found, otherwise NULL. - **/ -const hid_driver_t *input_hid_init_driver(const char *ident); - /** * input_hid_init_first: *