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