Changeset b7fd2a0 in mainline for uspace/drv/hid/usbhid/kbd/kbddev.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/hid/usbhid/kbd/kbddev.c

    r36f0738 rb7fd2a0  
    257257
    258258        // TODO: what about the Report ID?
    259         int rc = usb_hid_report_output_translate(&hid_dev->report, 0,
     259        errno_t rc = usb_hid_report_output_translate(&hid_dev->report, 0,
    260260            kbd_dev->output_buffer, kbd_dev->output_size);
    261261
     
    435435        }
    436436
    437         int ret =
     437        errno_t ret =
    438438           usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    439439        if (ret != EOK) {
     
    480480/* HID/KBD structure manipulation                                             */
    481481
    482 static int kbd_dev_init(usb_kbd_t *kbd_dev, usb_hid_dev_t *hid_dev)
     482static errno_t kbd_dev_init(usb_kbd_t *kbd_dev, usb_hid_dev_t *hid_dev)
    483483{
    484484        assert(kbd_dev);
     
    507507        }
    508508
    509         int ret =
     509        errno_t ret =
    510510            usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    511511        if (ret != EOK) {
     
    616616 * @return Other value inherited from function usbhid_dev_init().
    617617 */
    618 int usb_kbd_init(usb_hid_dev_t *hid_dev, void **data)
     618errno_t usb_kbd_init(usb_hid_dev_t *hid_dev, void **data)
    619619{
    620620        usb_log_debug("Initializing HID/KBD structure...\n");
     
    642642        }
    643643
    644         int ret = kbd_dev_init(kbd_dev, hid_dev);
     644        errno_t ret = kbd_dev_init(kbd_dev, hid_dev);
    645645        if (ret != EOK) {
    646646                usb_log_error("Failed to initialize KBD device  structure.\n");
     
    775775}
    776776
    777 int usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev)
     777errno_t usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev)
    778778{
    779779        assert(hid_dev);
    780         int rc = usb_hid_parse_report_descriptor(
     780        errno_t rc = usb_hid_parse_report_descriptor(
    781781            &hid_dev->report, USB_KBD_BOOT_REPORT_DESCRIPTOR,
    782782            sizeof(USB_KBD_BOOT_REPORT_DESCRIPTOR));
Note: See TracChangeset for help on using the changeset viewer.