/** * connman_device_unref: * @device: device structure * * Decrease reference counter of device */ void connman_device_unref(struct connman_device *device) { if (g_atomic_int_dec_and_test(&device->refcount) == FALSE) return; if (device->driver) { device->driver->remove(device); device->driver = NULL; } device_list = g_slist_remove(device_list, device); device_destruct(device); }
/** * connman_device_unref: * @device: device structure * * Decrease reference counter of device */ void connman_device_unref_debug(struct connman_device *device, const char *file, int line, const char *caller) { DBG("%p ref %d by %s:%d:%s()", device, device->refcount - 1, file, line, caller); if (__sync_fetch_and_sub(&device->refcount, 1) != 1) return; if (device->driver) { device->driver->remove(device); device->driver = NULL; } device_list = g_slist_remove(device_list, device); device_destruct(device); }