Commit 6af47622 authored by Rupesh Gujare's avatar Rupesh Gujare Committed by Greg Kroah-Hartman

staging: ozwpan: Create deferred work to destroy PD object.

Currently we call oz_pd_destroy() from softirq context, where we
try to destroy relevant data structures, as well we kill a tasklet
which always result in following kernel warning.

[12279.262194] Attempt to kill tasklet from interrupt
[12279.262202] Attempt to kill tasklet from interrupt

This patch defers deallocation of data structures to work queue.
Signed-off-by: default avatarRupesh Gujare <rupesh.gujare@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b75d7d45
...@@ -204,18 +204,16 @@ struct oz_pd *oz_pd_alloc(const u8 *mac_addr) ...@@ -204,18 +204,16 @@ struct oz_pd *oz_pd_alloc(const u8 *mac_addr)
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Context: softirq or process * Context: softirq or process
*/ */
void oz_pd_destroy(struct oz_pd *pd) void oz_pd_free(struct work_struct *work)
{ {
struct list_head *e; struct list_head *e;
struct oz_tx_frame *f; struct oz_tx_frame *f;
struct oz_isoc_stream *st; struct oz_isoc_stream *st;
struct oz_farewell *fwell; struct oz_farewell *fwell;
struct oz_pd *pd;
oz_pd_dbg(pd, ON, "Destroying PD\n"); oz_pd_dbg(pd, ON, "Destroying PD\n");
if (hrtimer_active(&pd->timeout)) pd = container_of(work, struct oz_pd, workitem);
hrtimer_cancel(&pd->timeout);
if (hrtimer_active(&pd->heartbeat))
hrtimer_cancel(&pd->heartbeat);
/*Disable timer tasklets*/ /*Disable timer tasklets*/
tasklet_kill(&pd->heartbeat_tasklet); tasklet_kill(&pd->heartbeat_tasklet);
tasklet_kill(&pd->timeout_tasklet); tasklet_kill(&pd->timeout_tasklet);
...@@ -258,6 +256,26 @@ void oz_pd_destroy(struct oz_pd *pd) ...@@ -258,6 +256,26 @@ void oz_pd_destroy(struct oz_pd *pd)
kfree(pd); kfree(pd);
} }
/*------------------------------------------------------------------------------
* Context: softirq or Process
*/
void oz_pd_destroy(struct oz_pd *pd)
{
int ret;
if (hrtimer_active(&pd->timeout))
hrtimer_cancel(&pd->timeout);
if (hrtimer_active(&pd->heartbeat))
hrtimer_cancel(&pd->heartbeat);
memset(&pd->workitem, 0, sizeof(pd->workitem));
INIT_WORK(&pd->workitem, oz_pd_free);
ret = schedule_work(&pd->workitem);
if (ret)
oz_pd_dbg(pd, ON, "failed to schedule workitem\n");
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Context: softirq-serialized * Context: softirq-serialized
*/ */
......
...@@ -99,6 +99,7 @@ struct oz_pd { ...@@ -99,6 +99,7 @@ struct oz_pd {
u8 timeout_type; u8 timeout_type;
struct tasklet_struct heartbeat_tasklet; struct tasklet_struct heartbeat_tasklet;
struct tasklet_struct timeout_tasklet; struct tasklet_struct timeout_tasklet;
struct work_struct workitem;
}; };
#define OZ_MAX_QUEUED_FRAMES 4 #define OZ_MAX_QUEUED_FRAMES 4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment