Skip to content

Commit 6af4762

Browse files
Rupesh Gujaregregkh
Rupesh Gujare
authored andcommitted
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: Rupesh Gujare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b75d7d4 commit 6af4762

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

drivers/staging/ozwpan/ozpd.c

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,16 @@ struct oz_pd *oz_pd_alloc(const u8 *mac_addr)
204204
/*------------------------------------------------------------------------------
205205
* Context: softirq or process
206206
*/
207-
void oz_pd_destroy(struct oz_pd *pd)
207+
void oz_pd_free(struct work_struct *work)
208208
{
209209
struct list_head *e;
210210
struct oz_tx_frame *f;
211211
struct oz_isoc_stream *st;
212212
struct oz_farewell *fwell;
213+
struct oz_pd *pd;
213214

214215
oz_pd_dbg(pd, ON, "Destroying PD\n");
215-
if (hrtimer_active(&pd->timeout))
216-
hrtimer_cancel(&pd->timeout);
217-
if (hrtimer_active(&pd->heartbeat))
218-
hrtimer_cancel(&pd->heartbeat);
216+
pd = container_of(work, struct oz_pd, workitem);
219217
/*Disable timer tasklets*/
220218
tasklet_kill(&pd->heartbeat_tasklet);
221219
tasklet_kill(&pd->timeout_tasklet);
@@ -258,6 +256,26 @@ void oz_pd_destroy(struct oz_pd *pd)
258256
kfree(pd);
259257
}
260258

259+
/*------------------------------------------------------------------------------
260+
* Context: softirq or Process
261+
*/
262+
void oz_pd_destroy(struct oz_pd *pd)
263+
{
264+
int ret;
265+
266+
if (hrtimer_active(&pd->timeout))
267+
hrtimer_cancel(&pd->timeout);
268+
if (hrtimer_active(&pd->heartbeat))
269+
hrtimer_cancel(&pd->heartbeat);
270+
271+
memset(&pd->workitem, 0, sizeof(pd->workitem));
272+
INIT_WORK(&pd->workitem, oz_pd_free);
273+
ret = schedule_work(&pd->workitem);
274+
275+
if (ret)
276+
oz_pd_dbg(pd, ON, "failed to schedule workitem\n");
277+
}
278+
261279
/*------------------------------------------------------------------------------
262280
* Context: softirq-serialized
263281
*/

drivers/staging/ozwpan/ozpd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct oz_pd {
9999
u8 timeout_type;
100100
struct tasklet_struct heartbeat_tasklet;
101101
struct tasklet_struct timeout_tasklet;
102+
struct work_struct workitem;
102103
};
103104

104105
#define OZ_MAX_QUEUED_FRAMES 4

0 commit comments

Comments
 (0)