Changeset 132ab5d1 in mainline for uspace/drv/nic/e1k/e1k.c


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*().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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)
Note: See TracChangeset for help on using the changeset viewer.