From 5ef258b3f6a6481d20f1fca0f60db894b80649ab Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Wed, 10 Aug 2022 14:59:18 +0800 Subject: libpayload: usb: Fix spacing issues Found by: find payloads/libpayload/drivers/usb -type f -name "*.[ch]" | xargs \ util/lint/checkpatch.pl --types SPACING -q --fix-inplace -f Change-Id: Id23e2e573e475c6d795812a4b2df9aeffbcaaaf4 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/66596 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- payloads/libpayload/drivers/usb/usbhid.c | 64 ++++++++++++++++---------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'payloads/libpayload/drivers/usb/usbhid.c') diff --git a/payloads/libpayload/drivers/usb/usbhid.c b/payloads/libpayload/drivers/usb/usbhid.c index 87e87411fe..4ada62a9d7 100644 --- a/payloads/libpayload/drivers/usb/usbhid.c +++ b/payloads/libpayload/drivers/usb/usbhid.c @@ -62,7 +62,7 @@ typedef struct { #define HID_INST(dev) ((usbhid_inst_t*)(dev)->data) static void -usb_hid_destroy (usbdev_t *dev) +usb_hid_destroy(usbdev_t *dev) { if (HID_INST(dev)->queue) { int i; @@ -82,7 +82,7 @@ usb_hid_destroy (usbdev_t *dev) free(HID_INST(dev)->descriptor); HID_INST(dev)->descriptor = NULL; - free (dev->data); + free(dev->data); } /* keybuffer is global to all USB keyboards */ @@ -268,14 +268,14 @@ usb_hid_process_keyboard_event(usbhid_inst_t *const inst, if (current->modifiers & 0x01) /* Left-Ctrl */ modifiers |= KB_MOD_CTRL; if (current->modifiers & 0x02) /* Left-Shift */ modifiers |= KB_MOD_SHIFT; if (current->modifiers & 0x04) /* Left-Alt */ modifiers |= KB_MOD_ALT; - if (current->modifiers & 0x08) /* Left-GUI */ ; + if (current->modifiers & 0x08) /* Left-GUI */; if (current->modifiers & 0x10) /* Right-Ctrl */ modifiers |= KB_MOD_CTRL; if (current->modifiers & 0x20) /* Right-Shift */ modifiers |= KB_MOD_SHIFT; if (current->modifiers & 0x40) /* Right-AltGr */ modifiers |= KB_MOD_ALT; - if (current->modifiers & 0x80) /* Right-GUI */ ; + if (current->modifiers & 0x80) /* Right-GUI */; if ((current->modifiers & 0x05) && ((current->keys[0] == 0x4c) || - (current->keys[0]==0x63))) { + (current->keys[0] == 0x63))) { /* vulcan nerve pinch */ if (reset_handler) reset_handler(); @@ -297,14 +297,14 @@ usb_hid_process_keyboard_event(usbhid_inst_t *const inst, inst->lastkeypress = 0; - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { int j; int skip = 0; // No more keys? skip if (current->keys[i] == 0) return; - for (j=0; j<6; j++) { + for (j = 0; j < 6; j++) { if (current->keys[i] == previous->keys[j]) { skip = 1; break; @@ -328,7 +328,7 @@ usb_hid_process_keyboard_event(usbhid_inst_t *const inst, if (keypress == -1) { /* Debug: Print unknown keys */ - usb_debug ("usbhid: <%x> %x [ %x %x %x %x %x %x ] %d\n", + usb_debug("usbhid: <%x> %x [ %x %x %x %x %x %x ] %d\n", current->modifiers, current->repeats, current->keys[0], current->keys[1], current->keys[2], current->keys[3], @@ -347,12 +347,12 @@ usb_hid_process_keyboard_event(usbhid_inst_t *const inst, } static void -usb_hid_poll (usbdev_t *dev) +usb_hid_poll(usbdev_t *dev) { usb_hid_keyboard_event_t current; const u8 *buf; - while ((buf=dev->controller->poll_intr_queue (HID_INST(dev)->queue))) { + while ((buf = dev->controller->poll_intr_queue (HID_INST(dev)->queue))) { memcpy(¤t.buffer, buf, 8); usb_hid_process_keyboard_event(HID_INST(dev), ¤t); HID_INST(dev)->previous = current; @@ -360,7 +360,7 @@ usb_hid_poll (usbdev_t *dev) } static void -usb_hid_set_idle (usbdev_t *dev, interface_descriptor_t *interface, u16 duration) +usb_hid_set_idle(usbdev_t *dev, interface_descriptor_t *interface, u16 duration) { dev_req_t dr; dr.data_dir = host_to_device; @@ -370,11 +370,11 @@ usb_hid_set_idle (usbdev_t *dev, interface_descriptor_t *interface, u16 duration dr.wValue = (duration >> 2) << 8; dr.wIndex = interface->bInterfaceNumber; dr.wLength = 0; - dev->controller->control (dev, OUT, sizeof (dev_req_t), &dr, 0, 0); + dev->controller->control(dev, OUT, sizeof(dev_req_t), &dr, 0, 0); } static void -usb_hid_set_protocol (usbdev_t *dev, interface_descriptor_t *interface, hid_proto proto) +usb_hid_set_protocol(usbdev_t *dev, interface_descriptor_t *interface, hid_proto proto) { dev_req_t dr; dr.data_dir = host_to_device; @@ -384,7 +384,7 @@ usb_hid_set_protocol (usbdev_t *dev, interface_descriptor_t *interface, hid_prot dr.wValue = proto; dr.wIndex = interface->bInterfaceNumber; dr.wLength = 0; - dev->controller->control (dev, OUT, sizeof (dev_req_t), &dr, 0, 0); + dev->controller->control(dev, OUT, sizeof(dev_req_t), &dr, 0, 0); } static struct console_input_driver cons = { @@ -393,12 +393,12 @@ static struct console_input_driver cons = { .input_type = CONSOLE_INPUT_TYPE_USB, }; -static int usb_hid_set_layout (const char *country) +static int usb_hid_set_layout(const char *country) { /* FIXME should be per keyboard */ int i; - for (i=0; iconfiguration; @@ -431,31 +431,31 @@ usb_hid_init (usbdev_t *dev) if (interface->bInterfaceSubClass == hid_subclass_boot) { u8 countrycode; - usb_debug (" supports boot interface..\n"); - usb_debug (" it's a %s\n", + usb_debug(" supports boot interface..\n"); + usb_debug(" it's a %s\n", boot_protos[interface->bInterfaceProtocol]); switch (interface->bInterfaceProtocol) { case hid_boot_proto_keyboard: - dev->data = xzalloc (sizeof (usbhid_inst_t)); - usb_debug (" configuring...\n"); + dev->data = xzalloc(sizeof(usbhid_inst_t)); + usb_debug(" configuring...\n"); usb_hid_set_protocol(dev, interface, hid_proto_boot); usb_hid_set_idle(dev, interface, KEYBOARD_REPEAT_MS); - usb_debug (" activating...\n"); + usb_debug(" activating...\n"); hid_descriptor_t *desc = malloc(sizeof(hid_descriptor_t)); if (!desc || get_descriptor(dev, gen_bmRequestType( device_to_host, standard_type, iface_recp), 0x21, 0, desc, sizeof(*desc)) != sizeof(*desc)) { - usb_debug ("get_descriptor(HID) failed\n"); - usb_detach_device (dev->controller, dev->address); + usb_debug("get_descriptor(HID) failed\n"); + usb_detach_device(dev->controller, dev->address); return; } - HID_INST (dev)->descriptor = desc; + HID_INST(dev)->descriptor = desc; countrycode = desc->bCountryCode; /* 35 countries defined: */ if (countrycode >= ARRAY_SIZE(countries)) countrycode = 0; - usb_debug (" Keyboard has %s layout (country code %02x)\n", + usb_debug(" Keyboard has %s layout (country code %02x)\n", countries[countrycode][0], countrycode); /* Set keyboard layout accordingly */ @@ -473,15 +473,15 @@ usb_hid_init (usbdev_t *dev) break; } if (i >= dev->num_endp) { - usb_debug ("Could not find HID endpoint\n"); - usb_detach_device (dev->controller, dev->address); + usb_debug("Could not find HID endpoint\n"); + usb_detach_device(dev->controller, dev->address); return; } - usb_debug (" found endpoint %x for interrupt-in\n", i); + usb_debug(" found endpoint %x for interrupt-in\n", i); /* 20 buffers of 8 bytes, for every 10 msecs */ - HID_INST(dev)->queue = dev->controller->create_intr_queue (&dev->endpoints[i], 8, 20, 10); + HID_INST(dev)->queue = dev->controller->create_intr_queue(&dev->endpoints[i], 8, 20, 10); keycount = 0; - usb_debug (" configuration done.\n"); + usb_debug(" configuration done.\n"); break; case hid_boot_proto_mouse: usb_debug("NOTICE: USB mice are not supported.\n"); -- cgit v1.2.3