[linux-dvb] [PATCH] function for checking if the dvb framework is idle

Andreas Oberritter obi at linuxtv.org
Tue Aug 14 14:04:31 CEST 2007


Hello Markus,

Markus Rechberger wrote:
> Could anyone comment or add this patch?
> 
> thanks,
> Markus
> 
>> +int dvb_frontend_eventstatus(struct dvb_frontend *fe)
>> +{
>> +      struct dvb_frontend_private *fepriv = fe->frontend_priv;
>> +      struct dvb_fe_events *events = &fepriv->events;
>> +      int ret;
>> +
>> +      if (mutex_lock_interruptible (&events->mtx))
>> +              return -EINTR;
>> +
>> +      ret = (fepriv->thread) ? true:false;
>> +      mutex_unlock (&events->mtx);
>> +
>> +      return ret;
>> +}

what does the mutex protect? Wouldn't the following code do the same?

int dvb_frontend_eventstatus(struct dvb_frontend *fe)
{
	struct dvb_frontend_private *fepriv = fe->frontend_priv;

	return (fepriv->thread != NULL);
}

I think the function name is misleading. At least it's not obvious for
me how the code relates to frontend events. A better name might be
dvb_frontend_active() or _running().

Best regards,
Andreas



More information about the linux-dvb mailing list