dect
/
linux-2.6
Archived
13
0
Fork 0
Commit Graph

68 Commits

Author SHA1 Message Date
David Howells 9ffc93f203 Remove all #inclusions of asm/system.h
Remove all #inclusions of asm/system.h preparatory to splitting and killing
it.  Performed with the following command:

perl -p -i -e 's!^#\s*include\s*<asm/system[.]h>.*\n!!' `grep -Irl '^#\s*include\s*<asm/system[.]h>' *`

Signed-off-by: David Howells <dhowells@redhat.com>
2012-03-28 18:30:03 +01:00
Clemens Ladisch fa5034c667 [media] media: fix truncated entity specification
When enumerating an entity, assign the entire entity specification
instead of only the first two words. (This requires giving the
specification union a name.)

So far, no driver actually uses more than two words, but this will
be needed for ALSA entities.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
[laurent.pinchart@ideasonboard.com: Rename specification to info]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-20 09:31:50 -02:00
Guennadi Liakhovetski 1fc2b5f7fb [media] V4L: cosmetic clean up
Improve the use of the WARN_ON() macro and use a local variable, instead
of reduntantly dereferencing a pointer in v4l2-dev.c

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11 09:47:21 -02:00
Antonio Ospite e58fced201 [media] videodev: fix a NULL pointer dereference in v4l2_device_release()
The change in 8280b66 does not cover the case when v4l2_dev is already
NULL, fix that.

With a Kinect sensor, seen as an USB camera using GSPCA in this context,
a NULL pointer dereference BUG can be triggered by just unplugging the
device after the camera driver has been loaded.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-10-19 09:48:08 -02:00
Hans Verkuil 8280b662df [media] v4l: Fix use-after-free case in v4l2_device_release
Drivers that have no v4l2_device release callback might free the
v4l2_device instance in the video_device release callback. Make sure we
don't access the v4l2_device instance after it gets freed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-21 22:17:43 -03:00
Laurent Pinchart c064b8eac8 [media] v4l: Don't access media entity after is has been destroyed
Entities associated with video device nodes are unregistered in
video_unregister_device(). This destroys the entity even though it can
still be accessed through open video device nodes.

Move the media_device_unregister_entity() call from
video_unregister_device() to v4l2_device_release() to ensure that the
entity isn't unregistered until the last reference to the video device
is released.

Also remove the media_entity_get()/put() calls from v4l2-dev.c. Those
functions were designed for subdevs, to avoid a parent module from being
removed while still accessible through board code. They're not currently
needed for video device nodes, and will oops when a hotpluggable device
is disconnected during streaming, as media_entity_put() called in
v4l2_device_release() tries to access entity->parent->dev->driver which
is set to NULL when the device is disconnected.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-06-30 23:12:36 -03:00
Bob Liu ecc6517d94 [media] Revert "V4L/DVB: v4l2-dev: remove get_unmapped_area"
This reverts commit c29fcff3da.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 12:14:40 -03:00
Laurent Pinchart c4f0b78ad5 [media] v4l: Don't register media entities for subdev device nodes
Subdevs already have their own entity, don't register as second one when
registering the subdev device node.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-04-19 11:29:19 -03:00
Hans Verkuil b1a873a37b [media] v4l2: use new flag to enable core priority handling
Rather than guess which driver supports core priority handling, require drivers
that do to explicitly set the V4L2_FL_USE_FH_PRIO flag in video_device.

Updated the core prio handling accordingly and set the flag in the three
drivers that do.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22 16:38:16 -03:00
Hans Verkuil bedf8bcf6b [media] v4l2-device: add kref and a release function
The video_device struct has proper ref counting and its release function
will be called when the last user releases it. But no such support was
available for struct v4l2_device. This made it hard to determine when a
USB driver can release the device if it has multiple device nodes.

With one device node it is easy of course, since when the device node is
released, the whole device can be released.

