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


Ignore:
Timestamp:
2018-03-21T20:58:49Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3be9d10
Parents:
874381a
Message:

Make capability handles type-safe

Define distinct pointer types for the handles of the supported
capability types and use them instead of integer handles. This makes it
virtually impossible to pass a non-handle or a handle of different type
instead of the proper handle. Also turn cap_handle_t into an "untyped"
capability handle that can be assigned to and from the "typed" handles.

This commit also fixes a bug in msim-con driver, which wrongly used the
IRQ number instead of the IRQ capability handle to unregister the IRQ.

This commit also fixes the wrong use of the capability handle instead
of error code in libusbhost.

File:
1 edited

Legend:

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

    r874381a readaeae8  
    846846 *  @return An error code otherwise.
    847847 */
    848 inline static errno_t rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
     848inline static errno_t rtl8139_register_int_handler(nic_t *nic_data,
     849    cap_irq_handle_t *handle)
    849850{
    850851        rtl8139_t *rtl8139 = nic_get_specific(nic_data);
     
    12881289
    12891290        /* Register interrupt handler */
    1290         int irq_cap;
    1291         rc = rtl8139_register_int_handler(nic_data, &irq_cap);
     1291        cap_irq_handle_t irq_handle;
     1292        rc = rtl8139_register_int_handler(nic_data, &irq_handle);
    12921293        if (rc != EOK) {
    12931294                goto err_pio;
     
    13241325        ddf_fun_destroy(fun);
    13251326err_srv:
    1326         unregister_interrupt_handler(dev, irq_cap);
     1327        unregister_interrupt_handler(dev, irq_handle);
    13271328err_pio:
    13281329        // rtl8139_pio_disable(dev);
Note: See TracChangeset for help on using the changeset viewer.