Changeset a35b458 in mainline for uspace/drv/nic/ar9271/wmi.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (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:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ar9271/wmi.c

    r3061bc1 ra35b458  
    5353{
    5454        uint32_t cmd_value = host2uint32_t_be(reg_offset);
    55        
     55
    5656        void *resp_buffer =
    5757            malloc(htc_device->ath_device->ctrl_response_length);
    58        
     58
    5959        errno_t rc = wmi_send_command(htc_device, WMI_REG_READ,
    6060            (uint8_t *) &cmd_value, sizeof(cmd_value), resp_buffer);
    61        
     61
    6262        if (rc != EOK) {
    6363                usb_log_error("Failed to read registry value.\n");
    6464                return rc;
    6565        }
    66        
     66
    6767        uint32_t *resp_value = (uint32_t *) ((void *) resp_buffer +
    6868            sizeof(htc_frame_header_t) + sizeof(wmi_command_header_t));
    69        
     69
    7070        *res = uint32_t_be2host(*resp_value);
    71        
     71
    7272        return rc;
    7373}
     
    8888                host2uint32_t_be(val)
    8989        };
    90        
     90
    9191        void *resp_buffer =
    9292            malloc(htc_device->ath_device->ctrl_response_length);
    93        
     93
    9494        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    9595            (uint8_t *) &cmd_buffer, sizeof(cmd_buffer), resp_buffer);
    96        
     96
    9797        free(resp_buffer);
    98        
     98
    9999        if (rc != EOK) {
    100100                usb_log_error("Failed to write registry value.\n");
    101101                return rc;
    102102        }
    103        
     103
    104104        return rc;
    105105}
     
    119119{
    120120        uint32_t value;
    121        
     121
    122122        errno_t rc = wmi_reg_read(htc_device, reg_offset, &value);
    123123        if (rc != EOK) {
     
    126126                return rc;
    127127        }
    128        
     128
    129129        value &= ~clear_bit;
    130130        value |= set_bit;
    131        
     131
    132132        rc = wmi_reg_write(htc_device, reg_offset, value);
    133133        if (rc != EOK) {
     
    136136                return rc;
    137137        }
    138        
     138
    139139        return rc;
    140140}
     
    186186        void *resp_buffer =
    187187            malloc(htc_device->ath_device->ctrl_response_length);
    188        
     188
    189189        /* Convert values to correct endianness. */
    190190        for (size_t i = 0; i < elements; i++) {
     
    197197                    host2uint32_t_be(buffer_element->value);
    198198        }
    199        
     199
    200200        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    201201            (uint8_t *) buffer, buffer_size, resp_buffer);
    202        
     202
    203203        free(buffer);
    204204        free(resp_buffer);
    205        
     205
    206206        if (rc != EOK) {
    207207                usb_log_error("Failed to write multi registry value.\n");
    208208                return rc;
    209209        }
    210        
     210
    211211        return rc;
    212212}
     
    230230        size_t buffer_size = header_size + command_length;
    231231        void *buffer = malloc(buffer_size);
    232        
     232
    233233        if (command_buffer != NULL)
    234234                memcpy(buffer+header_size, command_buffer, command_length);
    235        
     235
    236236        /* Set up WMI header */
    237237        wmi_command_header_t *wmi_header = (wmi_command_header_t *)
     
    240240        wmi_header->sequence_number =
    241241            host2uint16_t_be(++htc_device->sequence_number);
    242        
     242
    243243        /* Send message. */
    244244        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
     
    249249                return rc;
    250250        }
    251        
     251
    252252        free(buffer);
    253        
     253
    254254        bool clean_resp_buffer = false;
    255255        size_t response_buffer_size =
     
    259259                clean_resp_buffer = true;
    260260        }
    261        
     261
    262262        /* Read response. */
    263263        /* TODO: Ignoring WMI management RX messages ~ TX statuses etc. */
     
    272272                        return rc;
    273273                }
    274                
     274
    275275                if (response_buffer_size < sizeof(htc_frame_header_t) +
    276276                    sizeof(wmi_command_header_t)) {
     
    279279                        return EINVAL;
    280280                }
    281                
     281
    282282                wmi_command_header_t *wmi_hdr = (wmi_command_header_t *)
    283283                    ((void *) response_buffer + sizeof(htc_frame_header_t));
    284284                cmd_id = uint16_t_be2host(wmi_hdr->command_id);
    285285        } while(cmd_id & WMI_MGMT_CMD_MASK);
    286        
     286
    287287        if (clean_resp_buffer)
    288288                free(response_buffer);
    289        
    290         return rc;
    291 }
     289
     290        return rc;
     291}
Note: See TracChangeset for help on using the changeset viewer.