This patch adds refcounting to v4l2_device. When registering device nodes
the v4l2_device refcount will be increased, when releasing device nodes
it will be decreased. The (optional) release function will be called when
the last device node was released.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22 16:38:05 -03:00
Hans Verkuil 0f62fd6a2f [media] v4l2: add v4l2_prio_state to v4l2_device and video_device
Integrate the v4l2_prio_state into the core, ready for use.

One struct v4l2_prio_state is added to v4l2_device and a pointer
to a prio state is added to video_device.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22 16:37:55 -03:00
Hans Verkuil 0226549308 [media] v4l2_prio: move from v4l2-common to v4l2-dev
We are going to move priority handling into the v4l2 core. As a consequence
the v4l2_prio helper functions need to be moved into the core videodev
module as well to prevent circular dependencies.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22 16:37:54 -03:00
Laurent Pinchart 2c0ab67be1 [media] v4l: Make video_device inherit from media_entity
V4L2 devices are media entities. As such they need to inherit from
(include) the media_entity structure.

When registering/unregistering the device, the media entity is
automatically registered/unregistered. The entity is acquired on device
open and released on device close.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22 04:53:19 -03:00
Laurent Pinchart 2096a5dcf9 [media] v4l: subdev: Add device node support
Create a device node named subdevX for every registered subdev.

As the device node is registered before the subdev core::s_config
function is called, return -EGAIN on open until initialization
completes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Vimarsh Zutshi <vimarsh.zutshi@gmail.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-21 20:32:42 -03:00
Hans Verkuil 46b633779b [media] v4l2-dev: don't memset video_device.dev
Zeroing video_device.dev causes a memory leak if video_set_drvdata
was called before video_register_device was called. video_set_drvdata
calls dev_set_drvdata which allocates video_device.dev.p.

memsetting this will prevent freeing of that memory.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:52:13 -02:00
Hans Verkuil ca9afe6f87 [media] v4l2-dev: fix race condition
The unregister function had a race condition with the v4l2_open
function. Ensure that both functions test and clear the REGISTER
flag from within a critical section.

Thanks to Laurent Pinchart for finding this race.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-01 20:10:20 -02:00
Hans Verkuil 879aa24d63 [media] V4L: improve the BKL replacement heuristic
The BKL replacement mutex had some serious performance side-effects on
V4L drivers. It is replaced by a better heuristic that works around the
worst of the side-effects.

Read the v4l2-dev.c comments for the whole sorry story. This is a
temporary measure only until we can convert all v4l drivers to use
unlocked_ioctl.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-01 20:10:19 -02:00
Hans Verkuil 2877842de8 [media] v4l2-dev: use mutex_lock_interruptible instead of plain mutex_lock
Where reasonable use mutex_lock_interruptible instead of mutex_lock.
Also fix the poll, read and write error codes when called with an unregistered
device (e.g. after a USB device was disconnected). Poll must return
POLLERR|POLLHUP and read/write must return -ENODEV.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-01 20:10:18 -02:00
Arnd Bergmann 0edf2e5e2b [media] v4l: kill the BKL
All of the hard problems for BKL removal appear to be solved in the
v4l-dvb/master tree. This removes the BKL from the various open
functions that do not need it, or only use it to protect an
open count.

The zoran driver is nontrivial in this regard, so I introduce
a new mutex that locks both the open/release and the ioctl
functions. Someone with access to the hardware can probably
improve that by using the existing lock in all cases.

Finally, all drivers that still use the locked version of the
ioctl function now get called under a new mutex instead of
the BKL.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-08 22:35:57 -02:00
Mauro Carvalho Chehab 7242063018 V4L/DVB: Fix a merge conflict that affects unlock_ioctl
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:16:58 -02:00
Hans Verkuil ee6869afc9 V4L/DVB: v4l2: add core serialization lock
Drivers can optionally set a pointer to a mutex in struct video_device.
The core will use that to lock before calling open, read, write, unlocked_ioctl,
poll, mmap or release.

Updated the documentation as well and ensure that v4l2-event knows about the
lock: it will unlock it before doing a blocking wait on an event and relock it
afterwards.

