Changeset b7fd2a0 in mainline for uspace/drv/bus/usb/ohci/hc.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (9 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, 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/ohci/hc.c

    r36f0738 rb7fd2a0  
    9191static void hc_gain_control(hc_t *instance);
    9292static void hc_start(hc_t *instance);
    93 static int hc_init_transfer_lists(hc_t *instance);
    94 static int hc_init_memory(hc_t *instance);
     93static errno_t hc_init_transfer_lists(hc_t *instance);
     94static errno_t hc_init_memory(hc_t *instance);
    9595
    9696/** Generate IRQ code.
     
    103103 * @return Error code.
    104104 */
    105 int ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)
     105errno_t ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)
    106106{
    107107        assert(code);
     
    152152 * @return Error code
    153153 */
    154 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
     154errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
    155155{
    156156        assert(instance);
     
    160160            return EINVAL;
    161161
    162         int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
     162        errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
    163163            (void **) &instance->registers);
    164164        if (ret != EOK) {
     
    269269}
    270270
    271 int ohci_hc_status(hcd_t *hcd, uint32_t *status)
     271errno_t ohci_hc_status(hcd_t *hcd, uint32_t *status)
    272272{
    273273        assert(hcd);
     
    289289 * @return Error code.
    290290 */
    291 int ohci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
     291errno_t ohci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
    292292{
    293293        assert(hcd);
     
    518518 * @return Error code
    519519 */
    520 int hc_init_transfer_lists(hc_t *instance)
     520errno_t hc_init_transfer_lists(hc_t *instance)
    521521{
    522522        assert(instance);
     
    524524do { \
    525525        const char *name = usb_str_transfer_type(type); \
    526         const int ret = endpoint_list_init(&instance->lists[type], name); \
     526        const errno_t ret = endpoint_list_init(&instance->lists[type], name); \
    527527        if (ret != EOK) { \
    528528                usb_log_error("Failed to setup %s endpoint list: %s.\n", \
     
    552552 * @return Error code.
    553553 */
    554 int hc_init_memory(hc_t *instance)
     554errno_t hc_init_memory(hc_t *instance)
    555555{
    556556        assert(instance);
     
    558558        memset(&instance->rh, 0, sizeof(instance->rh));
    559559        /* Init queues */
    560         const int ret = hc_init_transfer_lists(instance);
     560        const errno_t ret = hc_init_transfer_lists(instance);
    561561        if (ret != EOK) {
    562562                return ret;
Note: See TracChangeset for help on using the changeset viewer.