Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324472
b: refs/heads/master
c: cff9e59
h: refs/heads/master
v: v3
  • Loading branch information
Devendra Naga authored and Greg Kroah-Hartman committed Aug 14, 2012
1 parent 5da47c9 commit 14afeaf
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 41 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08fb73c1c842d32c15806bd9ae89531d5b0e31ea
refs/heads/master: cff9e59f65019428ba8f172dcc8af0154590de42
83 changes: 43 additions & 40 deletions trunk/drivers/staging/csr/bh.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,45 +32,49 @@
* 0 on success or else a Linux error code.
* ---------------------------------------------------------------------------
*/
int
uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void *))
int uf_start_thread(unifi_priv_t *priv,
struct uf_thread *thread, int (*func)(void *))
{
if (thread->thread_task != NULL) {
unifi_error(priv, "%s thread already started\n", thread->name);
return 0;
}

/* Start the kernel thread that handles all h/w accesses. */
thread->thread_task = kthread_run(func, priv, "%s", thread->name);
if (IS_ERR(thread->thread_task)) {
return PTR_ERR(thread->thread_task);
}

/* Module parameter overides the thread priority */
if (bh_priority != -1) {
if (bh_priority >= 0 && bh_priority <= MAX_RT_PRIO) {
struct sched_param param;
priv->bh_thread.prio = bh_priority;
unifi_trace(priv, UDBG1, "%s thread (RT) priority = %d\n",
thread->name, bh_priority);
param.sched_priority = bh_priority;
sched_setscheduler(thread->thread_task, SCHED_FIFO, &param);
} else if (bh_priority > MAX_RT_PRIO && bh_priority <= MAX_PRIO) {
priv->bh_thread.prio = bh_priority;
unifi_trace(priv, UDBG1, "%s thread priority = %d\n",
thread->name, PRIO_TO_NICE(bh_priority));
set_user_nice(thread->thread_task, PRIO_TO_NICE(bh_priority));
} else {
priv->bh_thread.prio = DEFAULT_PRIO;
unifi_warning(priv, "%s thread unsupported (%d) priority\n",
thread->name, bh_priority);
}
} else {
priv->bh_thread.prio = DEFAULT_PRIO;
}
unifi_trace(priv, UDBG2, "Started %s thread\n", thread->name);

return 0;
if (thread->thread_task != NULL) {
unifi_error(priv, "%s thread already started\n", thread->name);
return 0;
}

/* Start the kernel thread that handles all h/w accesses. */
thread->thread_task = kthread_run(func, priv, "%s", thread->name);
if (IS_ERR(thread->thread_task))
return PTR_ERR(thread->thread_task);

/* Module parameter overides the thread priority */
if (bh_priority != -1) {
if (bh_priority >= 0 && bh_priority <= MAX_RT_PRIO) {
struct sched_param param;
priv->bh_thread.prio = bh_priority;
unifi_trace(priv, UDBG1,
"%s thread (RT) priority = %d\n",
thread->name, bh_priority);
param.sched_priority = bh_priority;
sched_setscheduler(thread->thread_task,
SCHED_FIFO, &param);
} else if (bh_priority > MAX_RT_PRIO &&
bh_priority <= MAX_PRIO) {
priv->bh_thread.prio = bh_priority;
unifi_trace(priv, UDBG1, "%s thread priority = %d\n",
thread->name,
PRIO_TO_NICE(bh_priority));
set_user_nice(thread->thread_task,
PRIO_TO_NICE(bh_priority));
} else {
priv->bh_thread.prio = DEFAULT_PRIO;
unifi_warning(priv,
"%s thread unsupported (%d) priority\n",
thread->name, bh_priority);
}
} else
priv->bh_thread.prio = DEFAULT_PRIO;
unifi_trace(priv, UDBG2, "Started %s thread\n", thread->name);

return 0;
} /* uf_start_thread() */


Expand All @@ -88,8 +92,7 @@ uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void *
*
* ---------------------------------------------------------------------------
*/
void
uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread)
void uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread)
{
if (!thread->thread_task) {
unifi_notice(priv, "%s thread is already stopped\n", thread->name);
Expand Down

0 comments on commit 14afeaf

Please sign in to comment.