Ensure that the 'video_is_registered' check is done when the lock is held:
a typical disconnect will take the lock as well before unregistering the
device nodes, so to prevent race conditions the video_is_registered check
should also be done with the lock held.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:14 -02:00
Hans Verkuil c29fcff3da V4L/DVB: v4l2-dev: remove get_unmapped_area
The get_unmapped_area file operation is unused. Remove.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:14 -02:00
Hans Verkuil d69f27186c V4L/DVB: v4l2-dev: after a disconnect any ioctl call will be blocked
Until now all fops except release and (unlocked_)ioctl returned an error
after the device node was unregistered. Extend this as well to the ioctl
fops. There is nothing useful that an application can do here and it
complicates the driver code unnecessarily.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:14 -02:00
Hans Verkuil 226c0eeaea V4L/DVB: videotext: remove this obsolete API
Remove the vtx (aka videotext aka teletext) API from the v4l2 core.
This API was scheduled for removal in kernel 2.6.35.

The vtx device nodes have been superseded by vbi device nodes
for many years. No applications exist that use the vtx support.
Of the two i2c drivers that actually support this API the saa5249
has been impossible to use for a year now and no known hardware
that supports this device exists. The saa5246a is theoretically
supported by the old mxb boards, but it never actually worked.

In summary: there is no hardware that can use this API and there
are no applications actually implementing this API.

The vtx support still reserves minors 192-223 and we would really
like to reuse those for upcoming new functionality. In the unlikely
event that new hardware appears that wants to use the functionality
provided by the vtx API, then that functionality should be build
around the sliced VBI API instead.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:05:48 -02:00
Linus Torvalds 7ae0dea900 Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (94 commits)
  V4L/DVB: tvp7002: fix write to H-PLL Feedback Divider LSB register
  V4L/DVB: dvb: siano: free spinlock before schedule()
  V4L/DVB: media: video: pvrusb2: remove custom hex_to_bin()
  V4L/DVB: drivers: usbvideo: remove custom implementation of hex_to_bin()
  V4L/DVB: Report supported QAM modes on bt8xx
  V4L/DVB: media: ir-keytable: null dereference in debug code
  V4L/DVB: ivtv: convert to the new control framework
  V4L/DVB: ivtv: convert gpio subdev to new control framework
  V4L/DVB: wm8739: convert to the new control framework
  V4L/DVB: cs53l32a: convert to new control framework
  V4L/DVB: wm8775: convert to the new control framework
  V4L/DVB: cx2341x: convert to the control framework
  V4L/DVB: cx25840: convert to the new control framework
  V4L/DVB: cx25840/ivtv: replace ugly priv control with s_config
  V4L/DVB: saa717x: convert to the new control framework
  V4L/DVB: msp3400: convert to the new control framework
  V4L/DVB: saa7115: convert to the new control framework
  V4L/DVB: v4l2: hook up the new control framework into the core framework
  V4L/DVB: Documentation: add v4l2-controls.txt documenting the new controls API
  V4L/DVB: v4l2-ctrls: Whitespace cleanups
  ...
2010-08-10 15:09:54 -07:00
Hans Verkuil 11bbc1cadb V4L/DVB: v4l2: hook up the new control framework into the core framework
Add the calls needed to automatically merge subdev controls into a bridge
control handler.

Hook up the control framework in __video_ioctl2 and video_register_device.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08 23:43:04 -03:00
Frederic Weisbecker d9a145fb6e Merge commit 'linus/master' into bkl/core
Merge reason: The staging tree has introduced the easycap
driver lately. We need the latest updates to pushdown the
bkl in its ioctl helper.
2010-08-09 02:14:15 +02:00
Arnd Bergmann 86a5ef7d77 v4l: Convert v4l2-dev to unlocked_ioctl
v4l2 implements two separate file operations for drivers that
use locked and unlocked ioctl callbacks. Since we want to remove
the ioctl file operation in favor of the unlocked variant, this
separation no longer seems helpful.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
2010-08-09 00:10:31 +02:00
Anatolij Gustschin 1bb6419433 V4L/DVB: v4l2-dev: fix memory leak
Since commit b402843787
the 'driver_data' field resides in device's struct device_private
which may be allocated by dev_set_drvdata() if device_private
struct was not allocated previously.

