Changeset b7fd2a0 in mainline for uspace/drv/bus/usb


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 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.

Location:
uspace/drv/bus/usb
Files:
52 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/ehci_endpoint.c

    r36f0738 rb7fd2a0  
    7777 * @return Error code.
    7878 */
    79 int ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep)
     79errno_t ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep)
    8080{
    8181        assert(ep);
  • uspace/drv/bus/usb/ehci/ehci_endpoint.h

    r36f0738 rb7fd2a0  
    5151} ehci_endpoint_t;
    5252
    53 int ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep);
     53errno_t ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep);
    5454void ehci_endpoint_fini(hcd_t *hcd, endpoint_t *ep);
    5555
  • uspace/drv/bus/usb/ehci/ehci_rh.c

    r36f0738 rb7fd2a0  
    9999 * initializes internal virtual hub.
    100100 */
    101 int ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
     101errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
    102102    const char *name)
    103103{
     
    140140 * status change requests might be postponed until there is something to report.
    141141 */
    142 int ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch)
     142errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch)
    143143{
    144144        assert(instance);
     
    175175 * processing of a postponed request.
    176176 */
    177 int ehci_rh_interrupt(ehci_rh_t *instance)
     177errno_t ehci_rh_interrupt(ehci_rh_t *instance)
    178178{
    179179        //TODO atomic swap needed
     
    217217 * @return Error code.
    218218 */
    219 static int req_get_status(usbvirt_device_t *device,
     219static errno_t req_get_status(usbvirt_device_t *device,
    220220    const usb_device_request_setup_packet_t *setup_packet,
    221221    uint8_t *data, size_t *act_size)
     
    240240 * @return Error code.
    241241 */
    242 static int req_clear_hub_feature(usbvirt_device_t *device,
     242static errno_t req_clear_hub_feature(usbvirt_device_t *device,
    243243    const usb_device_request_setup_packet_t *setup_packet,
    244244    uint8_t *data, size_t *act_size)
     
    268268 * @return Error code.
    269269 */
    270 static int req_get_port_status(usbvirt_device_t *device,
     270static errno_t req_get_port_status(usbvirt_device_t *device,
    271271    const usb_device_request_setup_packet_t *setup_packet,
    272272    uint8_t *data, size_t *act_size)
     
    311311} ehci_rh_job_t;
    312312
    313 static int stop_reset(void *arg)
     313static errno_t stop_reset(void *arg)
    314314{
    315315        ehci_rh_job_t *job = arg;
     
    340340}
    341341
    342 static int stop_resume(void *arg)
     342static errno_t stop_resume(void *arg)
    343343{
    344344        ehci_rh_job_t *job = arg;
     
    353353}
    354354
    355 static int delayed_job(int (*func)(void*), ehci_rh_t *rh, unsigned port)
     355static errno_t delayed_job(errno_t (*func)(void*), ehci_rh_t *rh, unsigned port)
    356356{
    357357        ehci_rh_job_t *job = malloc(sizeof(*job));
     
    379379 * @return Error code.
    380380 */
    381 static int req_clear_port_feature(usbvirt_device_t *device,
     381static errno_t req_clear_port_feature(usbvirt_device_t *device,
    382382    const usb_device_request_setup_packet_t *setup_packet,
    383383    uint8_t *data, size_t *act_size)
     
    458458 * @return Error code.
    459459 */
    460 static int req_set_port_feature(usbvirt_device_t *device,
     460static errno_t req_set_port_feature(usbvirt_device_t *device,
    461461    const usb_device_request_setup_packet_t *setup_packet,
    462462    uint8_t *data, size_t *act_size)
     
    507507 * only need 1 byte.
    508508 */
    509 static int req_status_change_handler(usbvirt_device_t *device,
     509static errno_t req_status_change_handler(usbvirt_device_t *device,
    510510    usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
    511511    void *buffer, size_t buffer_size, size_t *actual_size)
  • uspace/drv/bus/usb/ehci/ehci_rh.h

    r36f0738 rb7fd2a0  
    6767} ehci_rh_t;
    6868
    69 int ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
     69errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
    7070    const char *name);
    71 int ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch);
    72 int ehci_rh_interrupt(ehci_rh_t *instance);
     71errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch);
     72errno_t ehci_rh_interrupt(ehci_rh_t *instance);
    7373
    7474/** Get EHCI rh address.
  • uspace/drv/bus/usb/ehci/endpoint_list.c

    r36f0738 rb7fd2a0  
    5050 * Allocates memory for internal ed_t structure.
    5151 */
    52 int endpoint_list_init(endpoint_list_t *instance, const char *name)
     52errno_t endpoint_list_init(endpoint_list_t *instance, const char *name)
    5353{
    5454        assert(instance);
  • uspace/drv/bus/usb/ehci/endpoint_list.h

    r36f0738 rb7fd2a0  
    6868}
    6969
    70 int endpoint_list_init(endpoint_list_t *instance, const char *name);
     70errno_t endpoint_list_init(endpoint_list_t *instance, const char *name);
    7171void endpoint_list_chain(endpoint_list_t *instance, const endpoint_list_t *next);
    7272void endpoint_list_append_ep(endpoint_list_t *instance, ehci_endpoint_t *ep);
  • uspace/drv/bus/usb/ehci/hc.c

    r36f0738 rb7fd2a0  
    9090
    9191static void hc_start(hc_t *instance);
    92 static int hc_init_memory(hc_t *instance);
     92static errno_t hc_init_memory(hc_t *instance);
    9393
    9494/** Generate IRQ code.
     
    100100 * @return Error code.
    101101 */
    102 int ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)
     102errno_t ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)
    103103{
    104104        assert(code);
     
    132132        ehci_caps_regs_t *caps = NULL;
    133133
    134         int ret = pio_enable_range(&regs, (void**)&caps);
     134        errno_t ret = pio_enable_range(&regs, (void**)&caps);
    135135        if (ret != EOK) {
    136136                free(code->ranges);
     
    159159 * @return Error code
    160160 */
    161 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
     161errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
    162162{
    163163        assert(instance);
     
    168168            return EINVAL;
    169169
    170         int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
     170        errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
    171171            (void **)&instance->caps);
    172172        if (ret != EOK) {
     
    273273}
    274274
    275 int ehci_hc_status(hcd_t *hcd, uint32_t *status)
     275errno_t ehci_hc_status(hcd_t *hcd, uint32_t *status)
    276276{
    277277        assert(hcd);
     
    294294 * @return Error code.
    295295 */
    296 int ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
     296errno_t ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
    297297{
    298298        assert(hcd);
     
    445445 * @return Error code.
    446446 */
    447 int hc_init_memory(hc_t *instance)
     447errno_t hc_init_memory(hc_t *instance)
    448448{
    449449        assert(instance);
    450450        usb_log_debug2("HC(%p): Initializing Async list(%p).", instance,
    451451            &instance->async_list);
    452         int ret = endpoint_list_init(&instance->async_list, "ASYNC");
     452        errno_t ret = endpoint_list_init(&instance->async_list, "ASYNC");
    453453        if (ret != EOK) {
    454454                usb_log_error("HC(%p): Failed to setup ASYNC list: %s",
  • uspace/drv/bus/usb/ehci/hc.h

    r36f0738 rb7fd2a0  
    8282} hc_t;
    8383
    84 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts);
     84errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts);
    8585void hc_fini(hc_t *instance);
    8686
     
    8888void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep);
    8989
    90 int ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq);
     90errno_t ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq);
    9191
    9292void ehci_hc_interrupt(hcd_t *hcd, uint32_t status);
    93 int ehci_hc_status(hcd_t *hcd, uint32_t *status);
    94 int ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
     93errno_t ehci_hc_status(hcd_t *hcd, uint32_t *status);
     94errno_t ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
    9595#endif
    9696/**
  • uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c

    r36f0738 rb7fd2a0  
    4545
    4646
    47 int td_error(const td_t *td)
     47errno_t td_error(const td_t *td)
    4848{
    4949        assert(td);
  • uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h

    r36f0738 rb7fd2a0  
    9090}
    9191
    92 int td_error(const td_t *td);
     92errno_t td_error(const td_t *td);
    9393
    9494void td_init(td_t *td, const td_t *next, usb_direction_t dir, const void * buf,
  • uspace/drv/bus/usb/ehci/main.c

    r36f0738 rb7fd2a0  
    5252#define NAME "ehci"
    5353
    54 static int ehci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
     54static errno_t ehci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
    5555static void ehci_driver_fini(hcd_t *);
    5656
     
    7272
    7373
    74 static int ehci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res,
     74static errno_t ehci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res,
    7575    bool irq)
    7676{
     
    8282                return ENOMEM;
    8383
    84         const int ret = hc_init(instance, res, irq);
     84        const errno_t ret = hc_init(instance, res, irq);
    8585        if (ret == EOK) {
    8686                hcd_set_implementation(hcd, instance, &ehci_hc_driver.ops);
     
    107107 * @return Error code.
    108108 */
    109 static int ehci_dev_add(ddf_dev_t *device)
     109static errno_t ehci_dev_add(ddf_dev_t *device)
    110110{
    111111        usb_log_debug("ehci_dev_add() called\n");
  • uspace/drv/bus/usb/ehci/res.c

    r36f0738 rb7fd2a0  
    6262 * @return Error code.
    6363 */
    64 static int disable_extended_caps(async_sess_t *parent_sess, unsigned eecp)
     64static errno_t disable_extended_caps(async_sess_t *parent_sess, unsigned eecp)
    6565{
    6666        /* nothing to do */
     
    7070        /* Read the first EEC. i.e. Legacy Support register */
    7171        uint32_t usblegsup;
    72         int ret = pci_config_space_read_32(parent_sess,
     72        errno_t ret = pci_config_space_read_32(parent_sess,
    7373            eecp + USBLEGSUP_OFFSET, &usblegsup);
    7474        if (ret != EOK) {
     
    172172}
    173173
    174 int disable_legacy(ddf_dev_t *device)
     174errno_t disable_legacy(ddf_dev_t *device)
    175175{
    176176        assert(device);
     
    184184        hw_res_list_parsed_t res;
    185185        hw_res_list_parsed_init(&res);
    186         int ret = hw_res_get_list_parsed(parent_sess, &res, 0);
     186        errno_t ret = hw_res_get_list_parsed(parent_sess, &res, 0);
    187187        if (ret != EOK) {
    188188                usb_log_error("Failed to get resource list: %s\n",
  • uspace/drv/bus/usb/ehci/res.h

    r36f0738 rb7fd2a0  
    3939#include <device/hw_res_parsed.h>
    4040
    41 extern int disable_legacy(ddf_dev_t *);
     41extern errno_t disable_legacy(ddf_dev_t *);
    4242
    4343#endif
  • uspace/drv/bus/usb/ohci/endpoint_list.c

    r36f0738 rb7fd2a0  
    5151 * Allocates memory for internal ed_t structure.
    5252 */
    53 int endpoint_list_init(endpoint_list_t *instance, const char *name)
     53errno_t endpoint_list_init(endpoint_list_t *instance, const char *name)
    5454{
    5555        assert(instance);
  • uspace/drv/bus/usb/ohci/endpoint_list.h

    r36f0738 rb7fd2a0  
    7171}
    7272
    73 int endpoint_list_init(endpoint_list_t *instance, const char *name);
     73errno_t endpoint_list_init(endpoint_list_t *instance, const char *name);
    7474void endpoint_list_set_next(
    7575    const endpoint_list_t *instance, const endpoint_list_t *next);
  • 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;
  • uspace/drv/bus/usb/ohci/hc.h

    r36f0738 rb7fd2a0  
    8080} hc_t;
    8181
    82 extern int hc_init(hc_t *, const hw_res_list_parsed_t *, bool);
     82extern errno_t hc_init(hc_t *, const hw_res_list_parsed_t *, bool);
    8383extern void hc_fini(hc_t *);
    8484
     
    8686extern void hc_dequeue_endpoint(hc_t *, const endpoint_t *);
    8787
    88 int ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq);
     88errno_t ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq);
    8989
    9090extern void ohci_hc_interrupt(hcd_t *, uint32_t);
    91 extern int ohci_hc_status(hcd_t *, uint32_t *);
    92 extern int ohci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
     91extern errno_t ohci_hc_status(hcd_t *, uint32_t *);
     92extern errno_t ohci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
    9393
    9494#endif
  • uspace/drv/bus/usb/ohci/hw_struct/completion_codes.h

    r36f0738 rb7fd2a0  
    5454};
    5555
    56 inline static int cc_to_rc(unsigned int cc)
     56inline static errno_t cc_to_rc(unsigned int cc)
    5757{
    5858        switch (cc) {
  • uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h

    r36f0738 rb7fd2a0  
    119119 * @return Error code.
    120120 */
    121 static inline int td_error(const td_t *instance)
     121static inline errno_t td_error(const td_t *instance)
    122122{
    123123        assert(instance);
  • uspace/drv/bus/usb/ohci/main.c

    r36f0738 rb7fd2a0  
    4747
    4848#define NAME "ohci"
    49 static int ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
     49static errno_t ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
    5050static void ohci_driver_fini(hcd_t *);
    5151
     
    6666
    6767
    68 static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
     68static errno_t ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
    6969{
    7070        assert(hcd);
     
    7575                return ENOMEM;
    7676
    77         const int ret = hc_init(instance, res, irq);
     77        const errno_t ret = hc_init(instance, res, irq);
    7878        if (ret == EOK) {
    7979                hcd_set_implementation(hcd, instance, &ohci_hc_driver.ops);
     
    100100 * @return Error code.
    101101 */
    102 static int ohci_dev_add(ddf_dev_t *device)
     102static errno_t ohci_dev_add(ddf_dev_t *device)
    103103{
    104104        usb_log_debug("ohci_dev_add() called\n");
  • uspace/drv/bus/usb/ohci/ohci_endpoint.c

    r36f0738 rb7fd2a0  
    7272 * @return Error code.
    7373 */
    74 int ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep)
     74errno_t ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep)
    7575{
    7676        assert(ep);
  • uspace/drv/bus/usb/ohci/ohci_endpoint.h

    r36f0738 rb7fd2a0  
    5353} ohci_endpoint_t;
    5454
    55 int ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep);
     55errno_t ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep);
    5656void ohci_endpoint_fini(hcd_t *hcd, endpoint_t *ep);
    5757
  • uspace/drv/bus/usb/ohci/ohci_rh.c

    r36f0738 rb7fd2a0  
    109109 * initializes internal virtual hub.
    110110 */
    111 int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name)
     111errno_t ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name)
    112112{
    113113        assert(instance);
     
    174174 * status change requests might be postponed until there is something to report.
    175175 */
    176 int ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch)
     176errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch)
    177177{
    178178        assert(instance);
     
    205205 * processing of a postponed request.
    206206 */
    207 int ohci_rh_interrupt(ohci_rh_t *instance)
     207errno_t ohci_rh_interrupt(ohci_rh_t *instance)
    208208{
    209209        //TODO atomic swap needed
     
    245245 * @return Error code.
    246246 */
    247 static int req_get_status(usbvirt_device_t *device,
     247static errno_t req_get_status(usbvirt_device_t *device,
    248248    const usb_device_request_setup_packet_t *setup_packet,
    249249    uint8_t *data, size_t *act_size)
     
    268268 * @return Error code.
    269269 */
    270 static int req_clear_hub_feature(usbvirt_device_t *device,
     270static errno_t req_clear_hub_feature(usbvirt_device_t *device,
    271271    const usb_device_request_setup_packet_t *setup_packet,
    272272    uint8_t *data, size_t *act_size)
     
    298298 * @return Error code.
    299299 */
    300 static int req_get_port_status(usbvirt_device_t *device,
     300static errno_t req_get_port_status(usbvirt_device_t *device,
    301301    const usb_device_request_setup_packet_t *setup_packet,
    302302    uint8_t *data, size_t *act_size)
     
    322322 * @return Error code.
    323323 */
    324 static int req_clear_port_feature(usbvirt_device_t *device,
     324static errno_t req_clear_port_feature(usbvirt_device_t *device,
    325325    const usb_device_request_setup_packet_t *setup_packet,
    326326    uint8_t *data, size_t *act_size)
     
    386386 * @return Error code.
    387387 */
    388 static int req_set_port_feature(usbvirt_device_t *device,
     388static errno_t req_set_port_feature(usbvirt_device_t *device,
    389389    const usb_device_request_setup_packet_t *setup_packet,
    390390    uint8_t *data, size_t *act_size)
     
    437437 * only need 1 byte.
    438438 */
    439 static int req_status_change_handler(usbvirt_device_t *device,
     439static errno_t req_status_change_handler(usbvirt_device_t *device,
    440440    usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
    441441    void *buffer, size_t buffer_size, size_t *actual_size)
  • uspace/drv/bus/usb/ohci/ohci_rh.h

    r36f0738 rb7fd2a0  
    6565} ohci_rh_t;
    6666
    67 int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name);
    68 int ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch);
    69 int ohci_rh_interrupt(ohci_rh_t *instance);
     67errno_t ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name);
     68errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch);
     69errno_t ohci_rh_interrupt(ohci_rh_t *instance);
    7070
    7171/** Get OHCI rh address.
  • 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;
  • uspace/drv/bus/usb/uhci/hc.h

    r36f0738 rb7fd2a0  
    124124} hc_t;
    125125
    126 extern int hc_init(hc_t *, const hw_res_list_parsed_t *, bool);
     126extern errno_t hc_init(hc_t *, const hw_res_list_parsed_t *, bool);
    127127extern void hc_fini(hc_t *);
    128128
    129 extern int uhci_hc_gen_irq_code(irq_code_t *, const hw_res_list_parsed_t *, int *);
     129extern errno_t uhci_hc_gen_irq_code(irq_code_t *, const hw_res_list_parsed_t *, int *);
    130130
    131131extern void uhci_hc_interrupt(hcd_t *, uint32_t);
    132 extern int uhci_hc_status(hcd_t *, uint32_t *);
    133 extern int uhci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
     132extern errno_t uhci_hc_status(hcd_t *, uint32_t *);
     133extern errno_t uhci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
    134134
    135135#endif
  • uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c

    r36f0738 rb7fd2a0  
    119119 * @return Error code.
    120120 */
    121 int td_status(const td_t *instance)
     121errno_t td_status(const td_t *instance)
    122122{
    123123        assert(instance);
  • uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h

    r36f0738 rb7fd2a0  
    102102    const void *buffer, const td_t *next);
    103103
    104 int td_status(const td_t *instance);
     104errno_t td_status(const td_t *instance);
    105105
    106106void td_print_status(const td_t *instance);
  • uspace/drv/bus/usb/uhci/main.c

    r36f0738 rb7fd2a0  
    4949#define NAME "uhci"
    5050
    51 static int uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
     51static errno_t uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
    5252static void uhci_driver_fini(hcd_t *);
    53 static int disable_legacy(ddf_dev_t *);
     53static errno_t disable_legacy(ddf_dev_t *);
    5454
    5555static const ddf_hc_driver_t uhci_hc_driver = {
     
    6767};
    6868
    69 static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
     69static errno_t uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
    7070{
    7171        assert(hcd);
     
    7676                return ENOMEM;
    7777
    78         const int ret = hc_init(instance, res, irq);
     78        const errno_t ret = hc_init(instance, res, irq);
    7979        if (ret == EOK) {
    8080                hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops);
     
    101101 * @return Error code.
    102102 */
    103 static int disable_legacy(ddf_dev_t *device)
     103static errno_t disable_legacy(ddf_dev_t *device)
    104104{
    105105        assert(device);
     
    119119 * @return Error code.
    120120 */
    121 static int uhci_dev_add(ddf_dev_t *device)
     121static errno_t uhci_dev_add(ddf_dev_t *device)
    122122{
    123123        usb_log_debug2("uhci_dev_add() called\n");
  • uspace/drv/bus/usb/uhci/transfer_list.c

    r36f0738 rb7fd2a0  
    5656 * Allocates memory for internal qh_t structure.
    5757 */
    58 int transfer_list_init(transfer_list_t *instance, const char *name)
     58errno_t transfer_list_init(transfer_list_t *instance, const char *name)
    5959{
    6060        assert(instance);
  • uspace/drv/bus/usb/uhci/transfer_list.h

    r36f0738 rb7fd2a0  
    5757
    5858void transfer_list_fini(transfer_list_t *instance);
    59 int transfer_list_init(transfer_list_t *instance, const char *name);
     59errno_t transfer_list_init(transfer_list_t *instance, const char *name);
    6060void transfer_list_set_next(transfer_list_t *instance, transfer_list_t *next);
    6161void transfer_list_add_batch(
  • uspace/drv/bus/usb/uhci/uhci_rh.c

    r36f0738 rb7fd2a0  
    7878 * @return Error code, EOK on success.
    7979 */
    80 int uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name)
     80errno_t uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name)
    8181{
    8282        assert(instance);
     
    9898 * not have to be.
    9999 */
    100 int uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch)
     100errno_t uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch)
    101101{
    102102        assert(instance);
     
    193193 * it is usefull for debuging purposes only.
    194194 */
    195 static int req_get_port_state(usbvirt_device_t *device,
     195static errno_t req_get_port_state(usbvirt_device_t *device,
    196196    const usb_device_request_setup_packet_t *setup_packet,
    197197    uint8_t *data, size_t *act_size)
     
    228228 * @note: reset change status needs to be handled in sw.
    229229 */
    230 static int req_get_port_status(usbvirt_device_t *device,
     230static errno_t req_get_port_status(usbvirt_device_t *device,
    231231    const usb_device_request_setup_packet_t *setup_packet,
    232232    uint8_t *data, size_t *act_size)
     
    267267 * @return Error code.
    268268 */
    269 static int req_clear_port_feature(usbvirt_device_t *device,
     269static errno_t req_clear_port_feature(usbvirt_device_t *device,
    270270    const usb_device_request_setup_packet_t *setup_packet,
    271271    uint8_t *data, size_t *act_size)
     
    340340 * @return Error code.
    341341 */
    342 static int req_set_port_feature(usbvirt_device_t *device,
     342static errno_t req_set_port_feature(usbvirt_device_t *device,
    343343    const usb_device_request_setup_packet_t *setup_packet,
    344344    uint8_t *data, size_t *act_size)
     
    402402 * only need 1 byte.
    403403 */
    404 static int req_status_change_handler(usbvirt_device_t *device,
     404static errno_t req_status_change_handler(usbvirt_device_t *device,
    405405    usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
    406406    void *buffer, size_t buffer_size, size_t *actual_size)
  • uspace/drv/bus/usb/uhci/uhci_rh.h

    r36f0738 rb7fd2a0  
    5656} uhci_rh_t;
    5757
    58 int uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name);
    59 int uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch);
     58errno_t uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name);
     59errno_t uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch);
    6060
    6161/** Get UHCI rh address.
  • uspace/drv/bus/usb/usbflbk/main.c

    r36f0738 rb7fd2a0  
    4646 * @return Error code.
    4747 */
    48 static int usbfallback_device_add(usb_device_t *dev)
     48static errno_t usbfallback_device_add(usb_device_t *dev)
    4949{
    5050        usb_log_info("Pretending to control %s `%s'.\n",
     
    5959 * @return Error code.
    6060 */
    61 static int usbfallback_device_gone(usb_device_t *dev)
     61static errno_t usbfallback_device_gone(usb_device_t *dev)
    6262{
    6363        assert(dev);
  • uspace/drv/bus/usb/usbhub/port.c

    r36f0738 rb7fd2a0  
    5454};
    5555
    56 static int usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub);
     56static errno_t usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub);
    5757static void usb_hub_port_reset_completed(usb_hub_port_t *port,
    5858    usb_hub_dev_t *hub, usb_port_status_t status);
    59 static int get_port_status(usb_hub_port_t *port, usb_port_status_t *status);
    60 static int add_device_phase1_worker_fibril(void *arg);
    61 static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,
     59static errno_t get_port_status(usb_hub_port_t *port, usb_port_status_t *status);
     60static errno_t add_device_phase1_worker_fibril(void *arg);
     61static errno_t create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,
    6262    usb_speed_t speed);
    6363
    64 int usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub)
     64errno_t usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub)
    6565{
    6666        assert(port);
     
    7777 * @return Operation result
    7878 */
    79 int usb_hub_port_clear_feature(
     79errno_t usb_hub_port_clear_feature(
    8080    usb_hub_port_t *port, usb_hub_class_feature_t feature)
    8181{
     
    9999 * @return Operation result
    100100 */
    101 int usb_hub_port_set_feature(
     101errno_t usb_hub_port_set_feature(
    102102    usb_hub_port_t *port, usb_hub_class_feature_t feature)
    103103{
     
    143143
    144144        usb_port_status_t status = 0;
    145         const int opResult = get_port_status(port, &status);
     145        const errno_t opResult = get_port_status(port, &status);
    146146        if (opResult != EOK) {
    147147                usb_log_error("(%p-%u): Failed to get port status: %s.\n", hub,
     
    158158
    159159                /* ACK the change */
    160                 const int opResult = usb_hub_port_clear_feature(port,
     160                const errno_t opResult = usb_hub_port_clear_feature(port,
    161161                    USB_HUB_FEATURE_C_PORT_CONNECTION);
    162162                if (opResult != EOK) {
     
    167167
    168168                if (connected) {
    169                         const int opResult = create_add_device_fibril(port, hub,
     169                        const errno_t opResult = create_add_device_fibril(port, hub,
    170170                            usb_port_speed(status));
    171171                        if (opResult != EOK) {
     
    191191                   port->port_number);
    192192                usb_hub_port_device_gone(port, hub);
    193                 const int rc = usb_hub_port_clear_feature(port,
     193                const errno_t rc = usb_hub_port_clear_feature(port,
    194194                        USB_HUB_FEATURE_C_PORT_ENABLE);
    195195                if (rc != EOK) {
     
    206206                    " NOT happen as we do not support suspend state!", hub,
    207207                    port->port_number);
    208                 const int rc = usb_hub_port_clear_feature(port,
     208                const errno_t rc = usb_hub_port_clear_feature(port,
    209209                        USB_HUB_FEATURE_C_PORT_SUSPEND);
    210210                if (rc != EOK) {
     
    224224                 * mode. USB system software is responsible for powering port
    225225                 * back on when the over-current condition is gone */
    226                 const int rc = usb_hub_port_clear_feature(port,
     226                const errno_t rc = usb_hub_port_clear_feature(port,
    227227                    USB_HUB_FEATURE_C_PORT_OVER_CURRENT);
    228228                if (rc != EOK) {
     
    232232                }
    233233                if (!(status & ~USB_HUB_PORT_STATUS_OC)) {
    234                         const int rc = usb_hub_port_set_feature(
     234                        const errno_t rc = usb_hub_port_set_feature(
    235235                            port, USB_HUB_FEATURE_PORT_POWER);
    236236                        if (rc != EOK) {
     
    260260 * @param hub hub representation
    261261 */
    262 int usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub)
     262errno_t usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub)
    263263{
    264264        assert(port);
     
    267267        if (!exch)
    268268                return ENOMEM;
    269         const int rc = usb_device_remove(exch, port->port_number);
     269        const errno_t rc = usb_device_remove(exch, port->port_number);
    270270        usb_device_bus_exchange_end(exch);
    271271        if (rc == EOK)
     
    304304
    305305        /* Clear the port reset change. */
    306         int rc = usb_hub_port_clear_feature(port, USB_HUB_FEATURE_C_PORT_RESET);
     306        errno_t rc = usb_hub_port_clear_feature(port, USB_HUB_FEATURE_C_PORT_RESET);
    307307        if (rc != EOK) {
    308308                usb_log_error("(%p-%u): Failed to clear port reset change: %s.",
     
    317317 * @return Error code.
    318318 */
    319 static int get_port_status(usb_hub_port_t *port, usb_port_status_t *status)
     319static errno_t get_port_status(usb_hub_port_t *port, usb_port_status_t *status)
    320320{
    321321        assert(port);
     
    333333        usb_port_status_t status_tmp;
    334334
    335         const int rc = usb_pipe_control_read(port->control_pipe,
     335        const errno_t rc = usb_pipe_control_read(port->control_pipe,
    336336            &request, sizeof(usb_device_request_setup_packet_t),
    337337            &status_tmp, sizeof(status_tmp), &recv_size);
     
    351351}
    352352
    353 static int port_enable(usb_hub_port_t *port, usb_hub_dev_t *hub, bool enable)
     353static errno_t port_enable(usb_hub_port_t *port, usb_hub_dev_t *hub, bool enable)
    354354{
    355355        if (enable) {
    356                 int rc =
     356                errno_t rc =
    357357                    usb_hub_port_set_feature(port, USB_HUB_FEATURE_PORT_RESET);
    358358                if (rc != EOK) {
     
    383383 * @return 0 Always.
    384384 */
    385 int add_device_phase1_worker_fibril(void *arg)
     385errno_t add_device_phase1_worker_fibril(void *arg)
    386386{
    387387        struct add_device_phase1 *params = arg;
    388388        assert(params);
    389389
    390         int ret = EOK;
     390        errno_t ret = EOK;
    391391        usb_hub_dev_t *hub = params->hub;
    392392        usb_hub_port_t *port = params->port;
     
    434434                usb_log_error("(%p-%u): Failed to enumerate device: %s", hub,
    435435                    port->port_number, str_error(ret));
    436                 const int ret = port_enable(port, hub, false);
     436                const errno_t ret = port_enable(port, hub, false);
    437437                if (ret != EOK) {
    438438                        usb_log_warning("(%p-%u)Failed to disable port (%s), "
     
    440440                            port->port_number, str_error(ret));
    441441                } else {
    442                         const int ret = usb_release_default_address(exch);
     442                        const errno_t ret = usb_release_default_address(exch);
    443443                        if (ret != EOK)
    444444                                usb_log_warning("(%p-%u): Failed to release "
     
    475475 * @return Error code.
    476476 */
    477 static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,
     477static errno_t create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,
    478478    usb_speed_t speed)
    479479{
  • uspace/drv/bus/usb/usbhub/port.h

    r36f0738 rb7fd2a0  
    8383}
    8484
    85 int usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub);
    86 int usb_hub_port_clear_feature(
     85errno_t usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub);
     86errno_t usb_hub_port_clear_feature(
    8787    usb_hub_port_t *port, usb_hub_class_feature_t feature);
    88 int usb_hub_port_set_feature(
     88errno_t usb_hub_port_set_feature(
    8989    usb_hub_port_t *port, usb_hub_class_feature_t feature);
    9090void usb_hub_port_reset_fail(usb_hub_port_t *port);
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r36f0738 rb7fd2a0  
    8181};
    8282
    83 static int usb_set_first_configuration(usb_device_t *usb_device);
    84 static int usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev);
     83static errno_t usb_set_first_configuration(usb_device_t *usb_device);
     84static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev);
    8585static void usb_hub_over_current(const usb_hub_dev_t *hub_dev,
    8686    usb_hub_status_t status);
     
    9797 * @return error code
    9898 */
    99 int usb_hub_device_add(usb_device_t *usb_dev)
     99errno_t usb_hub_device_add(usb_device_t *usb_dev)
    100100{
    101101        assert(usb_dev);
     
    114114
    115115        /* Set hub's first configuration. (There should be only one) */
    116         int opResult = usb_set_first_configuration(usb_dev);
     116        errno_t opResult = usb_set_first_configuration(usb_dev);
    117117        if (opResult != EOK) {
    118118                usb_log_error("Could not set hub configuration: %s\n",
     
    174174 * @return error code
    175175 */
    176 int usb_hub_device_remove(usb_device_t *usb_dev)
     176errno_t usb_hub_device_remove(usb_device_t *usb_dev)
    177177{
    178178        return ENOTSUP;
     
    184184 * @return error code
    185185 */
    186 int usb_hub_device_gone(usb_device_t *usb_dev)
     186errno_t usb_hub_device_gone(usb_device_t *usb_dev)
    187187{
    188188        assert(usb_dev);
     
    202202
    203203        for (size_t port = 0; port < hub->port_count; ++port) {
    204                 const int ret = usb_hub_port_fini(&hub->ports[port], hub);
     204                const errno_t ret = usb_hub_port_fini(&hub->ports[port], hub);
    205205                if (ret != EOK)
    206206                        return ret;
     
    208208        free(hub->ports);
    209209
    210         const int ret = ddf_fun_unbind(hub->hub_fun);
     210        const errno_t ret = ddf_fun_unbind(hub->hub_fun);
    211211        if (ret != EOK) {
    212212                usb_log_error("(%p) Failed to unbind '%s' function: %s.",
     
    266266 * @return error code
    267267 */
    268 static int usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev)
     268static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev)
    269269{
    270270        assert(hub_dev);
     
    277277        usb_hub_descriptor_header_t descriptor;
    278278        size_t received_size;
    279         int opResult = usb_request_get_descriptor(control_pipe,
     279        errno_t opResult = usb_request_get_descriptor(control_pipe,
    280280            USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_DEVICE,
    281281            USB_DESCTYPE_HUB, 0, 0, &descriptor,
     
    317317        for (unsigned int port = 0; port < hub_dev->port_count; ++port) {
    318318                usb_log_debug("(%p): Powering port %u.", hub_dev, port);
    319                 const int ret = usb_hub_port_set_feature(
     319                const errno_t ret = usb_hub_port_set_feature(
    320320                    &hub_dev->ports[port], USB_HUB_FEATURE_PORT_POWER);
    321321
     
    343343 * @return error code
    344344 */
    345 static int usb_set_first_configuration(usb_device_t *usb_device)
     345static errno_t usb_set_first_configuration(usb_device_t *usb_device)
    346346{
    347347        assert(usb_device);
     
    369369        /* Set configuration. Use the configuration that was in
    370370         * usb_device->descriptors.configuration i.e. The first one. */
    371         const int opResult = usb_request_set_configuration(
     371        const errno_t opResult = usb_request_set_configuration(
    372372            usb_device_get_default_pipe(usb_device),
    373373            config_descriptor->configuration_number);
     
    406406        /* Over-current condition is gone, it is safe to turn the ports on. */
    407407        for (size_t port = 0; port < hub_dev->port_count; ++port) {
    408                 const int ret = usb_hub_port_set_feature(
     408                const errno_t ret = usb_hub_port_set_feature(
    409409                    &hub_dev->ports[port], USB_HUB_FEATURE_PORT_POWER);
    410410                if (ret != EOK) {
     
    438438        /* NOTE: We can't use standard USB GET_STATUS request, because
    439439         * hubs reply is 4byte instead of 2 */
    440         const int opResult = usb_pipe_control_read(control_pipe,
     440        const errno_t opResult = usb_pipe_control_read(control_pipe,
    441441            &get_hub_status_request, sizeof(get_hub_status_request),
    442442            &status, sizeof(usb_hub_status_t), &rcvd_size);
     
    456456                usb_hub_over_current(hub_dev, status);
    457457                /* Ack change in hub OC flag */
    458                 const int ret = usb_request_clear_feature(
     458                const errno_t ret = usb_request_clear_feature(
    459459                    control_pipe, USB_REQUEST_TYPE_CLASS,
    460460                    USB_REQUEST_RECIPIENT_DEVICE,
     
    480480                 * Just ACK the change.
    481481                 */
    482                 const int ret = usb_request_clear_feature(
     482                const errno_t ret = usb_request_clear_feature(
    483483                    control_pipe, USB_REQUEST_TYPE_CLASS,
    484484                    USB_REQUEST_RECIPIENT_DEVICE,
  • uspace/drv/bus/usb/usbhub/usbhub.h

    r36f0738 rb7fd2a0  
    8383extern const usb_endpoint_description_t hub_status_change_endpoint_description;
    8484
    85 extern int usb_hub_device_add(usb_device_t *);
    86 extern int usb_hub_device_remove(usb_device_t *);
    87 extern int usb_hub_device_gone(usb_device_t *);
     85extern errno_t usb_hub_device_add(usb_device_t *);
     86extern errno_t usb_hub_device_remove(usb_device_t *);
     87extern errno_t usb_hub_device_gone(usb_device_t *);
    8888
    8989extern bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t,
  • uspace/drv/bus/usb/usbmid/explore.c

    r36f0738 rb7fd2a0  
    6666 * @param list List where to add the interfaces.
    6767 */
    68 static int create_interfaces(const uint8_t *config_descriptor,
     68static errno_t create_interfaces(const uint8_t *config_descriptor,
    6969    size_t config_descriptor_size, list_t *list, usb_device_t *usb_dev)
    7070{
     
    111111
    112112                usbmid_interface_t *iface = NULL;
    113                 const int rc = usbmid_spawn_interface_child(usb_dev, &iface,
     113                const errno_t rc = usbmid_spawn_interface_child(usb_dev, &iface,
    114114                        &usb_device_descriptors(usb_dev)->device, interface);
    115115                if (rc != EOK) {
     
    134134 * @return Whether to accept this device.
    135135 */
    136 int usbmid_explore_device(usb_device_t *dev)
     136errno_t usbmid_explore_device(usb_device_t *dev)
    137137{
    138138        assert(dev);
     
    157157
    158158        /* Select the first configuration */
    159         int rc = usb_request_set_configuration(usb_device_get_default_pipe(dev),
     159        errno_t rc = usb_request_set_configuration(usb_device_get_default_pipe(dev),
    160160            config_descriptor->configuration_number);
    161161        if (rc != EOK) {
  • uspace/drv/bus/usb/usbmid/main.c

    r36f0738 rb7fd2a0  
    4949 * @return Error code.
    5050 */
    51 static int usbmid_device_add(usb_device_t *dev)
     51static errno_t usbmid_device_add(usb_device_t *dev)
    5252{
    5353        usb_log_info("Taking care of new MID `%s'.\n", usb_device_get_name(dev));
     
    6161 * @return Error code.
    6262 */
    63 static int usbmid_device_remove(usb_device_t *dev)
     63static errno_t usbmid_device_remove(usb_device_t *dev)
    6464{
    6565        assert(dev);
     
    6868
    6969        /* Remove ctl function */
    70         int ret = ddf_fun_unbind(usb_mid->ctl_fun);
     70        errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun);
    7171        if (ret != EOK) {
    7272                usb_log_error("Failed to unbind USB MID ctl function: %s.\n",
     
    8787
    8888                /* Tell the child to go off-line. */
    89                 int pret = ddf_fun_offline(iface->fun);
     89                errno_t pret = ddf_fun_offline(iface->fun);
    9090                if (pret != EOK) {
    9191                        usb_log_warning("Failed to turn off child `%s': %s\n",
     
    110110 * @return Error code.
    111111 */
    112 static int usbmid_device_gone(usb_device_t *dev)
     112static errno_t usbmid_device_gone(usb_device_t *dev)
    113113{
    114114        assert(dev);
     
    119119
    120120        /* Remove ctl function */
    121         int ret = ddf_fun_unbind(usb_mid->ctl_fun);
     121        errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun);
    122122        if (ret != EOK) {
    123123                usb_log_error("Failed to unbind USB MID ctl function: %s.\n",
     
    137137                    ddf_fun_get_name(iface->fun));
    138138
    139                 const int pret = usbmid_interface_destroy(iface);
     139                const errno_t pret = usbmid_interface_destroy(iface);
    140140                if (pret != EOK) {
    141141                        usb_log_error("Failed to remove child `%s': %s\n",
  • uspace/drv/bus/usb/usbmid/usbmid.c

    r36f0738 rb7fd2a0  
    5151 * @return Error code.
    5252 */
    53 static int usb_iface_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
     53static errno_t usb_iface_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
    5454{
    5555        assert(fun);
     
    6161
    6262/** Callback for DDF USB get interface. */
    63 static int usb_iface_iface_no(ddf_fun_t *fun, int *iface_no)
     63static errno_t usb_iface_iface_no(ddf_fun_t *fun, int *iface_no)
    6464{
    6565        usbmid_interface_t *iface = ddf_fun_data_get(fun);
     
    8383};
    8484
    85 int usbmid_interface_destroy(usbmid_interface_t *mid_iface)
     85errno_t usbmid_interface_destroy(usbmid_interface_t *mid_iface)
    8686{
    8787        assert(mid_iface);
    8888        assert_link_not_used(&mid_iface->link);
    89         const int ret = ddf_fun_unbind(mid_iface->fun);
     89        const errno_t ret = ddf_fun_unbind(mid_iface->fun);
    9090        if (ret != EOK) {
    9191                return ret;
     
    103103 * @return Error code.
    104104 */
    105 int usbmid_spawn_interface_child(usb_device_t *parent,
     105errno_t usbmid_spawn_interface_child(usb_device_t *parent,
    106106    usbmid_interface_t **iface_ret,
    107107    const usb_standard_device_descriptor_t *device_descriptor,
     
    110110        ddf_fun_t *child = NULL;
    111111        char *child_name = NULL;
    112         int rc;
     112        errno_t rc;
    113113
    114114        /*
  • uspace/drv/bus/usb/usbmid/usbmid.h

    r36f0738 rb7fd2a0  
    6262} usb_mid_t;
    6363
    64 extern int usbmid_explore_device(usb_device_t *);
    65 extern int usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t **,
     64extern errno_t usbmid_explore_device(usb_device_t *);
     65extern errno_t usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t **,
    6666    const usb_standard_device_descriptor_t *,
    6767    const usb_standard_interface_descriptor_t *);
    6868extern void usbmid_dump_descriptors(uint8_t *, size_t);
    69 extern int usbmid_interface_destroy(usbmid_interface_t *mid_iface);
     69extern errno_t usbmid_interface_destroy(usbmid_interface_t *mid_iface);
    7070
    7171static inline usbmid_interface_t * usbmid_interface_from_link(link_t *item)
  • uspace/drv/bus/usb/vhc/conndev.c

    r36f0738 rb7fd2a0  
    7575        }
    7676       
    77         int data_request_rc;
    78         int opening_request_rc;
     77        errno_t data_request_rc;
     78        errno_t opening_request_rc;
    7979        async_wait_for(data_request, &data_request_rc);
    8080        async_wait_for(opening_request, &opening_request_rc);
     
    102102       
    103103        if (callback) {
    104                 int rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle);
     104                errno_t rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle);
    105105                if (rc != EOK) {
    106106                        async_answer_0(icallid, rc);
  • uspace/drv/bus/usb/vhc/devconn.c

    r36f0738 rb7fd2a0  
    4949}
    5050
    51 static int vhc_virtdev_plug_generic(vhc_data_t *vhc,
     51static errno_t vhc_virtdev_plug_generic(vhc_data_t *vhc,
    5252    async_sess_t *sess, usbvirt_device_t *virtdev,
    5353    uintptr_t *handle, bool connect, usb_address_t address)
     
    8585}
    8686
    87 int vhc_virtdev_plug(vhc_data_t *vhc, async_sess_t *sess, uintptr_t *handle)
     87errno_t vhc_virtdev_plug(vhc_data_t *vhc, async_sess_t *sess, uintptr_t *handle)
    8888{
    8989        return vhc_virtdev_plug_generic(vhc, sess, NULL, handle, true, 0);
    9090}
    9191
    92 int vhc_virtdev_plug_local(vhc_data_t *vhc, usbvirt_device_t *dev, uintptr_t *handle)
     92errno_t vhc_virtdev_plug_local(vhc_data_t *vhc, usbvirt_device_t *dev, uintptr_t *handle)
    9393{
    9494        return vhc_virtdev_plug_generic(vhc, NULL, dev, handle, true, 0);
    9595}
    9696
    97 int vhc_virtdev_plug_hub(vhc_data_t *vhc, usbvirt_device_t *dev,
     97errno_t vhc_virtdev_plug_hub(vhc_data_t *vhc, usbvirt_device_t *dev,
    9898    uintptr_t *handle, usb_address_t address)
    9999{
  • uspace/drv/bus/usb/vhc/hub/hub.c

    r36f0738 rb7fd2a0  
    6363static void set_port_status_change(hub_port_t *, hub_status_change_t);
    6464static void clear_port_status_change(hub_port_t *, uint16_t);
    65 static int set_port_state_delayed_fibril(void *);
     65static errno_t set_port_state_delayed_fibril(void *);
    6666static void set_port_state_delayed(hub_t *, size_t, suseconds_t,
    6767    hub_port_state_t, hub_port_state_t);
     
    163163 * @return Error code.
    164164 */
    165 int hub_disconnect_device(hub_t *hub, void *device)
     165errno_t hub_disconnect_device(hub_t *hub, void *device)
    166166{
    167167        size_t index = hub_find_device(hub, device);
     
    461461 * @return Always EOK.
    462462 */
    463 static int set_port_state_delayed_fibril(void *arg)
     463static errno_t set_port_state_delayed_fibril(void *arg)
    464464{
    465465        struct delay_port_state_change *change
  • uspace/drv/bus/usb/vhc/hub/hub.h

    r36f0738 rb7fd2a0  
    102102void hub_init(hub_t *);
    103103size_t hub_connect_device(hub_t *, void *);
    104 int hub_disconnect_device(hub_t *, void *);
     104errno_t hub_disconnect_device(hub_t *, void *);
    105105size_t hub_find_device(hub_t *, void *);
    106106void hub_acquire(hub_t *);
  • uspace/drv/bus/usb/vhc/hub/virthub.c

    r36f0738 rb7fd2a0  
    147147 * @return Error code.
    148148 */
    149 int virthub_init(usbvirt_device_t *dev, const char* name)
     149errno_t virthub_init(usbvirt_device_t *dev, const char* name)
    150150{
    151151        if (dev == NULL) {
     
    197197 * @return Error code.
    198198 */
    199 int virthub_disconnect_device(usbvirt_device_t *dev, vhc_virtdev_t *conn)
     199errno_t virthub_disconnect_device(usbvirt_device_t *dev, vhc_virtdev_t *conn)
    200200{
    201201        assert(dev != NULL);
  • uspace/drv/bus/usb/vhc/hub/virthub.h

    r36f0738 rb7fd2a0  
    8080extern hub_descriptor_t hub_descriptor;
    8181
    82 int virthub_init(usbvirt_device_t *, const char *name);
     82errno_t virthub_init(usbvirt_device_t *, const char *name);
    8383int virthub_connect_device(usbvirt_device_t *, vhc_virtdev_t *);
    84 int virthub_disconnect_device(usbvirt_device_t *, vhc_virtdev_t *);
     84errno_t virthub_disconnect_device(usbvirt_device_t *, vhc_virtdev_t *);
    8585bool virthub_is_device_enabled(usbvirt_device_t *, vhc_virtdev_t *);
    8686void virthub_get_status(usbvirt_device_t *, char *, size_t);
  • uspace/drv/bus/usb/vhc/hub/virthubops.c

    r36f0738 rb7fd2a0  
    6363
    6464/** Callback for data request. */
    65 static int req_on_status_change_pipe(usbvirt_device_t *dev,
     65static errno_t req_on_status_change_pipe(usbvirt_device_t *dev,
    6666    usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
    6767    void *buffer, size_t buffer_size, size_t *actual_size)
     
    109109 * @return Error code.
    110110 */
    111 static int req_clear_hub_feature(usbvirt_device_t *dev,
     111static errno_t req_clear_hub_feature(usbvirt_device_t *dev,
    112112    const usb_device_request_setup_packet_t *request, uint8_t *data,
    113113    size_t *act_size)
     
    123123 * @return Error code.
    124124 */
    125 static int req_clear_port_feature(usbvirt_device_t *dev,
    126     const usb_device_request_setup_packet_t *request, uint8_t *data,
    127     size_t *act_size)
    128 {
    129         int rc;
     125static errno_t req_clear_port_feature(usbvirt_device_t *dev,
     126    const usb_device_request_setup_packet_t *request, uint8_t *data,
     127    size_t *act_size)
     128{
     129        errno_t rc;
    130130        size_t port = request->index - 1;
    131131        usb_hub_class_feature_t feature = request->value;
     
    203203 * @return Error code.
    204204 */
    205 static int req_get_bus_state(usbvirt_device_t *dev,
     205static errno_t req_get_bus_state(usbvirt_device_t *dev,
    206206    const usb_device_request_setup_packet_t *request, uint8_t *data,
    207207    size_t *act_size)
     
    217217 * @return Error code.
    218218 */
    219 static int req_get_descriptor(usbvirt_device_t *dev,
     219static errno_t req_get_descriptor(usbvirt_device_t *dev,
    220220    const usb_device_request_setup_packet_t *request, uint8_t *data,
    221221    size_t *act_size)
     
    238238 * @return Error code.
    239239 */
    240 static int req_get_hub_status(usbvirt_device_t *dev,
     240static errno_t req_get_hub_status(usbvirt_device_t *dev,
    241241    const usb_device_request_setup_packet_t *request, uint8_t *data,
    242242    size_t *act_size)
     
    257257 * @return Error code.
    258258 */
    259 static int req_get_port_status(usbvirt_device_t *dev,
     259static errno_t req_get_port_status(usbvirt_device_t *dev,
    260260    const usb_device_request_setup_packet_t *request, uint8_t *data,
    261261    size_t *act_size)
     
    282282 * @return Error code.
    283283 */
    284 static int req_set_hub_feature(usbvirt_device_t *dev,
     284static errno_t req_set_hub_feature(usbvirt_device_t *dev,
    285285    const usb_device_request_setup_packet_t *request, uint8_t *data,
    286286    size_t *act_size)
     
    296296 * @return Error code.
    297297 */
    298 static int req_set_port_feature(usbvirt_device_t *dev,
    299     const usb_device_request_setup_packet_t *request, uint8_t *data,
    300     size_t *act_size)
    301 {
    302         int rc = ENOTSUP;
     298static errno_t req_set_port_feature(usbvirt_device_t *dev,
     299    const usb_device_request_setup_packet_t *request, uint8_t *data,
     300    size_t *act_size)
     301{
     302        errno_t rc = ENOTSUP;
    303303        size_t port = request->index - 1;
    304304        usb_hub_class_feature_t feature = request->value;
  • uspace/drv/bus/usb/vhc/main.c

    r36f0738 rb7fd2a0  
    4949};
    5050
    51 static int vhc_control_node(ddf_dev_t *dev, ddf_fun_t **fun)
     51static errno_t vhc_control_node(ddf_dev_t *dev, ddf_fun_t **fun)
    5252{
    5353        assert(dev);
     
    6363        }
    6464        ddf_fun_set_ops(*fun, &vhc_ops);
    65         const int ret = ddf_fun_bind(*fun);
     65        const errno_t ret = ddf_fun_bind(*fun);
    6666        if (ret != EOK) {
    6767                ddf_fun_destroy(*fun);
     
    7777};
    7878
    79 static int vhc_dev_add(ddf_dev_t *dev)
     79static errno_t vhc_dev_add(ddf_dev_t *dev)
    8080{
    8181        /* Initialize virtual structure */
    8282        ddf_fun_t *ctl_fun = NULL;
    83         int ret = vhc_control_node(dev, &ctl_fun);
     83        errno_t ret = vhc_control_node(dev, &ctl_fun);
    8484        if (ret != EOK) {
    8585                usb_log_error("Failed to setup control node.\n");
  • uspace/drv/bus/usb/vhc/transfer.c

    r36f0738 rb7fd2a0  
    5858}
    5959
    60 static int process_transfer_local(usb_transfer_batch_t *batch,
     60static errno_t process_transfer_local(usb_transfer_batch_t *batch,
    6161    usbvirt_device_t *dev, size_t *actual_data_size)
    6262{
    63         int rc;
     63        errno_t rc;
    6464       
    6565        const usb_direction_t dir = usb_transfer_batch_direction(batch);
     
    9494}
    9595
    96 static int process_transfer_remote(usb_transfer_batch_t *batch,
     96static errno_t process_transfer_remote(usb_transfer_batch_t *batch,
    9797    async_sess_t *sess, size_t *actual_data_size)
    9898{
    99         int rc;
     99        errno_t rc;
    100100
    101101        const usb_direction_t dir = usb_transfer_batch_direction(batch);
     
    143143
    144144static void execute_transfer_callback_and_free(vhc_transfer_t *transfer,
    145     size_t data_transfer_size, int outcome)
     145    size_t data_transfer_size, errno_t outcome)
    146146{
    147147        assert(outcome != ENAK);
     
    154154}
    155155
    156 int vhc_init(vhc_data_t *instance)
     156errno_t vhc_init(vhc_data_t *instance)
    157157{
    158158        assert(instance);
     
    163163}
    164164
    165 int vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
     165errno_t vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
    166166{
    167167        assert(hcd);
     
    199199}
    200200
    201 int vhc_transfer_queue_processor(void *arg)
     201errno_t vhc_transfer_queue_processor(void *arg)
    202202{
    203203        vhc_virtdev_t *dev = arg;
     
    214214                fibril_mutex_unlock(&dev->guard);
    215215
    216                 int rc = EOK;
     216                errno_t rc = EOK;
    217217                size_t data_transfer_size = 0;
    218218                if (dev->dev_sess) {
  • uspace/drv/bus/usb/vhc/vhcd.h

    r36f0738 rb7fd2a0  
    7171    ipc_call_t *icall);
    7272
    73 int vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *);
    74 int vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *);
    75 int vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, usb_address_t address);
     73errno_t vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *);
     74errno_t vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *);
     75errno_t vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, usb_address_t address);
    7676void vhc_virtdev_unplug(vhc_data_t *, uintptr_t);
    7777
    78 int vhc_init(vhc_data_t *instance);
    79 int vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
    80 int vhc_transfer_queue_processor(void *arg);
     78errno_t vhc_init(vhc_data_t *instance);
     79errno_t vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
     80errno_t vhc_transfer_queue_processor(void *arg);
    8181
    8282#endif
Note: See TracChangeset for help on using the changeset viewer.