Changeset b7fd2a0 in mainline for uspace/drv/nic/ar9271/wmi.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/nic/ar9271/wmi.c

    r36f0738 rb7fd2a0  
    5050 *
    5151 */
    52 int wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
     52errno_t wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
    5353{
    5454        uint32_t cmd_value = host2uint32_t_be(reg_offset);
     
    5757            malloc(htc_device->ath_device->ctrl_response_length);
    5858       
    59         int rc = wmi_send_command(htc_device, WMI_REG_READ,
     59        errno_t rc = wmi_send_command(htc_device, WMI_REG_READ,
    6060            (uint8_t *) &cmd_value, sizeof(cmd_value), resp_buffer);
    6161       
     
    8282 *
    8383 */
    84 int wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
     84errno_t wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
    8585{
    8686        uint32_t cmd_buffer[] = {
     
    9292            malloc(htc_device->ath_device->ctrl_response_length);
    9393       
    94         int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
     94        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    9595            (uint8_t *) &cmd_buffer, sizeof(cmd_buffer), resp_buffer);
    9696       
     
    115115 *
    116116 */
    117 int wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     117errno_t wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
    118118    uint32_t set_bit, uint32_t clear_bit)
    119119{
    120120        uint32_t value;
    121121       
    122         int rc = wmi_reg_read(htc_device, reg_offset, &value);
     122        errno_t rc = wmi_reg_read(htc_device, reg_offset, &value);
    123123        if (rc != EOK) {
    124124                usb_log_error("Failed to read registry value in RMW "
     
    149149 *
    150150 */
    151 int wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
     151errno_t wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
    152152    uint32_t set_bit)
    153153{
     
    164164 *
    165165 */
    166 int wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     166errno_t wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
    167167    uint32_t clear_bit)
    168168{
     
    179179 *
    180180 */
    181 int wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
     181errno_t wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
    182182    size_t elements)
    183183{
     
    198198        }
    199199       
    200         int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
     200        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    201201            (uint8_t *) buffer, buffer_size, resp_buffer);
    202202       
     
    223223 *
    224224 */
    225 int wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
     225errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
    226226    uint8_t *command_buffer, uint32_t command_length, void *response_buffer)
    227227{
     
    242242       
    243243        /* Send message. */
    244         int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     244        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    245245            htc_device->endpoints.wmi_endpoint);
    246246        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.