summaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-01-20 12:01:48 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-01-24 11:48:06 +0100
commita04886ea66b5d691c3bb65457a20028c868b359c (patch)
treefbf231d08d3a83f9e140bf9699871a47abb99f4d /src/device.c
parent733d96f45e3ee0bcf9972079d803a266fdf9f725 (diff)
downloadconnman-a04886ea66b5d691c3bb65457a20028c868b359c.tar.gz
connman-a04886ea66b5d691c3bb65457a20028c868b359c.tar.bz2
connman-a04886ea66b5d691c3bb65457a20028c868b359c.zip
device: Add caller information to ref/unref debug prints.
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/device.c b/src/device.c
index 27673470..30b75891 100644
--- a/src/device.c
+++ b/src/device.c
@@ -539,9 +539,11 @@ struct connman_device *connman_device_create(const char *node,
*
* Increase reference counter of device
*/
-struct connman_device *connman_device_ref(struct connman_device *device)
+struct connman_device *connman_device_ref_debug(struct connman_device *device,
+ const char *file, int line, const char *caller)
{
- DBG("%p", device);
+ DBG("%p ref %d by %s:%d:%s()", device, device->refcount + 1,
+ file, line, caller);
__sync_fetch_and_add(&device->refcount, 1);
@@ -554,8 +556,12 @@ struct connman_device *connman_device_ref(struct connman_device *device)
*
* Decrease reference counter of device
*/
-void connman_device_unref(struct connman_device *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;