mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-30 07:37:49 +00:00
HID: indent switches/cases
Bring switch and cases into coding style and save thus some indentation to make the code tighter. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
02ae9a1a8b
commit
880d29f109
@ -294,7 +294,6 @@ static s32 item_sdata(struct hid_item *item)
|
||||
static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
|
||||
{
|
||||
switch (item->tag) {
|
||||
|
||||
case HID_GLOBAL_ITEM_TAG_PUSH:
|
||||
|
||||
if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) {
|
||||
@ -313,8 +312,8 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(&parser->global, parser->global_stack + --parser->global_stack_ptr,
|
||||
sizeof(struct hid_global));
|
||||
memcpy(&parser->global, parser->global_stack +
|
||||
--parser->global_stack_ptr, sizeof(struct hid_global));
|
||||
return 0;
|
||||
|
||||
case HID_GLOBAL_ITEM_TAG_USAGE_PAGE:
|
||||
@ -352,21 +351,26 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
|
||||
return 0;
|
||||
|
||||
case HID_GLOBAL_ITEM_TAG_REPORT_SIZE:
|
||||
if ((parser->global.report_size = item_udata(item)) > 32) {
|
||||
dbg_hid("invalid report_size %d\n", parser->global.report_size);
|
||||
parser->global.report_size = item_udata(item);
|
||||
if (parser->global.report_size > 32) {
|
||||
dbg_hid("invalid report_size %d\n",
|
||||
parser->global.report_size);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case HID_GLOBAL_ITEM_TAG_REPORT_COUNT:
|
||||
if ((parser->global.report_count = item_udata(item)) > HID_MAX_USAGES) {
|
||||
dbg_hid("invalid report_count %d\n", parser->global.report_count);
|
||||
parser->global.report_count = item_udata(item);
|
||||
if (parser->global.report_count > HID_MAX_USAGES) {
|
||||
dbg_hid("invalid report_count %d\n",
|
||||
parser->global.report_count);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case HID_GLOBAL_ITEM_TAG_REPORT_ID:
|
||||
if ((parser->global.report_id = item_udata(item)) == 0) {
|
||||
parser->global.report_id = item_udata(item);
|
||||
if (parser->global.report_id == 0) {
|
||||
dbg_hid("report_id 0 is invalid\n");
|
||||
return -1;
|
||||
}
|
||||
@ -395,7 +399,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
|
||||
data = item_udata(item);
|
||||
|
||||
switch (item->tag) {
|
||||
|
||||
case HID_LOCAL_ITEM_TAG_DELIMITER:
|
||||
|
||||
if (data) {
|
||||
@ -595,7 +598,6 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
|
||||
item->size = b & 3;
|
||||
|
||||
switch (item->size) {
|
||||
|
||||
case 0:
|
||||
return start;
|
||||
|
||||
|
@ -188,12 +188,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
}
|
||||
|
||||
switch (usage->hid & HID_USAGE_PAGE) {
|
||||
|
||||
case HID_UP_UNDEFINED:
|
||||
goto ignore;
|
||||
|
||||
case HID_UP_KEYBOARD:
|
||||
|
||||
set_bit(EV_REP, input->evbit);
|
||||
|
||||
if ((usage->hid & HID_USAGE) < 256) {
|
||||
@ -205,7 +203,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
break;
|
||||
|
||||
case HID_UP_BUTTON:
|
||||
|
||||
code = ((usage->hid - 1) & 0xf);
|
||||
|
||||
switch (field->application) {
|
||||
@ -226,9 +223,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
map_key(code);
|
||||
break;
|
||||
|
||||
|
||||
case HID_UP_SIMULATION:
|
||||
|
||||
switch (usage->hid & 0xffff) {
|
||||
case 0xba: map_abs(ABS_RUDDER); break;
|
||||
case 0xbb: map_abs(ABS_THROTTLE); break;
|
||||
@ -240,7 +235,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
break;
|
||||
|
||||
case HID_UP_GENDESK:
|
||||
|
||||
if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */
|
||||
switch (usage->hid & 0xf) {
|
||||
case 0x1: map_key_clear(KEY_POWER); break;
|
||||
@ -268,7 +262,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
}
|
||||
|
||||
switch (usage->hid) {
|
||||
|
||||
/* These usage IDs map directly to the usage codes. */
|
||||
case HID_GD_X: case HID_GD_Y: case HID_GD_Z:
|
||||
case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ:
|
||||
@ -294,7 +287,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
break;
|
||||
|
||||
case HID_UP_LED:
|
||||
|
||||
switch (usage->hid & 0xffff) { /* HID-Value: */
|
||||
case 0x01: map_led (LED_NUML); break; /* "Num Lock" */
|
||||
case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */
|
||||
@ -313,16 +305,13 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
break;
|
||||
|
||||
case HID_UP_DIGITIZER:
|
||||
|
||||
switch (usage->hid & 0xff) {
|
||||
|
||||
case 0x30: /* TipPressure */
|
||||
if (!test_bit(BTN_TOUCH, input->keybit)) {
|
||||
device->quirks |= HID_QUIRK_NOTOUCH;
|
||||
set_bit(EV_KEY, input->evbit);
|
||||
set_bit(BTN_TOUCH, input->keybit);
|
||||
}
|
||||
|
||||
map_abs_clear(ABS_PRESSURE);
|
||||
break;
|
||||
|
||||
@ -354,7 +343,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
break;
|
||||
|
||||
case HID_UP_CONSUMER: /* USB HUT v1.1, pages 56-62 */
|
||||
|
||||
switch (usage->hid & HID_USAGE) {
|
||||
case 0x000: goto ignore;
|
||||
case 0x034: map_key_clear(KEY_SLEEP); break;
|
||||
@ -469,7 +457,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
break;
|
||||
|
||||
case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */
|
||||
|
||||
set_bit(EV_REP, input->evbit);
|
||||
switch (usage->hid & HID_USAGE) {
|
||||
case 0x021: map_key_clear(KEY_PRINT); break;
|
||||
@ -489,20 +476,16 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||
break;
|
||||
|
||||
case HID_UP_MSVENDOR:
|
||||
|
||||
goto ignore;
|
||||
|
||||
case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */
|
||||
|
||||
set_bit(EV_REP, input->evbit);
|
||||
goto ignore;
|
||||
|
||||
case HID_UP_LOGIVENDOR:
|
||||
|
||||
goto ignore;
|
||||
|
||||
case HID_UP_PID:
|
||||
|
||||
switch (usage->hid & HID_USAGE) {
|
||||
case 0xa4: map_key_clear(BTN_DEAD); break;
|
||||
default: goto ignore;
|
||||
|
@ -369,7 +369,8 @@ static void hid_ctrl(struct urb *urb)
|
||||
switch (urb->status) {
|
||||
case 0: /* success */
|
||||
if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN)
|
||||
hid_input_report(urb->context, usbhid->ctrl[usbhid->ctrltail].report->type,
|
||||
hid_input_report(urb->context,
|
||||
usbhid->ctrl[usbhid->ctrltail].report->type,
|
||||
urb->transfer_buffer, urb->actual_length, 0);
|
||||
break;
|
||||
case -ESHUTDOWN: /* unplug */
|
||||
|
Loading…
x
Reference in New Issue
Block a user