1. 21 5月, 2011 1 次提交
  2. 20 5月, 2011 1 次提交
  3. 31 3月, 2011 1 次提交
  4. 18 11月, 2010 1 次提交
  5. 21 10月, 2010 1 次提交
  6. 15 10月, 2010 1 次提交
    • A
      llseek: automatically add .llseek fop · 6038f373
      Arnd Bergmann 提交于
      All file_operations should get a .llseek operation so we can make
      nonseekable_open the default for future file operations without a
      .llseek pointer.
      
      The three cases that we can automatically detect are no_llseek, seq_lseek
      and default_llseek. For cases where we can we can automatically prove that
      the file offset is always ignored, we use noop_llseek, which maintains
      the current behavior of not returning an error from a seek.
      
      New drivers should normally not use noop_llseek but instead use no_llseek
      and call nonseekable_open at open time.  Existing drivers can be converted
      to do the same when the maintainer knows for certain that no user code
      relies on calling seek on the device file.
      
      The generated code is often incorrectly indented and right now contains
      comments that clarify for each added line why a specific variant was
      chosen. In the version that gets submitted upstream, the comments will
      be gone and I will manually fix the indentation, because there does not
      seem to be a way to do that using coccinelle.
      
      Some amount of new code is currently sitting in linux-next that should get
      the same modifications, which I will do at the end of the merge window.
      
      Many thanks to Julia Lawall for helping me learn to write a semantic
      patch that does all this.
      
      ===== begin semantic patch =====
      // This adds an llseek= method to all file operations,
      // as a preparation for making no_llseek the default.
      //
      // The rules are
      // - use no_llseek explicitly if we do nonseekable_open
      // - use seq_lseek for sequential files
      // - use default_llseek if we know we access f_pos
      // - use noop_llseek if we know we don't access f_pos,
      //   but we still want to allow users to call lseek
      //
      @ open1 exists @
      identifier nested_open;
      @@
      nested_open(...)
      {
      <+...
      nonseekable_open(...)
      ...+>
      }
      
      @ open exists@
      identifier open_f;
      identifier i, f;
      identifier open1.nested_open;
      @@
      int open_f(struct inode *i, struct file *f)
      {
      <+...
      (
      nonseekable_open(...)
      |
      nested_open(...)
      )
      ...+>
      }
      
      @ read disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      <+...
      (
         *off = E
      |
         *off += E
      |
         func(..., off, ...)
      |
         E = *off
      )
      ...+>
      }
      
      @ read_no_fpos disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ write @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      <+...
      (
        *off = E
      |
        *off += E
      |
        func(..., off, ...)
      |
        E = *off
      )
      ...+>
      }
      
      @ write_no_fpos @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ fops0 @
      identifier fops;
      @@
      struct file_operations fops = {
       ...
      };
      
      @ has_llseek depends on fops0 @
      identifier fops0.fops;
      identifier llseek_f;
      @@
      struct file_operations fops = {
      ...
       .llseek = llseek_f,
      ...
      };
      
      @ has_read depends on fops0 @
      identifier fops0.fops;
      identifier read_f;
      @@
      struct file_operations fops = {
      ...
       .read = read_f,
      ...
      };
      
      @ has_write depends on fops0 @
      identifier fops0.fops;
      identifier write_f;
      @@
      struct file_operations fops = {
      ...
       .write = write_f,
      ...
      };
      
      @ has_open depends on fops0 @
      identifier fops0.fops;
      identifier open_f;
      @@
      struct file_operations fops = {
      ...
       .open = open_f,
      ...
      };
      
      // use no_llseek if we call nonseekable_open
      ////////////////////////////////////////////
      @ nonseekable1 depends on !has_llseek && has_open @
      identifier fops0.fops;
      identifier nso ~= "nonseekable_open";
      @@
      struct file_operations fops = {
      ...  .open = nso, ...
      +.llseek = no_llseek, /* nonseekable */
      };
      
      @ nonseekable2 depends on !has_llseek @
      identifier fops0.fops;
      identifier open.open_f;
      @@
      struct file_operations fops = {
      ...  .open = open_f, ...
      +.llseek = no_llseek, /* open uses nonseekable */
      };
      
      // use seq_lseek for sequential files
      /////////////////////////////////////
      @ seq depends on !has_llseek @
      identifier fops0.fops;
      identifier sr ~= "seq_read";
      @@
      struct file_operations fops = {
      ...  .read = sr, ...
      +.llseek = seq_lseek, /* we have seq_read */
      };
      
      // use default_llseek if there is a readdir
      ///////////////////////////////////////////
      @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier readdir_e;
      @@
      // any other fop is used that changes pos
      struct file_operations fops = {
      ... .readdir = readdir_e, ...
      +.llseek = default_llseek, /* readdir is present */
      };
      
      // use default_llseek if at least one of read/write touches f_pos
      /////////////////////////////////////////////////////////////////
      @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read.read_f;
      @@
      // read fops use offset
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = default_llseek, /* read accesses f_pos */
      };
      
      @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ... .write = write_f, ...
      +	.llseek = default_llseek, /* write accesses f_pos */
      };
      
      // Use noop_llseek if neither read nor write accesses f_pos
      ///////////////////////////////////////////////////////////
      
      @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      identifier write_no_fpos.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ...
       .write = write_f,
       .read = read_f,
      ...
      +.llseek = noop_llseek, /* read and write both use no f_pos */
      };
      
      @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write_no_fpos.write_f;
      @@
      struct file_operations fops = {
      ... .write = write_f, ...
      +.llseek = noop_llseek, /* write uses no f_pos */
      };
      
      @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      @@
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = noop_llseek, /* read uses no f_pos */
      };
      
      @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      @@
      struct file_operations fops = {
      ...
      +.llseek = noop_llseek, /* no read or write fn */
      };
      ===== End semantic patch =====
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: Christoph Hellwig <hch@infradead.org>
      6038f373
  7. 03 8月, 2010 1 次提交
  8. 19 5月, 2010 1 次提交
    • M
      V4L/DVB: fix dvb frontend lockup · e36309f5
      matthieu castet 提交于
      If my dvb device is removed while in use, I got the following oops:
      
      [ 4920.484084] Call Trace:
      [ 4920.484102]  [<c102daad>] ? default_wake_function+0x0/0x8
      [ 4920.484147]  [<f8cb09e1>] ? dvb_unregister_frontend+0x95/0xcc [dvb_core]
      [ 4920.484157]  [<c1044412>] ? autoremove_wake_function+0x0/0x2d
      [ 4920.484168]  [<f8dd1af2>] ? dvb_usb_adapter_frontend_exit+0x12/0x21 [dvb_usb]
      [ 4920.484176]  [<f8dd12f1>] ? dvb_usb_exit+0x26/0x88 [dvb_usb]
      [ 4920.484184]  [<f8dd138d>] ? dvb_usb_device_exit+0x3a/0x4a [dvb_usb]
      [ 4920.484217]  [<f7fe1b08>] ? usb_unbind_interface+0x3f/0xb4 [usbcore]
      [ 4920.484227]  [<c11a4178>] ? __device_release_driver+0x74/0xb7
      [ 4920.484233]  [<c11a4247>] ? device_release_driver+0x15/0x1e
      [ 4920.484243]  [<c11a3a33>] ? bus_remove_device+0x6e/0x87
      [ 4920.484249]  [<c11a26d6>] ? device_del+0xfa/0x152
      [ 4920.484264]  [<f7fdf609>] ? usb_disable_device+0x59/0xb9 [usbcore]
      [ 4920.484279]  [<f7fdb9ee>] ? usb_disconnect+0x70/0xdc [usbcore]
      [ 4920.484294]  [<f7fdc728>] ? hub_thread+0x521/0xe1d [usbcore]
      [ 4920.484301]  [<c1044412>] ? autoremove_wake_function+0x0/0x2d
      [ 4920.484316]  [<f7fdc207>] ? hub_thread+0x0/0xe1d [usbcore]
      [ 4920.484321]  [<c10441e0>] ? kthread+0x61/0x66
      [ 4920.484327]  [<c104417f>] ? kthread+0x0/0x66
      [ 4920.484336]  [<c1003d47>] ? kernel_thread_helper+0x7/0x10
      
      If there are users (for example users == -2) :
       - dvb_unregister_frontend :
       - stop kernel thread with dvb_frontend_stop :
        - fepriv->exit = 1;
        - thread loop catch stop event and break while loop
        - fepriv->thread = NULL; and fepriv->exit = 0;
       - dvb_unregister_frontend wait on "fepriv->dvbdev->wait_queue" that fepriv->dvbdev->users==-1.
      The user finish :
       - dvb_frontend_release - set users to -1
       - don't wait wait_queue because fepriv->exit != 1
      
      => dvb_unregister_frontend never exit the wait queue.
      Signed-off-by: NMatthieu CASTET <castet.matthieu@free.fr>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      e36309f5
  9. 17 5月, 2010 1 次提交
  10. 27 2月, 2010 3 次提交
  11. 06 12月, 2009 2 次提交
  12. 02 12月, 2009 1 次提交
  13. 19 9月, 2009 3 次提交
  14. 12 9月, 2009 2 次提交
  15. 17 6月, 2009 2 次提交
    • D
      V4L/DVB (11875): dvb_frontend: fix case where fepriv->exit not reset · a5beb7b3
      Devin Heitmueller 提交于
      The fact that we now explicitly set fepriv->exit = 1 when the thread is
      shutting down exposed an edge case where it was not being reset back to zero
      once the thread went away in some cases.  This resulted in failures in cases
      where the frontend was closed, and then opened O_RDONLY, since in that case
      the thread is not being restarted but it was checking the fepriv->exit flag.
      
      Thanks to Thierry Lelegard, who and encountered and debugged a large portion
      of the issue in the same twelve hours that I did (as well as testing my patch).
      
      Cc: Thierry Lelegard <thierry.lelegard@tv-numeric.com>
      Signed-off-by: NDevin Heitmueller <dheitmueller@kernellabs.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      a5beb7b3
    • D
      V4L/DVB (11785): dvb_frontend: fix race condition resulting in dropped tuning commands · 57594a58
      Devin Heitmueller 提交于
      A race condition was detected in the case that putting the tuner to sleep takes
      an unusually long period of time, combined with applications that quickly
      close/open the dvb frontend.
      
      The kaffeine channel scanner closes and reopens the dvb frontend between each
      tuning attempt.  If it takes an unusually longer period of time to put the
      tuner to sleep (for example, the Pinnacle 801e takes 660 ms), the dvb_frontend
      thread will still be in a running state (and hence fepriv->thread is still set)
      but the fepriv->exit field will still be zero.  As a result, if a
      dvb_frontend_start() call arrives while the frontend thread is in the process
      of terminating, the call will return 0 without actually starting a new thread.
      This results in the tuning request being dropped.
      
      To address this, mark fepriv->exit as soon as we know the thread is going to
      be terminated, so that dvb_frontend_start() knows to start a new instance.
      
      Problem encountered with Kaffeine 0.8.7 doing ATSC scanning against the
      Pinnacle 801e tuner, in conjunction with new code to power down the xc5000
      when not in use.
      Signed-off-by: NDevin Heitmueller <dheitmueller@kernellabs.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      57594a58
  16. 30 3月, 2009 1 次提交
  17. 14 3月, 2009 1 次提交
  18. 08 1月, 2009 1 次提交
    • M
      V4L/DVB (10178): dvb_frontend: Fix some sparse warnings due to static symbols · 072ce0c5
      Mauro Carvalho Chehab 提交于
      /home/v4l/master/v4l/dvb_frontend.c:838:19: warning: symbol 'dtv_cmds' was not declared. Should it be static?
      /home/v4l/master/v4l/dvb_frontend.c:1035:6: warning: symbol 'dtv_property_dump' was not declared. Should it be static?
      /home/v4l/master/v4l/dvb_frontend.c:1066:5: warning: symbol 'is_legacy_delivery_system' was not declared. Should it be static?
      /home/v4l/master/v4l/dvb_frontend.c:1080:6: warning: symbol 'dtv_property_cache_sync' was not declared. Should it be static?
      /home/v4l/master/v4l/dvb_frontend.c:1132:6: warning: symbol 'dtv_property_legacy_params_sync' was not declared. Should it be static?
      /home/v4l/master/v4l/dvb_frontend.c:1187:6: warning: symbol 'dtv_property_adv_params_sync' was not declared. Should it be static?
      /home/v4l/master/v4l/dvb_frontend.c:1222:6: warning: symbol 'dtv_property_cache_submit' was not declared. Should it be static?
      /home/v4l/master/v4l/dvb_frontend.c:1253:5: warning: symbol 'dtv_property_process_get' was not declared. Should it be static?
      /home/v4l/master/v4l/dvb_frontend.c:1362:5: warning: symbol 'dtv_property_process_set' was not declared. Should it be static?
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      072ce0c5
  19. 30 12月, 2008 6 次提交
  20. 17 11月, 2008 2 次提交
  21. 11 11月, 2008 1 次提交
  22. 18 10月, 2008 5 次提交
    • S
      V4L/DVB (9274): Remove spurious messages and turn into debug. · a1bc84c0
      Steven Toth 提交于
      Remove spurious messages and turn into debug.
      Signed-off-by: NSteven Toth <stoth@linuxtv.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      a1bc84c0
    • D
      V4L/DVB (9264): MFE: bugfix: multi-frontend mutual exclusion parallel open · 6594690b
      Darron Broad 提交于
      When moving from one frontend to another
      an application could spawn multiple threads opening
      the same new frontend and in some circumstances all of
      these could become delayed waiting for the previous
      frontend readers or previous frontend writer thread to
      complete.
      
      In this scenario the first thread will succeed on open
      to bring the new frontend online but any others will return
      EBUSY. This is a fault.  If the first succeeds and all others
      are on the same frontend then they should succeed also.
      Signed-off-by: NDarron Broad <darron@kewl.org>
      Signed-off-by: NSteven Toth <stoth@linuxtv.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      6594690b
    • D
      V4L/DVB (9227): MFE: Add multi-frontend mutual exclusion · 59b1842d
      Darron Broad 提交于
      This add frontend R/W mutual exclusion.
      Prior to this point in time it was possible to open both
      frontends simultaneously which an MFE card cannot support.
      
      In order to stop this, a delayed open is performed which
      has the following function:
      
      -  Return EBUSY after a configurable amount of time
         if a frontend is unavailable due to the other being
         in use.
      
      -  Only allow opening of a frontend if the kernel thread
         of the other has stopped.
      
      This solution was chosen to allow switching between
      frontends to work as seamlessly as possible. When both
      frontends are actually opened simultaneously then one
      will only open, but if quick switching is performed
      between one of many then the new open will succeed in
      a clean fashion rather than interrupting a kernel
      thread.
      Signed-off-by: NDarron Broad <darron@kewl.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      59b1842d
    • S
      V4L/DVB (9222): S2API: Add Multiple-frontend on a single adapter support. · 363c35fc
      Steven Toth 提交于
      A detailed description from the original patches 2 years ago:
      
      "The WinTV-HVR3000 has a single transport bus which is shared between
      a DVB-T and DVB-S modulator. These patches build on the bus acquisition
      cx88 work from a few weeks ago to add support for this.
      
      So to applications the HVR3000 looks like this:
      /dev/dvb/adapter0/fe0 (cx24123 DVB-S demod)
      /dev/dvb/adapter0/fe1 (cx22702 DVB-T demod)
      
      Additional boards continue as before, eg:
      /dev/dvb/adapter1/fe0 (lgdt3302 ATSC demod)
      
      The basic change is removing the single instance of the videobuf_dvb in
      cx8802_dev and saa7134_dev(?) and replacing it with a list and some
      supporting functions.
      
      *NOTE* This branch was taken before v4l-dvb was closed for 2.6.19 so
      two or three current cx88 patches appear to be reversed by this tree,
      this will be cleaned up in the near future. The patches missing change
      the mutex handing to core->lock, fix an enumeration problem."
      
      It should be recognised that a number of people have been maintaining
      this patchset. Significant levels of Kudos to everyone one involved,
      including but not limited to:
      
      Darron Broad
      Fabio M. Di Nitto
      Carlo Scarfoglio
      Hans Werner
      
      Without the work of these people, and countless others, my two year old
      patches would of died on the Mercurial linuxtv.org vine a long time
      ago.
      
      TODO: Revise these patches a little further so that the need for
      demux1 and dvr0 is optional, not mandatory on the HVR3000.
      
      HISTORY (darron):
      This is the last update to MFE prepared by Hans which is based
      upon the `scratchpad' diff created by Carlo.
      All MFE work prior to that point must be attributed to Fabio
      who ported and maintained Steve's original patch up to that
      time.
      Signed-off-by: NSteven Toth <stoth@linuxtv.org>
      Signed-off-by: NDarron Broad <darron@kewl.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      363c35fc
    • M
  23. 13 10月, 2008 1 次提交