Changeset 132ab5d1 in mainline for uspace/drv/nic


Ignore:
Timestamp:
2018-01-30T03:20:45Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5a6cc679
Parents:
8bfb163 (diff), 6a5d05b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge commit '6a5d05bd2551e64111bea4f9332dd7448c26ce84' into forwardport

Separate return value from error code in gen_irq_code*().

Location:
uspace/drv/nic
Files:
11 edited

Legend:

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

    r8bfb163 r132ab5d1  
    3333 */
    3434
     35#include <async.h>
    3536#include <ieee80211.h>
    3637#include <usb/classes/classes.h>
     
    4142#include <ddf/interrupt.h>
    4243#include <errno.h>
     44#include <str_error.h>
    4345#include <nic.h>
    4446#include <macros.h>
    45 #include <thread.h>
    4647#include "ath_usb.h"
    4748#include "wmi.h"
     
    733734 * @param ar9271 AR9271 device structure
    734735 *
    735  * @return EOK if succeed, negative error code otherwise
     736 * @return EOK if succeed, error code otherwise
    736737 *
    737738 */
     
    784785                        free(buffer);
    785786                        usb_log_error("Error while uploading firmware. "
    786                             "Error: %d\n", rc);
     787                            "Error: %s\n", str_error_name(rc));
    787788                        return rc;
    788789                }
     
    818819       
    819820        /* Wait until firmware is ready - wait for 1 second to be sure. */
    820         thread_sleep(1);
     821        async_sleep(1);
    821822       
    822823        return rc;
     
    836837        if (rc != EOK) {
    837838                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));
    839840                return NULL;
    840841        }
     
    853854        if (rc != EOK) {
    854855                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));
    857858                return NULL;
    858859        }
     
    876877 * @param dev The device structure.
    877878 *
    878  * @return EOK if succeed, negative error code otherwise
     879 * @return EOK if succeed, error code otherwise
    879880 */
    880881static int ar9271_add_device(ddf_dev_t *dev)
  • uspace/drv/nic/ar9271/ath_usb.c

    r8bfb163 r132ab5d1  
    3535#include <usb/dev/pipes.h>
    3636#include <usb/debug.h>
    37 #include <malloc.h>
     37#include <stdlib.h>
    3838#include <errno.h>
    3939#include "ath_usb.h"
     
    5656 * @param usb_device  Connected USB device.
    5757 *
    58  * @return EOK if succeed, negative error code otherwise.
     58 * @return EOK if succeed, error code otherwise.
    5959 *
    6060 */
     
    107107 * @param buffer_size Buffer size.
    108108 *
    109  * @return EOK if succeed, negative error code otherwise.
     109 * @return EOK if succeed, error code otherwise.
    110110 *
    111111 */
     
    124124 * @param transferred_size Real size of read data.
    125125 *
    126  * @return EOK if succeed, negative error code otherwise.
     126 * @return EOK if succeed, error code otherwise.
    127127 *
    128128 */
     
    140140 * @param buffer_size Buffer size.
    141141 *
    142  * @return EOK if succeed, negative error code otherwise.
     142 * @return EOK if succeed, error code otherwise.
    143143 *
    144144 */
     
    173173 * @param transferred_size Real size of read data.
    174174 *
    175  * @return EOK if succeed, negative error code otherwise.
     175 * @return EOK if succeed, error code otherwise.
    176176 *
    177177 */
  • uspace/drv/nic/ar9271/htc.c

    r8bfb163 r132ab5d1  
    3636#include <byteorder.h>
    3737#include <errno.h>
     38#include <str_error.h>
    3839#include "wmi.h"
    3940#include "htc.h"
     
    149150 * @param endpoint_id Destination endpoint.
    150151 *
    151  * @return EOK if succeed, negative error code otherwise.
     152 * @return EOK if succeed, error code otherwise.
    152153 *
    153154 */
     
    172173 * @param endpoint_id Destination endpoint.
    173174 *
    174  * @return EOK if succeed, negative error code otherwise.
     175 * @return EOK if succeed, error code otherwise.
    175176 *
    176177 */
     
    195196 * @param transferred_size Real size of read data.
    196197 *
    197  * @return EOK if succeed, negative error code otherwise.
     198 * @return EOK if succeed, error code otherwise.
    198199 *
    199200 */
     
    215216 * @param transferred_size Real size of read data.
    216217 *
    217  * @return EOK if succeed, negative error code otherwise.
     218 * @return EOK if succeed, error code otherwise.
    218219 *
    219220 */
     
    235236 *
    236237 * @return EOK if succeed, EINVAL when failed to connect service,
    237  *         negative error code otherwise.
     238 *         error code otherwise.
    238239 *
    239240 */
     
    264265        if (rc != EOK) {
    265266                free(buffer);
    266                 usb_log_error("Failed to send HTC message. Error: %d\n", rc);
     267                usb_log_error("Failed to send HTC message. Error: %s\n", str_error_name(rc));
    267268                return rc;
    268269        }
     
    278279                free(buffer);
    279280                usb_log_error("Failed to receive HTC service connect response. "
    280                     "Error: %d\n", rc);
     281                    "Error: %s\n", str_error_name(rc));
    281282                return rc;
    282283        }
     
    308309 * @param htc_device HTC device structure.
    309310 *
    310  * @return EOK if succeed, negative error code otherwise.
     311 * @return EOK if succeed, error code otherwise.
    311312 *
    312313 */
     
    331332                free(buffer);
    332333                usb_log_error("Failed to send HTC config message. "
    333                     "Error: %d\n", rc);
     334                    "Error: %s\n", str_error_name(rc));
    334335                return rc;
    335336        }
     
    344345        if (rc != EOK) {
    345346                usb_log_error("Failed to receive HTC config response message. "
    346                     "Error: %d\n", rc);
     347                    "Error: %s\n", str_error_name(rc));
    347348        }
    348349       
     
    356357 * @param htc_device HTC device structure.
    357358 *
    358  * @return EOK if succeed, negative error code otherwise.
     359 * @return EOK if succeed, error code otherwise.
    359360 *
    360361 */
     
    376377        if (rc != EOK)
    377378                usb_log_error("Failed to send HTC setup complete message. "
    378                     "Error: %d\n", rc);
     379                    "Error: %s\n", str_error_name(rc));
    379380       
    380381        free(buffer);
     
    390391 *
    391392 * @return EOK if succeed, EINVAL if response error,
    392  *         negative error code otherwise.
     393 *         error code otherwise.
    393394 *
    394395 */
     
    404405                free(buffer);
    405406                usb_log_error("Failed to receive HTC check ready message. "
    406                     "Error: %d\n", rc);
     407                    "Error: %s\n", str_error_name(rc));
    407408                return rc;
    408409        }
     
    426427 * @param htc_device HTC device structure to be initialized.
    427428 *
    428  * @return EOK if succeed, negative error code otherwise.
     429 * @return EOK if succeed, error code otherwise.
    429430 *
    430431 */
     
    447448 * @param htc_device HTC device structure.
    448449 *
    449  * @return EOK if succeed, negative error code otherwise.
     450 * @return EOK if succeed, error code otherwise.
    450451 *
    451452 */
  • uspace/drv/nic/ar9271/hw.c

    r8bfb163 r132ab5d1  
    4949 *
    5050 * @return EOK if succeed, ETIMEOUT on timeout,
    51  *         negative error code otherwise.
     51 *         error code otherwise.
    5252 *
    5353 */
     
    215215 * @param ar9271 Device structure.
    216216 *
    217  * @return EOK if succeed, negative error code otherwise.
     217 * @return EOK if succeed, error code otherwise.
    218218 *
    219219 */
     
    636636 * @param ar9271 Device structure.
    637637 *
    638  * @return EOK if succeed, negative error code otherwise.
     638 * @return EOK if succeed, error code otherwise.
    639639 */
    640640int hw_init(ar9271_t *ar9271)
  • uspace/drv/nic/ar9271/wmi.c

    r8bfb163 r132ab5d1  
    3535#include <usb/debug.h>
    3636#include <errno.h>
    37 #include <malloc.h>
     37#include <str_error.h>
     38#include <stdlib.h>
    3839#include <mem.h>
    3940#include <byteorder.h>
     
    4647 * @param res        Stored result.
    4748 *
    48  * @return EOK if succeed, negative error code otherwise.
     49 * @return EOK if succeed, error code otherwise.
    4950 *
    5051 */
     
    7879 * @param val        Value to be written
    7980 *
    80  * @return EOK if succeed, negative error code otherwise.
     81 * @return EOK if succeed, error code otherwise.
    8182 *
    8283 */
     
    111112 * @param clear_bit  Bit to be cleared.
    112113 *
    113  * @return EOK if succeed, negative error code otherwise.
     114 * @return EOK if succeed, error code otherwise.
    114115 *
    115116 */
     
    145146 * @param set_bit    Bit to be set.
    146147 *
    147  * @return EOK if succeed, negative error code otherwise.
     148 * @return EOK if succeed, error code otherwise.
    148149 *
    149150 */
     
    160161 * @param clear_bit  Bit to be cleared.
    161162 *
    162  * @return EOK if succeed, negative error code otherwise.
     163 * @return EOK if succeed, error code otherwise.
    163164 *
    164165 */
     
    175176 * @param elements   Number of elements in array.
    176177 *
    177  * @return EOK if succeed, negative error code otherwise.
     178 * @return EOK if succeed, error code otherwise.
    178179 *
    179180 */
     
    219220 * @param response_buffer Buffer with response data.
    220221 *
    221  * @return EOK if succeed, negative error code otherwise.
     222 * @return EOK if succeed, error code otherwise.
    222223 *
    223224 */
     
    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                }
  • uspace/drv/nic/e1k/e1k.c

    r8bfb163 r132ab5d1  
    3333 */
    3434
     35#include <async.h>
    3536#include <assert.h>
    3637#include <stdio.h>
     
    3839#include <adt/list.h>
    3940#include <align.h>
    40 #include <thread.h>
    4141#include <byteorder.h>
    4242#include <as.h>
     
    372372                fibril_mutex_unlock(&e1000->ctrl_lock);
    373373               
    374                 thread_usleep(10);
     374                async_usleep(10);
    375375               
    376376                fibril_mutex_lock(&e1000->ctrl_lock);
     
    12371237/** Handle device interrupt
    12381238 *
    1239  * @param iid   IPC call id
    12401239 * @param icall IPC call structure
    12411240 * @param dev   E1000 device
    12421241 *
    12431242 */
    1244 static void e1000_interrupt_handler(ipc_callid_t iid, ipc_call_t *icall,
     1243static void e1000_interrupt_handler(ipc_call_t *icall,
    12451244    ddf_dev_t *dev)
    12461245{
     
    12601259 * @param nic Driver data
    12611260 *
    1262  * @return IRQ capability handle if the handler was registered
    1263  * @return Negative error code otherwise
    1264  *
    1265  */
    1266 inline static int e1000_register_int_handler(nic_t *nic)
     1261 * @param[out] handle  IRQ capability handle if the handler was registered
     1262 *
     1263 * @return An error code otherwise
     1264 *
     1265 */
     1266inline static int e1000_register_int_handler(nic_t *nic, cap_handle_t *handle)
    12671267{
    12681268        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
     
    12751275        e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC;
    12761276       
    1277         int cap = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,
    1278             e1000_interrupt_handler, &e1000_irq_code);
     1277        int rc = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,
     1278            e1000_interrupt_handler, &e1000_irq_code, handle);
    12791279       
    12801280        fibril_mutex_unlock(&irq_reg_mutex);
    1281         return cap;
     1281        return rc;
    12821282}
    12831283
     
    13701370 *
    13711371 * @return EOK if succeed
    1372  * @return Negative error code otherwise
     1372 * @return An error code otherwise
    13731373 *
    13741374 */
     
    15241524 *
    15251525 * @return EOK if succeed
    1526  * @return Negative error code otherwise
     1526 * @return An error code otherwise
    15271527 *
    15281528 */
     
    17251725       
    17261726        /* Wait for the reset */
    1727         thread_usleep(20);
     1727        async_usleep(20);
    17281728       
    17291729        /* check if RST_BIT cleared */
     
    18131813         * transfers to descriptors.
    18141814         */
    1815         thread_usleep(100);
     1815        async_usleep(100);
    18161816       
    18171817        return EOK;
     
    19401940 *
    19411941 * @return EOK if succeed
    1942  * @return Negative error code otherwise
     1942 * @return An error code otherwise
    19431943 *
    19441944 */
     
    19651965 *
    19661966 * @return EOK if succeed
    1967  * @return Negative error code otherwise
     1967 * @return An error code otherwise
    19681968 *
    19691969 */
     
    19931993 *
    19941994 * @return EOK if succeed
    1995  * @return Negative error code otherwise
     1995 * @return An error code otherwise
    19961996 *
    19971997 */
     
    21072107 *
    21082108 * @return EOK if successed
    2109  * @return Negative error code otherwise
     2109 * @return An error code otherwise
    21102110 *
    21112111 */
     
    21652165        ddf_fun_set_ops(fun, &e1000_dev_ops);
    21662166       
    2167         int irq_cap = e1000_register_int_handler(nic);
    2168         if (irq_cap < 0) {
    2169                 rc = irq_cap;
     2167        int irq_cap;
     2168        rc = e1000_register_int_handler(nic, &irq_cap);
     2169        if (rc != EOK) {
    21702170                goto err_fun_create;
    21712171        }
     
    22392239        uint32_t eerd = E1000_REG_READ(e1000, E1000_EERD);
    22402240        while ((eerd & e1000->info.eerd_done) == 0) {
    2241                 thread_usleep(1);
     2241                async_usleep(1);
    22422242                eerd = E1000_REG_READ(e1000, E1000_EERD);
    22432243        }
     
    22552255 *
    22562256 * @return EOK if succeed
    2257  * @return Negative error code otherwise
     2257 * @return An error code otherwise
    22582258 *
    22592259 */
     
    22892289 *
    22902290 * @return EOK if succeed
    2291  * @return Negative error code otherwise
     2291 * @return An error code otherwise
    22922292 */
    22932293static int e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
  • uspace/drv/nic/ne2k/dp8390.c

    r8bfb163 r132ab5d1  
    5555
    5656#include <assert.h>
     57#include <async.h>
    5758#include <byteorder.h>
    5859#include <errno.h>
    5960#include <stdio.h>
    6061#include <ddi.h>
    61 #include <thread.h>
    6262#include "dp8390.h"
    6363
     
    172172        /* Reset the ethernet card */
    173173        uint8_t val = pio_read_8(ne2k->port + NE2K_RESET);
    174         thread_usleep(2000);
     174        async_usleep(2000);
    175175        pio_write_8(ne2k->port + NE2K_RESET, val);
    176         thread_usleep(2000);
     176        async_usleep(2000);
    177177       
    178178        /* Reset the DP8390 */
  • uspace/drv/nic/ne2k/ne2k.c

    r8bfb163 r132ab5d1  
    122122};
    123123
    124 static void ne2k_interrupt_handler(ipc_callid_t, ipc_call_t *, ddf_dev_t *);
    125 
    126 static int ne2k_register_interrupt(nic_t *nic_data)
     124static void ne2k_interrupt_handler(ipc_call_t *, ddf_dev_t *);
     125
     126static int ne2k_register_interrupt(nic_t *nic_data, cap_handle_t *handle)
    127127{
    128128        ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
     
    160160        }
    161161
    162         int irq_cap = register_interrupt_handler(nic_get_ddf_dev(nic_data),
    163                 ne2k->irq, ne2k_interrupt_handler, &ne2k->code);
    164         return irq_cap;
     162        return register_interrupt_handler(nic_get_ddf_dev(nic_data),
     163                ne2k->irq, ne2k_interrupt_handler, &ne2k->code, handle);
    165164}
    166165
     
    228227        ne2k->probed = true;
    229228       
    230         int irq_cap = ne2k_register_interrupt(nic_data);
    231         if (irq_cap < 0)
     229        if (ne2k_register_interrupt(nic_data, NULL) != EOK)
    232230                return EINVAL;
    233231       
     
    239237}
    240238
    241 void ne2k_interrupt_handler(ipc_callid_t iid, ipc_call_t *call, ddf_dev_t *dev)
     239void ne2k_interrupt_handler(ipc_call_t *call, ddf_dev_t *dev)
    242240{
    243241        nic_t *nic_data = DRIVER_DATA(dev);
    244242        ne2k_interrupt(nic_data, IRQ_GET_ISR(*call), IRQ_GET_TSR(*call));
    245        
    246         async_answer_0(iid, EOK);
    247243}
    248244
  • uspace/drv/nic/rtl8139/driver.c

    r8bfb163 r132ab5d1  
    2828
    2929#include <assert.h>
     30#include <async.h>
    3031#include <errno.h>
    3132#include <align.h>
    32 #include <thread.h>
    3333#include <byteorder.h>
    3434#include <libarch/barrier.h>
     
    217217 *  @param address  The place to store the address
    218218 *
    219  *  @return EOK if succeed, negative error code otherwise
     219 *  @return EOK if succeed, error code otherwise
    220220 */
    221221inline static void rtl8139_hw_get_addr(rtl8139_t *rtl8139,
     
    435435        memory_barrier();
    436436        while(pio_read_8(io_base + CR) & CR_RST) {
    437                 thread_usleep(1);
     437                async_usleep(1);
    438438                read_barrier();
    439439        }
     
    816816/** Handle device interrupt
    817817 *
    818  * @param iid    The IPC call id
    819818 * @param icall  The IPC call structure
    820819 * @param dev    The rtl8139 device
    821820 *
    822821 */
    823 static void rtl8139_interrupt_handler(ipc_callid_t iid, ipc_call_t *icall,
    824     ddf_dev_t *dev)
     822static void rtl8139_interrupt_handler(ipc_call_t *icall, ddf_dev_t *dev)
    825823{
    826824        assert(dev);
     
    844842 *  @param nic_data  The driver data
    845843 *
    846  *  @return IRQ capability handle if the handler was registered.
    847  *  @return Negative error code otherwise.
    848  */
    849 inline static int rtl8139_register_int_handler(nic_t *nic_data)
     844 *  @param[out] handle  IRQ capability handle if the handler was registered.
     845 *
     846 *  @return An error code otherwise.
     847 */
     848inline static int rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
    850849{
    851850        rtl8139_t *rtl8139 = nic_get_specific(nic_data);
     
    858857        rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR;
    859858        rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR;
    860         int cap = register_interrupt_handler(nic_get_ddf_dev(nic_data),
    861             rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code);
     859        int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
     860            rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code, handle);
    862861
    863862        RTL8139_IRQ_STRUCT_UNLOCK();
    864863
    865         return cap;
     864        return rc;
    866865}
    867866
     
    10261025 *  @param hw_resources  Devices hardware resources
    10271026 *
    1028  *  @return EOK if succeed, negative error code otherwise
     1027 *  @return EOK if succeed, error code otherwise
    10291028 */
    10301029static int rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
     
    10661065 *  @param dev  The device structure
    10671066 *
    1068  *  @return EOK if succeed, negative error code otherwise
     1067 *  @return EOK if succeed, error code otherwise
    10691068 */
    10701069static int rtl8139_get_resource_info(ddf_dev_t *dev)
     
    11481147 *  @param dev  The device information
    11491148 *
    1150  *  @return EOK if succeed, negative error code otherwise
     1149 *  @return EOK if succeed, error code otherwise
    11511150 */
    11521151static int rtl8139_device_initialize(ddf_dev_t *dev)
     
    12071206 * @param dev  The RTL8139 device.
    12081207 *
    1209  * @return EOK if successed, negative error code otherwise
     1208 * @return EOK if successed, error code otherwise
    12101209 */
    12111210static int rtl8139_pio_enable(ddf_dev_t *dev)
     
    12571256 * @param dev  The RTL8139 device.
    12581257 *
    1259  * @return EOK if added successfully, negative error code otherwise
     1258 * @return EOK if added successfully, error code otherwise
    12601259 */
    12611260int rtl8139_dev_add(ddf_dev_t *dev)
     
    12891288
    12901289        /* Register interrupt handler */
    1291         int irq_cap = rtl8139_register_int_handler(nic_data);
    1292         if (irq_cap < 0) {
    1293                 rc = irq_cap;
     1290        int irq_cap;
     1291        rc = rtl8139_register_int_handler(nic_data, &irq_cap);
     1292        if (rc != EOK) {
    12941293                goto err_pio;
    12951294        }
     
    13401339 *  @param max_len  Maximal addresss length to store
    13411340 *
    1342  *  @return EOK if succeed, negative error code otherwise
     1341 *  @return EOK if succeed, error code otherwise
    13431342 */
    13441343static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
  • uspace/drv/nic/rtl8139/general.c

    r8bfb163 r132ab5d1  
    8181 *  @param time        The requested time
    8282 *
    83  *  @return EOK if succeed, negative error code otherwise
     83 *  @return EOK if succeed, error code otherwise
    8484 */
    8585int rtl8139_timer_act_init(rtl8139_timer_act_t * ta, uint32_t timer_freq,
  • uspace/drv/nic/rtl8169/driver.c

    r8bfb163 r132ab5d1  
    2828
    2929#include <assert.h>
     30#include <async.h>
    3031#include <errno.h>
     32#include <str_error.h>
    3133#include <align.h>
    3234#include <byteorder.h>
     
    3436
    3537#include <as.h>
    36 #include <thread.h>
    3738#include <ddf/log.h>
    3839#include <ddf/interrupt.h>
     
    4243#include <nic.h>
    4344#include <pci_dev_iface.h>
    44 
    45 #include <sysinfo.h>
    46 #include <ipc/ns.h>
    4745
    4846#include <str.h>
     
    7573static int rtl8169_on_stopped(nic_t *nic_data);
    7674static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size);
    77 static void rtl8169_irq_handler(ipc_callid_t iid, ipc_call_t *icall,
    78     ddf_dev_t *dev);
    79 static inline int rtl8169_register_int_handler(nic_t *nic_data);
     75static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev);
     76static inline int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle);
    8077static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr);
    8178static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr);
     
    363360}
    364361
    365 inline static int rtl8169_register_int_handler(nic_t *nic_data)
     362inline static int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
    366363{
    367364        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
     
    371368        rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR;
    372369        rtl8169_irq_code.cmds[3].addr = rtl8169->regs + IMR;
    373         int irq_cap = register_interrupt_handler(nic_get_ddf_dev(nic_data),
    374             rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code);
    375 
    376         return irq_cap;
     370        int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
     371            rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code, handle);
     372
     373        return rc;
    377374}
    378375
     
    431428                goto err_pio;
    432429
    433         int irq_cap = rtl8169_register_int_handler(nic_data);
    434         if (irq_cap < 0) {
    435                 rc = irq_cap;
    436                 ddf_msg(LVL_ERROR, "Failed to register IRQ handler (%d)", rc);
     430        int irq_cap;
     431        rc = rtl8169_register_int_handler(nic_data, &irq_cap);
     432        if (rc != EOK) {
     433                ddf_msg(LVL_ERROR, "Failed to register IRQ handler (%s)", str_error_name(rc));
    437434                goto err_irq;
    438435        }
     
    710707        rc = rtl8169_allocate_buffers(rtl8169);
    711708        if (rc != EOK) {
    712                 ddf_msg(LVL_ERROR, "Error allocating buffers: %d", rc);
     709                ddf_msg(LVL_ERROR, "Error allocating buffers: %s", str_error_name(rc));
    713710                return 0;
    714711        }
     
    767764        memory_barrier();
    768765        while (pio_read_8(rtl8169->regs + CR) & CR_RST) {
    769                 thread_usleep(1);
     766                async_usleep(1);
    770767                read_barrier();
    771768        }
     
    10351032}
    10361033
    1037 static void rtl8169_irq_handler(ipc_callid_t iid, ipc_call_t *icall,
    1038     ddf_dev_t *dev)
     1034static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev)
    10391035{
    10401036        assert(dev);
     
    11811177        do {
    11821178                phyar = pio_read_32(rtl8169->regs + PHYAR);
    1183                 thread_usleep(20);
     1179                async_usleep(20);
    11841180        } while ((phyar & PHYAR_RW_WRITE) == 0);
    11851181
     
    11991195        do {
    12001196                phyar = pio_read_32(rtl8169->regs + PHYAR);
    1201                 thread_usleep(20);
     1197                async_usleep(20);
    12021198        } while ((phyar & PHYAR_RW_WRITE) != 0);
    12031199
    1204         thread_usleep(20);
     1200        async_usleep(20);
    12051201}
    12061202
Note: See TracChangeset for help on using the changeset viewer.