Commit f5cba060 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] paride cleanup and fixes (1/25)

* new helper: pi_schedule_claimed() - pi_do_claimed() sans the call
  of continuation if we don't have to wait; returns 1 if we don't
  have to wait and 0 otherwise.
parent a2cafb3c
...@@ -102,7 +102,7 @@ static void pi_wake_up(void *p) ...@@ -102,7 +102,7 @@ static void pi_wake_up(void *p)
#endif #endif
void pi_do_claimed(PIA * pi, void (*cont) (void)) int pi_schedule_claimed(PIA * pi, void (*cont) (void))
{ {
#ifdef CONFIG_PARPORT #ifdef CONFIG_PARPORT
unsigned long flags; unsigned long flags;
...@@ -111,12 +111,19 @@ void pi_do_claimed(PIA * pi, void (*cont) (void)) ...@@ -111,12 +111,19 @@ void pi_do_claimed(PIA * pi, void (*cont) (void))
if (pi->pardev && parport_claim(pi->pardev)) { if (pi->pardev && parport_claim(pi->pardev)) {
pi->claim_cont = cont; pi->claim_cont = cont;
spin_unlock_irqrestore(&pi_spinlock, flags); spin_unlock_irqrestore(&pi_spinlock, flags);
return; return 0;
} }
pi->claimed = 1; pi->claimed = 1;
spin_unlock_irqrestore(&pi_spinlock, flags); spin_unlock_irqrestore(&pi_spinlock, flags);
#endif #endif
cont(); return 1;
}
EXPORT_SYMBOL(pi_schedule_claimed);
void pi_do_claimed(PIA * pi, void (*cont) (void))
{
if (pi_schedule_claimed(pi, cont))
cont();
} }
EXPORT_SYMBOL(pi_do_claimed); EXPORT_SYMBOL(pi_do_claimed);
......
...@@ -93,6 +93,7 @@ extern void pi_connect(PIA *pi); ...@@ -93,6 +93,7 @@ extern void pi_connect(PIA *pi);
extern void pi_disconnect(PIA *pi); extern void pi_disconnect(PIA *pi);
extern void pi_do_claimed(PIA *pi, void (*cont)(void)); extern void pi_do_claimed(PIA *pi, void (*cont)(void));
extern int pi_schedule_claimed(PIA *pi, void (*cont)(void));
/* macros and functions exported to the protocol modules */ /* macros and functions exported to the protocol modules */
......
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