Changeset eadaeae8 in mainline for uspace/drv/nic/e1k/e1k.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/e1k/e1k.c

    r874381a readaeae8  
    12641264 *
    12651265 */
    1266 inline static errno_t e1000_register_int_handler(nic_t *nic, cap_handle_t *handle)
     1266inline static errno_t e1000_register_int_handler(nic_t *nic,
     1267    cap_irq_handle_t *handle)
    12671268{
    12681269        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
     
    21652166        ddf_fun_set_ops(fun, &e1000_dev_ops);
    21662167
    2167         int irq_cap;
    2168         rc = e1000_register_int_handler(nic, &irq_cap);
     2168        cap_irq_handle_t irq_handle;
     2169        rc = e1000_register_int_handler(nic, &irq_handle);
    21692170        if (rc != EOK) {
    21702171                goto err_fun_create;
     
    22042205        e1000_uninitialize_rx_structure(nic);
    22052206err_irq:
    2206         unregister_interrupt_handler(dev, irq_cap);
     2207        unregister_interrupt_handler(dev, irq_handle);
    22072208err_fun_create:
    22082209        ddf_fun_destroy(fun);
Note: See TracChangeset for help on using the changeset viewer.