Changeset b7fd2a0 in mainline for uspace/lib/usbhost/include


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/lib/usbhost/include/usb/host
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/ddf_helpers.h

    r36f0738 rb7fd2a0  
    4545#include <device/hw_res_parsed.h>
    4646
    47 typedef int (*driver_init_t)(hcd_t *, const hw_res_list_parsed_t *, bool);
     47typedef errno_t (*driver_init_t)(hcd_t *, const hw_res_list_parsed_t *, bool);
    4848typedef void (*driver_fini_t)(hcd_t *);
    49 typedef int (*claim_t)(ddf_dev_t *);
    50 typedef int (*irq_code_gen_t)(irq_code_t *, const hw_res_list_parsed_t *, int *);
     49typedef errno_t (*claim_t)(ddf_dev_t *);
     50typedef errno_t (*irq_code_gen_t)(irq_code_t *, const hw_res_list_parsed_t *, int *);
    5151
    5252typedef struct {
     
    6161} ddf_hc_driver_t;
    6262
    63 int hcd_ddf_add_hc(ddf_dev_t *device, const ddf_hc_driver_t *driver);
     63errno_t hcd_ddf_add_hc(ddf_dev_t *device, const ddf_hc_driver_t *driver);
    6464
    65 int hcd_ddf_setup_hc(ddf_dev_t *device, usb_speed_t max_speed,
     65errno_t hcd_ddf_setup_hc(ddf_dev_t *device, usb_speed_t max_speed,
    6666    size_t bw, bw_count_func_t bw_count);
    6767void hcd_ddf_clean_hc(ddf_dev_t *device);
    68 int hcd_ddf_setup_root_hub(ddf_dev_t *device);
     68errno_t hcd_ddf_setup_root_hub(ddf_dev_t *device);
    6969
    7070hcd_t *dev_to_hcd(ddf_dev_t *dev);
    7171
    72 int hcd_ddf_enable_interrupt(ddf_dev_t *device, int);
    73 int hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res);
    74 int hcd_ddf_setup_interrupts(ddf_dev_t *device,
     72errno_t hcd_ddf_enable_interrupt(ddf_dev_t *device, int);
     73errno_t hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res);
     74errno_t hcd_ddf_setup_interrupts(ddf_dev_t *device,
    7575    const hw_res_list_parsed_t *hw_res,
    7676    interrupt_handler_t handler,
    77     int (*gen_irq_code)(irq_code_t *, const hw_res_list_parsed_t *, int *),
     77    errno_t (*gen_irq_code)(irq_code_t *, const hw_res_list_parsed_t *, int *),
    7878    cap_handle_t *handle);
    7979void ddf_hcd_gen_irq_handler(ipc_call_t *call, ddf_dev_t *dev);
  • uspace/lib/usbhost/include/usb/host/hcd.h

    r36f0738 rb7fd2a0  
    4949typedef struct hcd hcd_t;
    5050
    51 typedef int (*schedule_hook_t)(hcd_t *, usb_transfer_batch_t *);
    52 typedef int (*ep_add_hook_t)(hcd_t *, endpoint_t *);
     51typedef errno_t (*schedule_hook_t)(hcd_t *, usb_transfer_batch_t *);
     52typedef errno_t (*ep_add_hook_t)(hcd_t *, endpoint_t *);
    5353typedef void (*ep_remove_hook_t)(hcd_t *, endpoint_t *);
    5454typedef void (*interrupt_hook_t)(hcd_t *, uint32_t);
    55 typedef int (*status_hook_t)(hcd_t *, uint32_t *);
     55typedef errno_t (*status_hook_t)(hcd_t *, uint32_t *);
    5656
    5757typedef struct {
     
    102102}
    103103
    104 extern int hcd_request_address(hcd_t *, usb_speed_t, usb_address_t *);
     104extern errno_t hcd_request_address(hcd_t *, usb_speed_t, usb_address_t *);
    105105
    106 extern int hcd_release_address(hcd_t *, usb_address_t);
     106extern errno_t hcd_release_address(hcd_t *, usb_address_t);
    107107
    108 extern int hcd_reserve_default_address(hcd_t *, usb_speed_t);
     108extern errno_t hcd_reserve_default_address(hcd_t *, usb_speed_t);
    109109
    110 static inline int hcd_release_default_address(hcd_t *hcd)
     110static inline errno_t hcd_release_default_address(hcd_t *hcd)
    111111{
    112112        return hcd_release_address(hcd, USB_ADDRESS_DEFAULT);
    113113}
    114114
    115 extern int hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t,
     115extern errno_t hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t,
    116116    usb_transfer_type_t, size_t, unsigned int, size_t, usb_address_t,
    117117    unsigned int);
    118118
    119 extern int hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t);
     119extern errno_t hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t);
    120120
    121 extern int hcd_send_batch(hcd_t *, usb_target_t, usb_direction_t, void *,
     121extern errno_t hcd_send_batch(hcd_t *, usb_target_t, usb_direction_t, void *,
    122122    size_t, uint64_t, usbhc_iface_transfer_in_callback_t,
    123123    usbhc_iface_transfer_out_callback_t, void *, const char *);
    124124
    125 extern int hcd_send_batch_sync(hcd_t *, usb_target_t, usb_direction_t,
     125extern errno_t hcd_send_batch_sync(hcd_t *, usb_target_t, usb_direction_t,
    126126    void *, size_t, uint64_t, const char *, size_t *);
    127127
  • uspace/lib/usbhost/include/usb/host/usb_bus.h

    r36f0738 rb7fd2a0  
    5858typedef size_t (*bw_count_func_t)(usb_speed_t, usb_transfer_type_t, size_t, size_t);
    5959typedef void (*ep_remove_callback_t)(endpoint_t *, void *);
    60 typedef int (*ep_add_callback_t)(endpoint_t *, void *);
     60typedef errno_t (*ep_add_callback_t)(endpoint_t *, void *);
    6161
    6262/** Endpoint management structure */
     
    8585    size_t size, size_t max_packet_size);
    8686
    87 int usb_bus_init(usb_bus_t *instance,
     87errno_t usb_bus_init(usb_bus_t *instance,
    8888    size_t available_bandwidth, bw_count_func_t bw_count, usb_speed_t max_speed);
    8989
    90 int usb_bus_register_ep(usb_bus_t *instance, endpoint_t *ep, size_t data_size);
     90errno_t usb_bus_register_ep(usb_bus_t *instance, endpoint_t *ep, size_t data_size);
    9191
    92 int usb_bus_unregister_ep(usb_bus_t *instance, endpoint_t *ep);
     92errno_t usb_bus_unregister_ep(usb_bus_t *instance, endpoint_t *ep);
    9393
    9494endpoint_t * usb_bus_find_ep(usb_bus_t *instance,
    9595    usb_address_t address, usb_endpoint_t ep, usb_direction_t direction);
    9696
    97 int usb_bus_add_ep(usb_bus_t *instance,
     97errno_t usb_bus_add_ep(usb_bus_t *instance,
    9898    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
    9999    usb_transfer_type_t type, size_t max_packet_size, unsigned packets,
     
    101101    usb_address_t tt_address, unsigned tt_port);
    102102
    103 int usb_bus_remove_ep(usb_bus_t *instance,
     103errno_t usb_bus_remove_ep(usb_bus_t *instance,
    104104    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
    105105    ep_remove_callback_t callback, void *arg);
    106106
    107 int usb_bus_reset_toggle(usb_bus_t *instance, usb_target_t target, bool all);
     107errno_t usb_bus_reset_toggle(usb_bus_t *instance, usb_target_t target, bool all);
    108108
    109 int usb_bus_remove_address(usb_bus_t *instance,
     109errno_t usb_bus_remove_address(usb_bus_t *instance,
    110110    usb_address_t address, ep_remove_callback_t callback, void *arg);
    111111
    112 int usb_bus_request_address(usb_bus_t *instance,
     112errno_t usb_bus_request_address(usb_bus_t *instance,
    113113    usb_address_t *address, bool strict, usb_speed_t speed);
    114114
    115 int usb_bus_get_speed(usb_bus_t *instance,
     115errno_t usb_bus_get_speed(usb_bus_t *instance,
    116116    usb_address_t address, usb_speed_t *speed);
    117117#endif
  • uspace/lib/usbhost/include/usb/host/usb_transfer_batch.h

    r36f0738 rb7fd2a0  
    7979         * with the exception of usb_transfer_batch_finish. For external use.
    8080         */
    81         int error;
     81        errno_t error;
    8282} usb_transfer_batch_t;
    8383
     
    108108
    109109void usb_transfer_batch_finish_error(const usb_transfer_batch_t *instance,
    110     const void* data, size_t size, int error);
     110    const void* data, size_t size, errno_t error);
    111111
    112112/** Finish batch using stored error value and transferred size.
  • uspace/lib/usbhost/include/usb/host/utils/malloc32.h

    r36f0738 rb7fd2a0  
    5959{
    6060        uintptr_t result;
    61         int ret = as_get_physical_mapping(addr, &result);
     61        errno_t ret = as_get_physical_mapping(addr, &result);
    6262       
    6363        if (ret != EOK)
     
    7878        size_t real_size = ALIGN_UP(size, PAGE_SIZE);
    7979
    80         const int ret = dmamem_map_anonymous(real_size,
     80        const errno_t ret = dmamem_map_anonymous(real_size,
    8181            DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
    8282            &address);
Note: See TracChangeset for help on using the changeset viewer.