mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 19:16:21 +00:00
d/wmr: avoid using non-self-explanatory numbers for input allocations
By using an extra, final entry in the according inputs enum instead of using a hard coded number it should be slightly safer and easier to verify that the to be allocated inputs array is of correct size. No functional change. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
This commit is contained in:
parent
785e99f115
commit
fca4ac41e5
|
@ -50,6 +50,8 @@ enum wmr_controller_hp_input_index
|
|||
WMR_CONTROLLER_INDEX_AIM_POSE,
|
||||
WMR_CONTROLLER_INDEX_X_A_CLICK,
|
||||
WMR_CONTROLLER_INDEX_Y_B_CLICK,
|
||||
/* keep as last: */
|
||||
WMR_CONTROLLER_INDEX_COUNT
|
||||
};
|
||||
|
||||
#define SET_INPUT(wcb, INDEX, NAME) \
|
||||
|
@ -315,7 +317,8 @@ wmr_controller_hp_create(struct wmr_controller_connection *conn,
|
|||
DRV_TRACE_MARKER();
|
||||
|
||||
enum u_device_alloc_flags flags = U_DEVICE_ALLOC_TRACKING_NONE;
|
||||
struct wmr_controller_hp *ctrl = U_DEVICE_ALLOCATE(struct wmr_controller_hp, flags, 11, 1);
|
||||
struct wmr_controller_hp *ctrl =
|
||||
U_DEVICE_ALLOCATE(struct wmr_controller_hp, flags, WMR_CONTROLLER_INDEX_COUNT, 1);
|
||||
struct wmr_controller_base *wcb = (struct wmr_controller_base *)(ctrl);
|
||||
|
||||
if (!wmr_controller_base_init(wcb, conn, controller_type, log_level)) {
|
||||
|
|
Loading…
Reference in a new issue