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

Markus Rechberger mrechberger at gmail.com
Tue Aug 14 17:45:20 CEST 2007


On 8/14/07, Christoph Pfister <christophpfister at gmail.com> wrote:
> Hi Markus,
>
> [ although you shouldn't overrate my opinion here I'm giving my $0.02 ]
>
> The problem with this approach are race conditions.
> You can't reliably use the result of this function if you don't ensure
> that no thread is started during / after the query. As far as I
> understood your idea you try to solve this issue with the
> allow-dvb-files-to-be-locked patch. But that patch doesn't handle file
> descriptors which have been opened before you did the "lock".
>
> Of course you can do additional work to fix that too - but imho the
> easier (and safer from a design-pov) approach is to do the locking at
> the bridge level as Steve did. I don't think that there are issues
> with handling it there - as neither dvb-core nor the frontends access
> the device directly (dvb-core via callbacks and the frontend via i2c
> adapter). Or do I miss something here?
>

There's some other code for checking if the filehandles are open but I
don't need that patch to go into the framework, it will be stored in
the local driver.
For now my aim is to bring in the most needed patches in and nothing else.

Markus

> Christoph
>
>
> 2007/8/14, Markus Rechberger <mrechberger at gmail.com>:
> > Could anyone comment or add this patch?
> >
> > thanks,
> > Markus
> >
> > On 8/9/07, Markus Rechberger <markus.rechberger at amd.com> wrote:
> > > Following patch adds the functionality to check if the dvb framework is
> > > idle or currently processing some commands.
> > >
> > > The return value of that function is true if fepriv->thread is set and
> > > false if not.
> > >
> > > This might become important for devices which supports video4linux
> > > (analogue TV) and digital TV. In case of a firmware reupload for a
> > > specific mode one framework has to be idle and should not interfere,
> > > this function adds the possibility for checking the current status of
> > > the DVB side.
> > >
> > > Signed-off-by: Markus Rechberger <markus.rechberger at amd.com>
> > >
> > > http://mcentral.de/~mrec/patches/dvb_frontend_eventstatus.diff
> > >
> > > diff -r cae47793b091 linux/drivers/media/dvb/dvb-core/dvb_frontend.c
> > > --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c    Tue Aug 07
> > > 10:52:55 2007 -0300
> > > +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c    Thu Aug 09
> > > 13:53:47 2007 +0200
> > > @@ -133,6 +133,25 @@ struct dvb_frontend_private {
> > >  };
> > >
> > >  static void dvb_frontend_wakeup(struct dvb_frontend *fe);
> > > +
> > > +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;
> > > +}
> > > +
> > > +
> > > +
> > > +EXPORT_SYMBOL(dvb_frontend_eventstatus);
> > >
> > >  static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t
> > > status)
> > >  {
> > > diff -r cae47793b091 linux/drivers/media/dvb/dvb-core/dvb_frontend.h
> > > --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h    Tue Aug 07
> > > 10:52:55 2007 -0300
> > > +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h    Thu Aug 09
> > > 13:52:26 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_eventstatus(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);
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > linux-dvb mailing list
> > > linux-dvb at linuxtv.org
> > > http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
> > >
> >
> >
> > --
> > Markus Rechberger
>


-- 
Markus Rechberger



More information about the linux-dvb mailing list