Changeset eadaeae8 in mainline for uspace/drv/nic/rtl8169


Ignore:
Timestamp:
2018-03-21T20:58:49Z (8 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/rtl8169/driver.c

    r874381a readaeae8  
    7575static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size);
    7676static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev);
    77 static inline errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle);
     77static inline errno_t rtl8169_register_int_handler(nic_t *nic_data,
     78    cap_irq_handle_t *handle);
    7879static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr);
    7980static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr);
     
    361362}
    362363
    363 inline static errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
     364inline static errno_t rtl8169_register_int_handler(nic_t *nic_data,
     365    cap_irq_handle_t *handle)
    364366{
    365367        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
     
    429431                goto err_pio;
    430432
    431         int irq_cap;
    432         rc = rtl8169_register_int_handler(nic_data, &irq_cap);
     433        cap_irq_handle_t irq_handle;
     434        rc = rtl8169_register_int_handler(nic_data, &irq_handle);
    433435        if (rc != EOK) {
    434436                ddf_msg(LVL_ERROR, "Failed to register IRQ handler (%s)", str_error_name(rc));
     
    472474err_srv:
    473475        /* XXX Disconnect from services */
    474         unregister_interrupt_handler(dev, irq_cap);
     476        unregister_interrupt_handler(dev, irq_handle);
    475477err_irq:
    476478err_pio:
Note: See TracChangeset for help on using the changeset viewer.