Changes in uspace/drv/nic/ar9271/ar9271.c [b7fd2a0:908d634] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ar9271/ar9271.c
rb7fd2a0 r908d634 42 42 #include <ddf/interrupt.h> 43 43 #include <errno.h> 44 #include <str_error.h>45 44 #include <nic.h> 46 45 #include <macros.h> … … 99 98 100 99 /* Callback when new device is to be controlled by this driver. */ 101 static errno_t ar9271_add_device(ddf_dev_t *);100 static int ar9271_add_device(ddf_dev_t *); 102 101 103 102 /* IEEE 802.11 callbacks */ 104 static errno_t ar9271_ieee80211_start(ieee80211_dev_t *);105 static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t);106 static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t);107 static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool);108 static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *,103 static int ar9271_ieee80211_start(ieee80211_dev_t *); 104 static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t); 105 static int ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t); 106 static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool); 107 static int ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *, 109 108 bool); 110 109 … … 128 127 static ieee80211_iface_t ar9271_ieee80211_iface; 129 128 130 static errno_t ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *);131 static errno_t ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *);132 static errno_t ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *,129 static int ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *); 130 static int ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *); 131 static int ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *, 133 132 nic_role_t *); 134 133 … … 144 143 * 145 144 */ 146 static errno_t ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)145 static int ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info) 147 146 { 148 147 assert(dev); … … 164 163 * 165 164 */ 166 static errno_t ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)165 static int ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state) 167 166 { 168 167 *state = NIC_CS_PLUGGED; … … 174 173 * 175 174 */ 176 static errno_t ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,175 static int ar9271_get_operation_mode(ddf_fun_t *fun, int *speed, 177 176 nic_channel_mode_t *duplex, nic_role_t *role) 178 177 { … … 187 186 * 188 187 */ 189 static errno_t ar9271_on_multicast_mode_change(nic_t *nic,188 static int ar9271_on_multicast_mode_change(nic_t *nic, 190 189 nic_multicast_mode_t mode, const nic_address_t *addr, size_t addr_cnt) 191 190 { … … 210 209 * 211 210 */ 212 static errno_t ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,211 static int ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode, 213 212 const nic_address_t *addr, size_t addr_cnt) 214 213 { … … 236 235 * 237 236 */ 238 static errno_t ar9271_on_broadcast_mode_change(nic_t *nic,237 static int ar9271_on_broadcast_mode_change(nic_t *nic, 239 238 nic_broadcast_mode_t mode) 240 239 { … … 258 257 } 259 258 260 static errno_t ar9271_data_polling(void *arg)259 static int ar9271_data_polling(void *arg) 261 260 { 262 261 assert(arg); … … 319 318 * 320 319 */ 321 static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,320 static int ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev, 322 321 uint16_t freq) 323 322 { … … 330 329 wmi_send_command(ar9271->htc_device, WMI_STOP_RECV, NULL, 0, NULL); 331 330 332 errno_t rc = hw_freq_switch(ar9271, freq);331 int rc = hw_freq_switch(ar9271, freq); 333 332 if (rc != EOK) { 334 333 usb_log_error("Failed to HW switch frequency.\n"); … … 352 351 } 353 352 354 static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,353 static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev, 355 354 bool connected) 356 355 { … … 401 400 } 402 401 403 static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,402 static int ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev, 404 403 ieee80211_key_config_t *key_conf, bool insert) 405 404 { … … 519 518 } 520 519 521 static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,520 static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev, 522 521 void *buffer, size_t buffer_size) 523 522 { … … 608 607 } 609 608 610 static errno_t ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)609 static int ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev) 611 610 { 612 611 assert(ieee80211_dev); … … 616 615 wmi_send_command(ar9271->htc_device, WMI_FLUSH_RECV, NULL, 0, NULL); 617 616 618 errno_t rc = hw_reset(ar9271);617 int rc = hw_reset(ar9271); 619 618 if (rc != EOK) { 620 619 usb_log_error("Failed to do HW reset.\n"); … … 666 665 } 667 666 668 static errno_t ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device)667 static int ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device) 669 668 { 670 669 ar9271->starting_up = true; … … 680 679 } 681 680 682 errno_t rc = ath_usb_init(ar9271->ath_device, usb_device);681 int rc = ath_usb_init(ar9271->ath_device, usb_device); 683 682 if (rc != EOK) { 684 683 free(ar9271->ath_device); … … 734 733 * @param ar9271 AR9271 device structure 735 734 * 736 * @return EOK if succeed, error code otherwise737 * 738 */ 739 static errno_t ar9271_upload_fw(ar9271_t *ar9271)735 * @return EOK if succeed, negative error code otherwise 736 * 737 */ 738 static int ar9271_upload_fw(ar9271_t *ar9271) 740 739 { 741 740 usb_device_t *usb_device = ar9271->usb_device; … … 775 774 memcpy(buffer, current_data, chunk_size); 776 775 usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device); 777 errno_t rc = usb_control_request_set(ctrl_pipe,776 int rc = usb_control_request_set(ctrl_pipe, 778 777 USB_REQUEST_TYPE_VENDOR, 779 778 USB_REQUEST_RECIPIENT_DEVICE, … … 785 784 free(buffer); 786 785 usb_log_error("Error while uploading firmware. " 787 "Error: % s\n", str_error_name(rc));786 "Error: %d\n", rc); 788 787 return rc; 789 788 } … … 803 802 */ 804 803 usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device); 805 errno_t rc = usb_control_request_set(ctrl_pipe,804 int rc = usb_control_request_set(ctrl_pipe, 806 805 USB_REQUEST_TYPE_VENDOR, 807 806 USB_REQUEST_RECIPIENT_DEVICE, … … 834 833 /* USB framework initialization. */ 835 834 const char *err_msg = NULL; 836 errno_t rc = usb_device_create_ddf(dev, endpoints, &err_msg);835 int rc = usb_device_create_ddf(dev, endpoints, &err_msg); 837 836 if (rc != EOK) { 838 837 usb_log_error("Failed to create USB device: %s, " 839 "ERR_NUM = % s\n", err_msg, str_error_name(rc));838 "ERR_NUM = %d\n", err_msg, rc); 840 839 return NULL; 841 840 } … … 854 853 if (rc != EOK) { 855 854 free(ar9271); 856 usb_log_error("Failed to initialize AR9271 structure: % s\n",857 str_error_name(rc));855 usb_log_error("Failed to initialize AR9271 structure: %d\n", 856 rc); 858 857 return NULL; 859 858 } … … 877 876 * @param dev The device structure. 878 877 * 879 * @return EOK if succeed, error code otherwise880 */ 881 static errno_t ar9271_add_device(ddf_dev_t *dev)878 * @return EOK if succeed, negative error code otherwise 879 */ 880 static int ar9271_add_device(ddf_dev_t *dev) 882 881 { 883 882 assert(dev); … … 896 895 897 896 /* Initialize AR9271 HTC services. */ 898 errno_t rc = htc_init(ar9271->htc_device);897 int rc = htc_init(ar9271->htc_device); 899 898 if (rc != EOK) { 900 899 ar9271_delete_dev_data(ar9271);
Note:
See TracChangeset
for help on using the changeset viewer.