Ignore:
File:
1 edited

Legend:

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

    r38d150e rb7fd2a0  
    3535#include <usb/debug.h>
    3636#include <errno.h>
     37#include <str_error.h>
    3738#include <stdlib.h>
    3839#include <mem.h>
     
    4647 * @param res        Stored result.
    4748 *
    48  * @return EOK if succeed, negative error code otherwise.
    49  *
    50  */
    51 int wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
     49 * @return EOK if succeed, error code otherwise.
     50 *
     51 */
     52errno_t wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
    5253{
    5354        uint32_t cmd_value = host2uint32_t_be(reg_offset);
     
    5657            malloc(htc_device->ath_device->ctrl_response_length);
    5758       
    58         int rc = wmi_send_command(htc_device, WMI_REG_READ,
     59        errno_t rc = wmi_send_command(htc_device, WMI_REG_READ,
    5960            (uint8_t *) &cmd_value, sizeof(cmd_value), resp_buffer);
    6061       
     
    7879 * @param val        Value to be written
    7980 *
    80  * @return EOK if succeed, negative error code otherwise.
    81  *
    82  */
    83 int wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
     81 * @return EOK if succeed, error code otherwise.
     82 *
     83 */
     84errno_t wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
    8485{
    8586        uint32_t cmd_buffer[] = {
     
    9192            malloc(htc_device->ath_device->ctrl_response_length);
    9293       
    93         int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
     94        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    9495            (uint8_t *) &cmd_buffer, sizeof(cmd_buffer), resp_buffer);
    9596       
     
    111112 * @param clear_bit  Bit to be cleared.
    112113 *
    113  * @return EOK if succeed, negative error code otherwise.
    114  *
    115  */
    116 int wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     114 * @return EOK if succeed, error code otherwise.
     115 *
     116 */
     117errno_t wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
    117118    uint32_t set_bit, uint32_t clear_bit)
    118119{
    119120        uint32_t value;
    120121       
    121         int rc = wmi_reg_read(htc_device, reg_offset, &value);
     122        errno_t rc = wmi_reg_read(htc_device, reg_offset, &value);
    122123        if (rc != EOK) {
    123124                usb_log_error("Failed to read registry value in RMW "
     
    145146 * @param set_bit    Bit to be set.
    146147 *
    147  * @return EOK if succeed, negative error code otherwise.
    148  *
    149  */
    150 int wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
     148 * @return EOK if succeed, error code otherwise.
     149 *
     150 */
     151errno_t wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
    151152    uint32_t set_bit)
    152153{
     
    160161 * @param clear_bit  Bit to be cleared.
    161162 *
    162  * @return EOK if succeed, negative error code otherwise.
    163  *
    164  */
    165 int wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     163 * @return EOK if succeed, error code otherwise.
     164 *
     165 */
     166errno_t wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
    166167    uint32_t clear_bit)
    167168{
     
    175176 * @param elements   Number of elements in array.
    176177 *
    177  * @return EOK if succeed, negative error code otherwise.
    178  *
    179  */
    180 int wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
     178 * @return EOK if succeed, error code otherwise.
     179 *
     180 */
     181errno_t wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
    181182    size_t elements)
    182183{
     
    197198        }
    198199       
    199         int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
     200        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    200201            (uint8_t *) buffer, buffer_size, resp_buffer);
    201202       
     
    219220 * @param response_buffer Buffer with response data.
    220221 *
    221  * @return EOK if succeed, negative error code otherwise.
    222  *
    223  */
    224 int wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
     222 * @return EOK if succeed, error code otherwise.
     223 *
     224 */
     225errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
    225226    uint8_t *command_buffer, uint32_t command_length, void *response_buffer)
    226227{
     
    241242       
    242243        /* Send message. */
    243         int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     244        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    244245            htc_device->endpoints.wmi_endpoint);
    245246        if (rc != EOK) {
    246247                free(buffer);
    247                 usb_log_error("Failed to send WMI message. Error: %d\n", rc);
     248                usb_log_error("Failed to send WMI message. Error: %s\n", str_error_name(rc));
    248249                return rc;
    249250        }
     
    268269                        free(buffer);
    269270                        usb_log_error("Failed to receive WMI message response. "
    270                             "Error: %d\n", rc);
     271                            "Error: %s\n", str_error_name(rc));
    271272                        return rc;
    272273                }
Note: See TracChangeset for help on using the changeset viewer.