dev_set_drvdata() is used in video_set_drvdata() to set
the driver's private data pointer in v4l2 drivers. Setting
the private data _before_ registering the v4l2 device results
in a memory leak since __video_register_device() also calls
video_set_drvdata(), but after zeroing the device structure.
Thus, the reference to the previously allocated device_private
struct goes lost and a new device_private will be allocated.

All v4l drivers which call video_set_drvdata() _before_
calling video_register_device() are affected. The patch fixes
__video_register_device() to preserve previously allocated
device_private reference.

Caught by kmemleak.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 15:36:02 -03:00
Hans Verkuil dd0daf2a6f V4L/DVB: v4l2-dev: remove unnecessary lock around atomic clear_bit
No need to lock when unregistering the device: clear_bit is already an
atomic operation.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:58:56 -03:00
Sakari Ailus 1babcb460f V4L/DVB: V4L: File handles
This patch adds a list of v4l2_fh structures to every video_device.
It allows using file handle related information in V4L2. The event interface
is one example of such use.

The use of v4l2_fh is not mandatory for drivers.

Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:58:04 -03:00
Laurent Pinchart 957b4aa9f7 V4L/DVB (13552): v4l: Replace video_is_unregistered with video_is_registered
Replace the video_is_unregistered function by a video_is_registered
function. The V4L2_FL_UNREGISTERED flag is replaced by a
V4L2_FL_REGISTERED flag.

This change makes the video_is_registered function return coherent
results when called on an initialize but not yet registered video_device
instance. The function can now be used instead of checking
video_device::minor.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16 00:17:55 -02:00
Laurent Pinchart eac8ea536a V4L/DVB (13549): v4l: Add video_device_node_name function
Many drivers access the device number (video_device::v4l2_devnode::num)
in order to print the video device node name. Add and use a helper
function to retrieve the video_device node name.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16 00:17:54 -02:00
Hans Verkuil 6b5270d212 V4L/DVB (12725): v4l: warn when desired devnodenr is in use & add _no_warn function
Warn when the desired device node number is already in use, except when
the new video_register_device_no_warn function is called since in some
use-cases that warning is not relevant.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:19:34 -03:00
Hans Verkuil 5062cb70c8 V4L/DVB (12724): v4l2-dev: add simple wrapper functions around the devnode numbers
There are some subtle differences in the way the devnode numbers are
handled depending on whether the FIXED_MINOR_RANGES config option is
set. Add some simple wrapper functions to handle that correctly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:19:31 -03:00
Hans Verkuil 22e221258b V4L/DVB (12722): v4l2-dev: replace 'kernel number' by 'device node number'.
The term 'kernel number' is very vague, so replace it with the somewhat more
descriptive term 'device node number'.

In one place the local variable 'nr' was used to create the device node number
of the new device name. This has been replaced with the vdev->num field to
more clearly mark this as being the device node number and not the minor
number.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:19:27 -03:00
Hans Verkuil 7ae0cd9bc7 V4L/DVB (12541): v4l: remove video_register_device_index
video_register_device_index is never actually called, instead the
stream index number is always calculated automatically.

This patch removes this function and simplifies the internal get_index
function since that can now always just return the first free index.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:19:26 -03:00
Alexey Dobriyan 405f55712d headers: smp_lock.h redux
* Remove smp_lock.h from files which don't need it (including some headers!)
* Add smp_lock.h to files which do need it
* Make smp_lock.h include conditional in hardirq.h
  It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

  This will make hardirq.h inclusion cheaper for every PREEMPT=n config
  (which includes allmodconfig/allyesconfig, BTW)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-12 12:22:34 -07:00
Hans Verkuil 65d9ff9c85 V4L/DVB (11390): 2-dev.c: return 0 for NULL open and release callbacks
Patch allows v4l2_open and v4l2_release functions return 0 if open and
release driver callbacks set to NULL. This will be used in radio
drivers.

