Changeset b7fd2a0 in mainline for uspace/drv/bus/usb/uhci/hc.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/bus/usb/uhci/hc.c

    r36f0738 rb7fd2a0  
    9494
    9595static void hc_init_hw(const hc_t *instance);
    96 static int hc_init_mem_structures(hc_t *instance);
    97 static int hc_init_transfer_lists(hc_t *instance);
    98 
    99 static int hc_debug_checker(void *arg);
     96static errno_t hc_init_mem_structures(hc_t *instance);
     97static errno_t hc_init_transfer_lists(hc_t *instance);
     98
     99static errno_t hc_debug_checker(void *arg);
    100100
    101101
     
    107107 * @return Error code.
    108108 */
    109 int uhci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)
     109errno_t uhci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)
    110110{
    111111        assert(code);
     
    216216 * interrupt fibrils.
    217217 */
    218 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
     218errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
    219219{
    220220        assert(instance);
     
    228228
    229229        /* allow access to hc control registers */
    230         int ret = pio_enable_range(&hw_res->io_ranges.ranges[0],
     230        errno_t ret = pio_enable_range(&hw_res->io_ranges.ranges[0],
    231231            (void **) &instance->registers);
    232232        if (ret != EOK) {
     
    318318 *  - frame list page (needs to be one UHCI hw accessible 4K page)
    319319 */
    320 int hc_init_mem_structures(hc_t *instance)
     320errno_t hc_init_mem_structures(hc_t *instance)
    321321{
    322322        assert(instance);
     
    330330
    331331        /* Init transfer lists */
    332         int ret = hc_init_transfer_lists(instance);
     332        errno_t ret = hc_init_transfer_lists(instance);
    333333        if (ret != EOK) {
    334334                usb_log_error("Failed to initialize transfer lists.\n");
     
    359359 * USB scheduling. Sets pointer table for quick access.
    360360 */
    361 int hc_init_transfer_lists(hc_t *instance)
     361errno_t hc_init_transfer_lists(hc_t *instance)
    362362{
    363363        assert(instance);
    364364#define SETUP_TRANSFER_LIST(type, name) \
    365365do { \
    366         int ret = transfer_list_init(&instance->transfers_##type, name); \
     366        errno_t ret = transfer_list_init(&instance->transfers_##type, name); \
    367367        if (ret != EOK) { \
    368368                usb_log_error("Failed to setup %s transfer list: %s.\n", \
     
    411411}
    412412
    413 int uhci_hc_status(hcd_t *hcd, uint32_t *status)
     413errno_t uhci_hc_status(hcd_t *hcd, uint32_t *status)
    414414{
    415415        assert(hcd);
     
    435435 * Checks for bandwidth availability and appends the batch to the proper queue.
    436436 */
    437 int uhci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
     437errno_t uhci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
    438438{
    439439        assert(hcd);
     
    464464 * @return EOK (should never return)
    465465 */
    466 int hc_debug_checker(void *arg)
     466errno_t hc_debug_checker(void *arg)
    467467{
    468468        hc_t *instance = arg;
Note: See TracChangeset for help on using the changeset viewer.