(udev_joypad.c) Style nits

This commit is contained in:
twinaphex 2015-06-03 18:31:06 +02:00
parent 17a040e002
commit 22bd3b2d4f

View File

@ -154,8 +154,10 @@ static bool udev_hotplug_available(void)
if (!g_udev_mon) if (!g_udev_mon)
return false; return false;
fds.fd = udev_monitor_get_fd(g_udev_mon);
fds.fd = udev_monitor_get_fd(g_udev_mon);
fds.events = POLLIN; fds.events = POLLIN;
return (poll(&fds, 1, 0) == 1) && (fds.revents & POLLIN); return (poll(&fds, 1, 0) == 1) && (fds.revents & POLLIN);
} }
@ -397,8 +399,8 @@ static void udev_joypad_handle_hotplug(void)
if (!dev) if (!dev)
return; return;
const char *val = udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); const char *val = udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK");
const char *action = udev_device_get_action(dev); const char *action = udev_device_get_action(dev);
const char *devnode = udev_device_get_devnode(dev); const char *devnode = udev_device_get_devnode(dev);
if (!val || strcmp(val, "1") || !devnode) if (!val || strcmp(val, "1") || !devnode)
@ -439,11 +441,10 @@ static bool udev_set_rumble(unsigned i, enum retro_rumble_effect effect, uint16_
if (strength && strength != pad->configured_strength[effect]) if (strength && strength != pad->configured_strength[effect])
{ {
/* Create new or update old playing state. */ /* Create new or update old playing state. */
struct ff_effect e; struct ff_effect e = {0};
memset(&e, 0, sizeof(e));
e.type = FF_RUMBLE; e.type = FF_RUMBLE;
e.id = old_effect; e.id = old_effect;
switch (effect) switch (effect)
{ {
@ -463,8 +464,8 @@ static bool udev_set_rumble(unsigned i, enum retro_rumble_effect effect, uint16_
return false; return false;
} }
pad->effects[effect] = e.id; pad->effects[effect] = e.id;
pad->has_set_ff[effect] = true; pad->has_set_ff[effect] = true;
pad->configured_strength[effect] = strength; pad->configured_strength[effect] = strength;
} }
pad->strength[effect] = strength; pad->strength[effect] = strength;
@ -499,7 +500,6 @@ static void udev_joypad_poll(void)
udev_poll_pad(&udev_pads[i], i); udev_poll_pad(&udev_pads[i], i);
} }
static bool udev_joypad_init(void *data) static bool udev_joypad_init(void *data)
{ {
unsigned i; unsigned i;
@ -537,9 +537,9 @@ static bool udev_joypad_init(void *data)
for (item = devs; item; item = udev_list_entry_get_next(item)) for (item = devs; item; item = udev_list_entry_get_next(item))
{ {
const char *name = udev_list_entry_get_name(item); const char *name = udev_list_entry_get_name(item);
struct udev_device *dev = udev_device_new_from_syspath(g_udev, name); struct udev_device *dev = udev_device_new_from_syspath(g_udev, name);
const char *devnode = udev_device_get_devnode(dev); const char *devnode = udev_device_get_devnode(dev);
if (devnode) if (devnode)
udev_check_device(dev, devnode, false); udev_check_device(dev, devnode, false);