1. 23 2月, 2016 1 次提交
    • M
      [media] media-device: move PCI/USB helper functions from v4l2-mc · 41b44e35
      Mauro Carvalho Chehab 提交于
      Those ancillary functions could be called even when compiled
      without V4L2 support, as warned by ktest build robot:
      
      All errors (new ones prefixed by >>):
      
      >> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb/dvb-usb.ko] undefined!
      >> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb-v2/dvb_usb_v2.ko] undefined!
      >> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/au0828/au0828.ko] undefined!
      
      Also, there's nothing there that are specific to V4L2. So, move
      those ancillary functions to MC core.
      
      No functional changes. Just function rename.
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      41b44e35
  2. 16 2月, 2016 1 次提交
  3. 10 2月, 2016 2 次提交
    • M
      [media] au0828: move V4L2-specific code to au0828-core.c · 7b606ffd
      Mauro Carvalho Chehab 提交于
      Instead of having lots of #ifdefs inside au0828-core due to
      V4L2, move the dependencies to au0828-video.c. That allows
      removing all those ifdefs, as au0828-video is only compiled if
      CONFIG_VIDEO_AU0828_V4L2.
      
      This fixes the following warnings reported by Kbuild test
      with a random config with au0828 enabled, but V4L2 is disabled.
      
      All warnings (new ones prefixed by >>):
      
         drivers/media/usb/au0828/au0828-core.c: In function 'au0828_usb_probe':
      >> drivers/media/usb/au0828/au0828-core.c:463:1: warning: label 'done' defined but not used [-Wunused-label]
          done:
          ^
         drivers/media/usb/au0828/au0828-core.c: At top level:
         drivers/media/usb/au0828/au0828-core.c:250:12: warning: 'au0828_create_media_graph' defined but not used [-Wunused-function]
          static int au0828_create_media_graph(struct au0828_dev *dev)
                     ^
      
      Tested with a WinTV HVR 950Q (USB ID: 2040:7200)
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      7b606ffd
    • M
      [media] au0828: only create V4L2 graph if V4L2 is registered · 82e92f4c
      Mauro Carvalho Chehab 提交于
      It doesn't make sense to try to create the analog TV graph,
      if the device fails to register at V4L2, or if it doesn't have
      V4L2 support.
      
      Thanks to Shuah for pointing this issue.
      Reported-by: NShuah Khan <shuahkh@osg.samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      82e92f4c
  4. 01 2月, 2016 1 次提交
  5. 11 1月, 2016 12 次提交
    • M
      [media] usb: check media device errors · 9f806795
      Mauro Carvalho Chehab 提交于
      There are now two new warnings:
      
      drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_media_device_register':
      drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:433:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
        media_device_register(adap->dvb_adap.mdev);
        ^
      drivers/media/usb/dvb-usb/dvb-usb-dvb.c: In function 'dvb_usb_media_device_register':
      drivers/media/usb/dvb-usb/dvb-usb-dvb.c:128:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
        media_device_register(adap->dvb_adap.mdev);
        ^
      
      Those are because the drivers are not properly checking if the
      media device init and register were succeeded.
      
      Fix it.
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      9f806795
    • J
      [media] media-device: split media initialization and registration · 9832e155
      Javier Martinez Canillas 提交于
      The media device node is registered and so made visible to user-space
      before entities are registered and links created which means that the
      media graph obtained by user-space could be only partially enumerated
      if that happens too early before all the graph has been created.
      
      To avoid this race condition, split the media init and registration
      in separate functions and only register the media device node when
      all the pending subdevices have been registered, either explicitly
      by the driver or asynchronously using v4l2_async_register_subdev().
      
      The media_device_register() had a check for drivers not filling dev
      and model fields but all drivers in mainline set them and not doing
      it will be a driver bug so change the function return to void and
      add a BUG_ON() for dev being NULL instead.
      
      Also, add a media_device_cleanup() function that will destroy the
      graph_mutex that is initialized in media_device_init().
      
      [mchehab@osg.samsung.com: Fix compilation if !CONFIG_MEDIA_CONTROLLER
       and remove two warnings added by this changeset]
      Suggested-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com>
      Acked-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      9832e155
    • M
      [media] uapi/media.h: Rename entities types to functions · 4ca72efa
      Mauro Carvalho Chehab 提交于
      Rename the userspace types from MEDIA_ENT_T_ to MEDIA_ENT_F_
      and add the backward compatibility bits.
      
      The changes at the .c files was generated by the following
      coccinelle script:
      
      @@
      @@
      -MEDIA_ENT_T_UNKNOWN
      +MEDIA_ENT_F_UNKNOWN
      @@
      @@
      -MEDIA_ENT_T_DVB_BASE
      +MEDIA_ENT_F_DVB_BASE
      @@
      @@
      -MEDIA_ENT_T_V4L2_BASE
      +MEDIA_ENT_F_V4L2_BASE
      @@
      @@
      -MEDIA_ENT_T_V4L2_SUBDEV_BASE
      +MEDIA_ENT_F_V4L2_SUBDEV_BASE
      @@
      @@
      -MEDIA_ENT_T_CONNECTOR_BASE
      +MEDIA_ENT_F_CONNECTOR_BASE
      @@
      @@
      -MEDIA_ENT_T_V4L2_VIDEO
      +MEDIA_ENT_F_IO_V4L
      @@
      @@
      -MEDIA_ENT_T_V4L2_VBI
      +MEDIA_ENT_F_IO_VBI
      @@
      @@
      -MEDIA_ENT_T_V4L2_SWRADIO
      +MEDIA_ENT_F_IO_SWRADIO
      @@
      @@
      -MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN
      +MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN
      @@
      @@
      -MEDIA_ENT_T_CONN_RF
      +MEDIA_ENT_F_CONN_RF
      @@
      @@
      -MEDIA_ENT_T_CONN_SVIDEO
      +MEDIA_ENT_F_CONN_SVIDEO
      @@
      @@
      -MEDIA_ENT_T_CONN_COMPOSITE
      +MEDIA_ENT_F_CONN_COMPOSITE
      @@
      @@
      -MEDIA_ENT_T_CONN_TEST
      +MEDIA_ENT_F_CONN_TEST
      @@
      @@
      -MEDIA_ENT_T_V4L2_SUBDEV_SENSOR
      +MEDIA_ENT_F_CAM_SENSOR
      @@
      @@
      -MEDIA_ENT_T_V4L2_SUBDEV_FLASH
      +MEDIA_ENT_F_FLASH
      @@
      @@
      -MEDIA_ENT_T_V4L2_SUBDEV_LENS
      +MEDIA_ENT_F_LENS
      @@
      @@
      -MEDIA_ENT_T_V4L2_SUBDEV_DECODER
      +MEDIA_ENT_F_ATV_DECODER
      @@
      @@
      -MEDIA_ENT_T_V4L2_SUBDEV_TUNER
      +MEDIA_ENT_F_TUNER
      @@
      @@
      -MEDIA_ENT_T_DVB_DEMOD
      +MEDIA_ENT_F_DTV_DEMOD
      @@
      @@
      -MEDIA_ENT_T_DVB_DEMUX
      +MEDIA_ENT_F_TS_DEMUX
      @@
      @@
      -MEDIA_ENT_T_DVB_TSOUT
      +MEDIA_ENT_F_IO_DTV
      @@
      @@
      -MEDIA_ENT_T_DVB_CA
      +MEDIA_ENT_F_DTV_CA
      @@
      @@
      -MEDIA_ENT_T_DVB_NET_DECAP
      +MEDIA_ENT_F_DTV_NET_DECAP
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      4ca72efa
    • M
      [media] media-entity.h: rename entity.type to entity.function · 0e576b76
      Mauro Carvalho Chehab 提交于
      Entities should have one or more functions. Calling it as a
      type proofed to not be correct, as an entity could eventually
      have more than one type.
      
      So, rename the field as function.
      
      Please notice that this patch doesn't extend support for
      multiple function entities. Such change will happen when
      we have real case drivers using it.
      
      No functional changes.
      Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      0e576b76
    • M
      [media] au0828: enforce check for graph creation · 4e26f3ab
      Mauro Carvalho Chehab 提交于
      If the graph creation fails, don't register the device.
      Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      4e26f3ab
    • M
      [media] au0828: Create connector links · 28b6ba11
      Mauro Carvalho Chehab 提交于
      Now that connectors are entities, we need to represent the
      connector links.
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      28b6ba11
    • M
      [media] au0828: add support for the connectors · d1f33737
      Mauro Carvalho Chehab 提交于
      Depending on the input, an au0828 may have a different
      number of connectors. add entities to represent them.
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      d1f33737
    • M
      [media] au0828: postpone call to au0828_unregister_media_device() · 7e9a8ad5
      Mauro Carvalho Chehab 提交于
      The DVB core needs to unregister the media device. So, we
      can't call au0828_unregister_media_device() before calling
      au0828_dvb_unregister(), otherwise the DVB MC free code
      (that will be implemented on the next patch) will fail.
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      7e9a8ad5
    • M
      [media] tuner-core: add an input pad · 188d2d55
      Mauro Carvalho Chehab 提交于
      Tuners actually have at least one connector on its input.
      
      Add a PAD to connect it.
      Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      188d2d55
    • M
      [media] media: convert links from array to list · 57208e5e
      Mauro Carvalho Chehab 提交于
      The entire logic that represent graph links were developed on a
      time where there were no needs to dynamic remove links. So,
      although links are created/removed one by one via some
      functions, they're stored as an array inside the entity struct.
      
      As the array may grow, there's a logic inside the code that
      checks if the amount of space is not enough to store
      the needed links. If it isn't the core uses krealloc()
      to change the size of the link, with is bad, as it
      leaves the memory fragmented.
      
      So, convert links into a list.
      
      Also, currently,  both source and sink entities need the link
      at the graph traversal logic inside media_entity. So there's
      a logic duplicating all links. That makes it to spend
      twice the memory needed. This is not a big deal for today's
      usage, where the number of links are not big.
      
      Yet, if during the MC workshop discussions, it was said that
      IIO graphs could have up to 4,000 entities. So, we may
      want to remove the duplication on some future. The problem
      is that it would require a separate linked list to store
      the backlinks inside the entity, or to use a more complex
      algorithm to do graph backlink traversal, with is something
      that the current graph traversal inside the core can't cope
      with. So, let's postpone a such change if/when it is actually
      needed.
      
      It should also be noticed that the media_link structure uses
      44 bytes on 32-bit architectures and 84 bytes on 64-bit
      architecture. It will thus be allocated out of the 64-bytes and
      96-bytes pools respectively. That's a 12.5% memory waste on
      64-bit architectures and 31.25% on 32-bit architecture.
      A linked list is less efficient than an array in this case, but
      this could later be optimized if we can get rid of the reverse
      links (with would reduce memory allocation by 50%).
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      57208e5e
    • M
      [media] media: rename the function that create pad links · 8df00a15
      Mauro Carvalho Chehab 提交于
      With the new API, a link can be either between two PADs or between an interface
      and an entity. So, we need to use a better name for the function that create
      links between two pads.
      
      So, rename the such function to media_create_pad_link().
      
      No functional changes.
      
      This patch was created via this shell script:
      	for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a && mv a $i; done
      Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
      Tested-by: NJavier Martinez Canillas <javier@osg.samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      8df00a15
    • R
      [media] au0828: Add support for media controller · bed69196
      Rafael Lourenço de Lima Chehab 提交于
      Add support for analog and dvb tv using media controller.
      Signed-off-by: NRafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      bed69196
  6. 10 6月, 2015 1 次提交
  7. 25 11月, 2014 1 次提交
    • S
      [media] media/au0828: Fix IR stop, poll to not access device during disconnect · eb336eab
      Shuah Khan 提交于
      au0828 IR stop and poll routines continue to access device
      while usb disconnect is in progress. There is small window
      between device disconnect and usb interface is set to null.
      This results in filling the log with several of the following
      error messages. Fix it to detect device disconnect condition
      and avoid device access.
      
      Nov 20 18:58:02 anduin kernel: [  102.949819] au0828: au0828_usb_disconnect()
      Nov 20 18:58:02 anduin kernel: [  102.950046] au0828: send_control_msg() Failed sending control message, error -71.
      Nov 20 18:58:02 anduin kernel: [  102.950052] au0828: send_control_msg() Failed sending control message, error -19.
      Nov 20 18:58:02 anduin kernel: [  102.950056] au0828: send_control_msg() Failed sending control message, error -19.
      Nov 20 18:58:02 anduin kernel: [  102.950061] au0828: send_control_msg() Failed sending control message, error -19.
      Nov 20 18:58:02 anduin kernel: [  102.950065] au0828: recv_control_msg() Failed receiving control message, error -19.
      Nov 20 18:58:02 anduin kernel: [  102.950069] au0828: recv_control_msg() Failed receiving control message, error -19.
      Nov 20 18:58:02 anduin kernel: [  102.950072] au0828: recv_control_msg() Failed receiving control message, error -19.
      Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      eb336eab
  8. 22 8月, 2014 7 次提交
  9. 31 7月, 2014 1 次提交
  10. 13 1月, 2014 1 次提交
  11. 26 3月, 2013 2 次提交
  12. 18 12月, 2012 1 次提交
  13. 16 8月, 2012 1 次提交
  14. 11 8月, 2012 1 次提交
    • D
      [media] au0828: fix possible race condition in usage of dev->ctrlmsg · 77fc2863
      Devin Heitmueller 提交于
      The register read function is referencing the dev->ctrlmsg structure outside
      of the dev->mutex lock, which can cause corruption of the value if multiple
      callers are invoking au0828_readreg() simultaneously.
      
      Use a stack variable to hold the result, and copy the buffer returned by
      usb_control_msg() to that variable.
      
      In reality, the whole recv_control_msg() function can probably be collapsed
      into au0288_readreg() since it is the only caller.
      
      Also get rid of cmd_msg_dump() since the only case in which the function is
      ever called only is ever passed a single byte for the response (and it is
      already logged).
      Signed-off-by: NDevin Heitmueller <dheitmueller@kernellabs.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      77fc2863
  15. 10 8月, 2012 2 次提交
  16. 28 7月, 2011 1 次提交
    • M
      [media] Stop using linux/version.h on most video drivers · 1990d50b
      Mauro Carvalho Chehab 提交于
      All the modified drivers didn't have any version increment since
      Jan, 1 2011. Several of them didn't have any version increment
      for a long time, even having new features and important bug fixes
      happening.
      
      As we're now filling the QUERYCAP version with the current Kernel
      Release, we don't need to maintain a per-driver version control
      anymore. So, let's just use the default.
      
      In order to preserve the Kernel module version history, a
      KERNEL_VERSION() macro were added to all modified drivers, and
      the extraver number were incremented.
      
      I opted to preserve the per-driver version control to a few
      pwc, pvrusb2, s2255, s5p-fimc and sh_vou.
      
      A few drivers are still using the legacy way to handle ioctl's.
      So, we can't do such change on them, otherwise, they'll break.
      Those are: uvc, et61x251 and sn9c102.
      
      The rationale is that the per-driver version control seems to be
      actively maintained on those.
      
      Yet, I think that the better for them would be to just use the
      default version numbering, instead of doing that by themselves.
      
      While here, removed a few uneeded include linux/version.h
      Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      1990d50b
  17. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  18. 17 6月, 2009 2 次提交
  19. 30 4月, 2009 1 次提交