Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset bfe7867 in mainline


Ignore:
Timestamp:
2011-08-29T19:03:17Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
c5be39b
Parents:
4d94002d
Message:

Make sure ddf_dev_t structure exists as long as any associated ddf_fun_t
structure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/driver.c

    r4d94002d rbfe7867  
    673673}
    674674
    675 /** Increase function reference count. */
     675/** Increase function reference count.
     676 *
     677 * This also increases reference count on the device. The device structure
     678 * will thus not be deallocated while there are some associated function
     679 * structures.
     680 */
    676681static void fun_add_ref(ddf_fun_t *fun)
    677682{
     683        dev_add_ref(fun->dev);
    678684        atomic_inc(&fun->refcnt);
    679685}
     
    685691static void fun_del_ref(ddf_fun_t *fun)
    686692{
     693        ddf_dev_t *dev = fun->dev;
     694
    687695        if (atomic_predec(&fun->refcnt) == 0)
    688696                delete_function(fun);
     697
     698        dev_del_ref(dev);
    689699}
    690700
     
    721731
    722732        /* Add one reference that will be dropped by ddf_fun_destroy() */
     733        fun->dev = dev;
    723734        fun_add_ref(fun);
    724735
    725736        fun->bound = false;
    726         fun->dev = dev;
    727737        fun->ftype = ftype;
    728738
Note: See TracChangeset for help on using the changeset viewer.