Changeset d51838f in mainline for uspace/drv/nic/rtl8139/driver.c


Ignore:
Timestamp:
2017-10-14T22:49:18Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
75911d24
Parents:
ce732e74
Message:

Let leaf drivers enable/disable/clear interrupts via hw_res instead of directly using irc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/rtl8139/driver.c

    rce732e74 rd51838f  
    3636#include <ddf/log.h>
    3737#include <ddf/interrupt.h>
     38#include <device/hw_res.h>
    3839#include <io/log.h>
    3940#include <nic.h>
    4041#include <pci_dev_iface.h>
    41 #include <irc.h>
    4242#include <stdio.h>
    4343#include <str.h>
     
    920920        rtl8139_hw_int_set(rtl8139);
    921921
    922         int rc = irc_enable_interrupt(rtl8139->irq);
     922        int rc = hw_res_enable_interrupt(rtl8139->parent_sess, rtl8139->irq);
    923923        if (rc != EOK) {
    924924                rtl8139_on_stopped(nic_data);
     
    976976                return NULL;
    977977
    978         rtl8139_t *rtl8139 = malloc(sizeof(rtl8139_t));
     978        rtl8139_t *rtl8139 = calloc(1, sizeof(rtl8139_t));
    979979        if (!rtl8139) {
    980980                nic_unbind_and_destroy(dev);
     
    982982        }
    983983
    984         memset(rtl8139, 0, sizeof(rtl8139_t));
     984        rtl8139->dev = dev;
    985985
    986986        rtl8139->nic_data = nic_data;
     
    11661166
    11671167        ddf_msg(LVL_DEBUG, "rtl8139: dev_data created");
     1168        rtl8139->parent_sess = ddf_dev_parent_sess_get(dev);
     1169        if (rtl8139->parent_sess == NULL) {
     1170                ddf_msg(LVL_ERROR, "Error connecting parent device.");
     1171                return EIO;
     1172        }
    11681173
    11691174        /* Obtain and fill hardware resources info and connect to parent */
     
    12581263        ddf_fun_t *fun;
    12591264
    1260         assert(dev);
    12611265        ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %zu)",
    12621266            ddf_dev_get_name(dev), ddf_dev_get_handle(dev));
Note: See TracChangeset for help on using the changeset viewer.