From: Rupesh Gujare <rupesh.gujare@atmel.com>
To: <devel@linuxdriverproject.org>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<gregkh@linuxfoundation.org>
Subject: [PATCH 3/4] staging: ozwpan: Increment reference counter.
Date: Thu, 22 Aug 2013 17:38:50 +0100 [thread overview]
Message-ID: <1377189531-24950-3-git-send-email-rupesh.gujare@atmel.com> (raw)
In-Reply-To: <1377189531-24950-1-git-send-email-rupesh.gujare@atmel.com>
Increment PD reference counter, on every timer event so that
we do not loose PD object by mistake.
Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
---
drivers/staging/ozwpan/ozproto.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c
index 8c2200b..d8ac823 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -497,7 +497,7 @@ void oz_pd_heartbeat_handler(unsigned long data)
spin_unlock_bh(&g_polling_lock);
if (apps)
oz_pd_heartbeat(pd, apps);
-
+ oz_pd_put(pd);
}
/*------------------------------------------------------------------------------
@@ -519,6 +519,7 @@ void oz_pd_timeout_handler(unsigned long data)
oz_pd_stop(pd);
break;
}
+ oz_pd_put(pd);
}
/*------------------------------------------------------------------------------
@@ -531,6 +532,7 @@ enum hrtimer_restart oz_pd_heartbeat_event(struct hrtimer *timer)
pd = container_of(timer, struct oz_pd, heartbeat);
hrtimer_forward_now(timer, ktime_set(pd->pulse_period /
MSEC_PER_SEC, (pd->pulse_period % MSEC_PER_SEC) * NSEC_PER_MSEC));
+ oz_pd_get(pd);
tasklet_schedule(&pd->heartbeat_tasklet);
return HRTIMER_RESTART;
}
@@ -543,6 +545,7 @@ enum hrtimer_restart oz_pd_timeout_event(struct hrtimer *timer)
struct oz_pd *pd;
pd = container_of(timer, struct oz_pd, timeout);
+ oz_pd_get(pd);
tasklet_schedule(&pd->timeout_tasklet);
return HRTIMER_NORESTART;
}
--
1.7.9.5
next prev parent reply other threads:[~2013-08-22 16:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 16:38 [PATCH 1/4] ozwpan: staging: Fix crash for race condition Rupesh Gujare
2013-08-22 16:38 ` [PATCH 2/4] staging: ozwpan: Check error condition before creating endpoint Rupesh Gujare
2013-08-22 16:38 ` Rupesh Gujare [this message]
2013-08-22 16:38 ` [PATCH 4/4] staging: ozwpan: Create deferred work to destroy PD object Rupesh Gujare
2013-08-22 17:45 ` Sergei Shtylyov
2013-08-23 10:38 ` Rupesh Gujare
2013-08-23 9:05 ` Dan Carpenter
2013-08-23 11:18 ` Rupesh Gujare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1377189531-24950-3-git-send-email-rupesh.gujare@atmel.com \
--to=rupesh.gujare@atmel.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).