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

Markus Rechberger markus.rechberger at amd.com
Tue Aug 14 14:13:15 CEST 2007


Hello Andreas,

Andreas Oberritter wrote:
> 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().
>
>   


Another patch renamed to dvb_frontend_active as you proposed.

http://mcentral.de/~mrec/patches/dvb_frontend_active.diff

Signed-off-by: Markus Rechberger <markus.rechberger at amd.com>

diff -r 1f66c6c06956 linux/drivers/media/dvb/dvb-core/dvb_frontend.c
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c   Mon Aug 13 
08:12:06 2007 -0300
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c   Tue Aug 14 
14:09:21 2007 +0200
@@ -133,6 +133,21 @@ struct dvb_frontend_private {
 };

 static void dvb_frontend_wakeup(struct dvb_frontend *fe);
+
+int dvb_frontend_active(struct dvb_frontend *fe)
+{
+      struct dvb_frontend_private *fepriv = fe->frontend_priv;
+      struct dvb_fe_events *events = &fepriv->events;
+      int ret;
+
+      ret = (fepriv->thread) ? true:false;
+
+      return ret;
+}
+
+
+
+EXPORT_SYMBOL(dvb_frontend_active);

 static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t 
status)
 {
diff -r 1f66c6c06956 linux/drivers/media/dvb/dvb-core/dvb_frontend.h
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h   Mon Aug 13 
08:12:06 2007 -0300
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h   Tue Aug 14 
14:07:45 2007 +0200
@@ -170,6 +170,8 @@ extern void dvb_frontend_detach(struct d

 extern void dvb_frontend_reinitialise(struct dvb_frontend *fe);

+extern int dvb_frontend_active(struct dvb_frontend *fe);
+
 extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 
add_usec);
 extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval 
curtime);

thanks,
Markus






More information about the linux-dvb mailing list