Changeset 071a1ddb in mainline for uspace/drv/nic


Ignore:
Timestamp:
2017-12-08T21:17:27Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0722869, 569a51a
Parents:
9233e9d
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 00:30:18)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:17:27)
Message:

Return IRQ handles via a separate out parameter in all uspace code.

Location:
uspace/drv/nic
Files:
4 edited

Legend:

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

    r9233e9d r071a1ddb  
    12591259 * @param nic Driver data
    12601260 *
    1261  * @return IRQ capability handle if the handler was registered
     1261 * @param[out] handle  IRQ capability handle if the handler was registered
     1262 *
    12621263 * @return Negative error code otherwise
    12631264 *
    12641265 */
    1265 inline static int e1000_register_int_handler(nic_t *nic)
     1266inline static int e1000_register_int_handler(nic_t *nic, cap_handle_t *handle)
    12661267{
    12671268        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
     
    12741275        e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC;
    12751276       
    1276         int cap = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,
    1277             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);
    12781279       
    12791280        fibril_mutex_unlock(&irq_reg_mutex);
    1280         return cap;
     1281        return rc;
    12811282}
    12821283
     
    21642165        ddf_fun_set_ops(fun, &e1000_dev_ops);
    21652166       
    2166         int irq_cap = e1000_register_int_handler(nic);
    2167         if (irq_cap < 0) {
    2168                 rc = irq_cap;
     2167        int irq_cap;
     2168        rc = e1000_register_int_handler(nic, &irq_cap);
     2169        if (rc != EOK) {
    21692170                goto err_fun_create;
    21702171        }
  • uspace/drv/nic/ne2k/ne2k.c

    r9233e9d r071a1ddb  
    124124static void ne2k_interrupt_handler(ipc_call_t *, ddf_dev_t *);
    125125
    126 static int ne2k_register_interrupt(nic_t *nic_data)
     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       
  • uspace/drv/nic/rtl8139/driver.c

    r9233e9d r071a1ddb  
    842842 *  @param nic_data  The driver data
    843843 *
    844  *  @return IRQ capability handle if the handler was registered.
     844 *  @param[out] handle  IRQ capability handle if the handler was registered.
     845 *
    845846 *  @return Negative error code otherwise.
    846847 */
    847 inline static int rtl8139_register_int_handler(nic_t *nic_data)
     848inline static int rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
    848849{
    849850        rtl8139_t *rtl8139 = nic_get_specific(nic_data);
     
    856857        rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR;
    857858        rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR;
    858         int cap = register_interrupt_handler(nic_get_ddf_dev(nic_data),
    859             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);
    860861
    861862        RTL8139_IRQ_STRUCT_UNLOCK();
    862863
    863         return cap;
     864        return rc;
    864865}
    865866
     
    12871288
    12881289        /* Register interrupt handler */
    1289         int irq_cap = rtl8139_register_int_handler(nic_data);
    1290         if (irq_cap < 0) {
    1291                 rc = irq_cap;
     1290        int irq_cap;
     1291        rc = rtl8139_register_int_handler(nic_data, &irq_cap);
     1292        if (rc != EOK) {
    12921293                goto err_pio;
    12931294        }
  • uspace/drv/nic/rtl8169/driver.c

    r9233e9d r071a1ddb  
    7373static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size);
    7474static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev);
    75 static inline int rtl8169_register_int_handler(nic_t *nic_data);
     75static inline int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle);
    7676static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr);
    7777static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr);
     
    359359}
    360360
    361 inline static int rtl8169_register_int_handler(nic_t *nic_data)
     361inline static int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
    362362{
    363363        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
     
    367367        rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR;
    368368        rtl8169_irq_code.cmds[3].addr = rtl8169->regs + IMR;
    369         int irq_cap = register_interrupt_handler(nic_get_ddf_dev(nic_data),
    370             rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code);
    371 
    372         return irq_cap;
     369        int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
     370            rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code, handle);
     371
     372        return rc;
    373373}
    374374
     
    427427                goto err_pio;
    428428
    429         int irq_cap = rtl8169_register_int_handler(nic_data);
    430         if (irq_cap < 0) {
    431                 rc = irq_cap;
     429        int irq_cap;
     430        rc = rtl8169_register_int_handler(nic_data, &irq_cap);
     431        if (rc != EOK) {
    432432                ddf_msg(LVL_ERROR, "Failed to register IRQ handler (%d)", rc);
    433433                goto err_irq;
Note: See TracChangeset for help on using the changeset viewer.