--

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:30 -03:00
Daniel Glöckner c01f1a5a24 V4L/DVB (11242): allow v4l2 drivers to provide a get_unmapped_area handler
Shared memory mappings on nommu machines require a get_unmapped_area
file operation that suggests an address for the mapping. This patch
adds a way for v4l2 drivers to provide this callback.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:43 -03:00
Hans Verkuil 005759613b V4L/DVB (10988): v4l2-dev: use parent field if the v4l2_device has no parent set.
Normally the parent device of v4l2_device is used as the video device
node's parent. But if it was not set, then use the parent field in the
video_device struct.

This is needed in the cx88 driver, which has one core v4l2_device but
creates multiple pci devices (one each for raw and mpeg video).

So you cannot associate the core v4l2_device with a particular PCI device,
but you can do that for each video_device.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:20 -03:00
Scott James Remnant cbb72b0f69 V4L/DVB (10947): Auto-load videodev module when device opened.
The videodev module is missing the char-major-81-* alias that would
cause it to be auto-loaded when a device of that type is opened.  This
patch adds the alias.

Signed-off-by: Scott James Remnant <scott@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:18 -03:00
Trent Piepho 428c8d1916 V4L/DVB (10791): videodev: not possible to register NULL video_device
video_register_device_index() checks if it was passed a NULL video_device
pointer (which isn't allowed) _after_ it has already dereferenced it with
video_get_drvdata(vdev).  The checks are clearly pointless and can be
removed, as the function would have crashed before reaching them if vdev
ever was NULL.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:03 -03:00
Hans Verkuil 775a05dd54 V4L/DVB (10641): v4l2-dev: remove limit of 32 devices per driver in get_index()
get_index() had a limitation of 32 devices per driver. This was
unnecessarily strict and has been replaced with the maximum number
of devices. That should really satisfy anyone!

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:50 -03:00
Hans Verkuil 9bb7cde793 V4L/DVB (10139): v4l: rename v4l_compat_ioctl32 to v4l2_compat_ioctl32
This rename prevents conflicts with the older compat_ioctl32 module.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:39 -02:00
Hans Verkuil bec43661b1 V4L/DVB (10135): v4l2: introduce v4l2_file_operations.
Introduce a struct v4l2_file_operations for v4l2 drivers.

Remove the unnecessary inode argument.

Move compat32 handling (and llseek) into the v4l2-dev core: this is now
handled in the v4l2 core and no longer in the drivers themselves.

Note that this changeset reverts an earlier patch that changed the return
type of__video_ioctl2 from int to long. This change will be reinstated
later in a much improved version.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:12 -02:00
Hans Verkuil 9bea3514dd V4L/DVB (9974): v4l2-dev: allow drivers to pass v4l2_device as parent
Drivers that use v4l2_device can set that as parent pointer in the v4l2_dev
field instead of using the struct device parent field.

This allows v4l2-dev.c to check whether this driver is v4l2_device based,
and if so then it can offer additional services.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:35 -02:00
Hans Verkuil dc93a70cc7 V4L/DVB (9973): v4l2-dev: use the release callback from device instead of cdev
Instead of relying on the cdev release callback we should rely on the
release callback from the device struct. This requires that we use
get_device/put_device to do proper refcounting. In order to do this
safely v4l2-dev.c now sets up its own file_operations that call
out to the driver's ops.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:35 -02:00
Hans Verkuil 806e5b7cfa V4L/DVB (9942): v4l2-dev: check for parent device in get_index.
get_index requires a valid parent device in order to discover which
indices are in use. Some drivers (e.g. pvrusb2) do not set the parent
device. In that case just return 0.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:26 -02:00
Kay Sievers af128a102c V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name()
This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".

To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.

We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.

We want to submit a patch to -next, which will remove bus_id from
"struct device", to find the remaining pieces to convert, and finally
switch over to the new api, which will remove the 20 bytes array
and does no longer have a size limitation.

Thanks,
Kay

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29 17:53:26 -02:00