Commit Graph

103 Commits

Author SHA1 Message Date
Mauro Carvalho Chehab 0c0d06cac6 [media] rename most media/video usb drivers to media/usb
Rename all USB drivers with their own directory under
drivers/media/video into drivers/media/usb and update the
building system.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-15 16:25:07 -03:00
Hans Verkuil 4d345708ca [media] usbvision: remove V4L2_FL_LOCK_ALL_FOPS
Add proper locking to the file operations, allowing for the removal
of the V4L2_FL_LOCK_ALL_FOPS flag.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 19:45:19 -03:00
Hans Verkuil 5126f2590b [media] v4l2-dev: add flag to have the core lock all file operations
This used to be the default if the lock pointer was set, but now that lock is by
default only used for ioctl serialization. Those drivers that already used
core locking have this flag set explicitly, except for some drivers where
it was obvious that there was no need to serialize any file operations other
than ioctl.

The drivers that didn't need this flag were:

drivers/media/radio/dsbr100.c
drivers/media/radio/radio-isa.c
drivers/media/radio/radio-keene.c
drivers/media/radio/radio-miropcm20.c
drivers/media/radio/radio-mr800.c
drivers/media/radio/radio-tea5764.c
drivers/media/radio/radio-timb.c
drivers/media/video/vivi.c
sound/i2c/other/tea575x-tuner.c

The other drivers that use core locking and where it was not immediately
obvious that this flag wasn't needed were changed so that the flag is set
together with a comment that that driver needs work to avoid having to
set that flag. This will often involve taking the core lock in the fops
themselves.

Eventually this flag should go and it should not be used in new drivers.

There are a few reasons why we want to avoid core locking of non-ioctl
fops: in the case of mmap this can lead to a deadlock in rare situations
since when mmap is called the mmap_sem is held and it is possible for
other parts of the code to take that lock as well (copy_from_user()/copy_to_user()
perform a down_read(&mm->mmap_sem) when a page fault occurs).

It is very unlikely that that happens since the core lock serializes all
fops, but the kernel warns about it if lock validation is turned on.

For poll it is also undesirable to take the core lock as that can introduce
increased latency. The same is true for read/write.

While it was possible to make flags or something to turn on/off taking the
core lock for each file operation, in practice it is much simpler to just
not take it at all except for ioctl and leave it to the driver to take the
lock. There are only a handful fops compared to the zillion ioctls we have.

I also wanted to make it obvious which drivers still take the lock for all
fops, so that's why I chose to have drivers set it explicitly.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 09:19:38 -03:00
Mauro Carvalho Chehab 1990d50b58 [media] Stop using linux/version.h on most video drivers
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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-07-27 17:53:12 -03:00
Linus Torvalds df462b3dbe 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: (247 commits)
  [media] gspca - sunplus: Fix some warnings and simplify code
  [media] gspca: Fix some warnings tied to 'no debug'
  [media] gspca: Unset debug by default
  [media] gspca - cpia1: Remove a bad conditional compilation instruction
  [media] gspca - main: Remove USB traces
  [media] gspca - main: Version change to 2.13
  [media] gspca - stk014 / t613: Accept the index 0 in querymenu
  [media] gspca - kinect: Remove __devinitdata
  [media] gspca - cpia1: Fix some warnings
  [media] video/Kconfig: Fix mis-classified devices
  [media] support for medion dvb stick 1660:1921
  [media] tm6000: fix uninitialized field, change prink to dprintk
  [media] cx231xx: Add support for Iconbit U100
  [media] saa7134 add new TV cards
  [media] Use a more consistent value for RC repeat period
  [media] cx18: Move spinlock and vb_type initialisation into stream_init
  [media] tm6000: remove tm6010 sif audio start and stop
  [media] tm6000: remove unused exports
  [media] tm6000: add pts logging
  [media] tm6000: change from ioctl to unlocked_ioctl
  ...
2011-05-23 21:12:49 -07:00
Ondrej Zary 240d57bb82 [media] usbvision: add Nogatech USB MicroCam
Add Nogatech USB MicroCam PAL (NV3001P) and NTSC (NV3000N) support to
usbvision driver.
PAL version is tested, NTSC untested.
Data captured using usbsnoop, init_values are listed in the INF file along
with image dimensions, offsets and frame rates.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 09:29:29 -03:00
Joe Perches 85ee7a1d39 treewide: cleanup continuations and remove logging message whitespace
Using C line continuation inside format strings is error prone.
Clean up the unintended whitespace introduced by misuse of \.
Neaten correctly used line continations as well for consistency.

drivers/scsi/arcmsr/arcmsr_hba.c has these errors as well,
but arcmsr needs a lot more work and the driver should likely be
moved to staging instead.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-04-26 10:24:37 +02:00
Hans Verkuil 6d6a48e51f [media] usbvision: coding style
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-30 08:02:09 -02:00
Hans Verkuil 52cb0bf275 [media] usbvision: convert // to /* */
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-30 08:02:02 -02:00
Hans Verkuil 5490a7cbe6 [media] usbvision: get rid of camelCase
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-30 08:01:56 -02:00
Hans Verkuil c627b9d1f5 [media] usbvision: convert to unlocked_ioctl
Convert driver to use core-assisted locking.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-30 08:01:45 -02:00
Hans Verkuil 08af245de0 [media] V4L: remove V4L1 compatibility mode
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-29 08:17:07 -02:00
Arnd Bergmann 451a3c24b0 BKL: remove extraneous #include <smp_lock.h>
The big kernel lock has been removed from all these files at some point,
leaving only the #include.

Remove this too as a cleanup.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-11-17 08:59:32 -08:00
Hans Verkuil 8403472f19 V4L/DVB: usbvision: remove BKL from usbvision
Removed the BKL from usbvision.

There was an initialization bug as well where the i2c bus was registered twice.

Although when the BKL was present no oops was generated, I did run into
other i2c problems. Now that I protect against duplicate i2c registration
that bug is now gone as well.

But trying to disconnect the USB cable while someone is still using the device
still leads to a crash.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:06 -02:00
Julia Lawall 4202066c69 V4L/DVB: drivers/media: Eliminate a NULL pointer dereference
In each case, the print involves dereferencing a value that is NULL or is
near NULL.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
expression E,E1;
identifier f;
statement S1,S2,S3;
@@

if ((E == NULL && ...) || ...)
{
  ... when != if (...) S1 else S2
      when != E = E1
* E->f
  ... when any
  return ...;
}
else S3
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-06-01 01:24:22 -03:00
Hans Verkuil aeb506aaaa V4L/DVB: usbvision: don't use usb_set_intfdata, let v4l2_device_register handle this
v4l2_device_register already sets intfdata, no need to do this again.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:58:57 -03:00
Hans Verkuil fa0290eaee V4L/DVB: usbvision: remove non-working vbi device
The usbvision driver created vbi device nodes but the actual implementation
was just stubs and only returned errors to userspace.

In addition it used video_usercopy() and we want to remove that eventually.

So remove all the vbi code except for the vbi flag in the card definition
should someone ever be mad enough to work on a proper implementation for this
driver.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:57:07 -03:00
Julia Lawall 3557aa4f7d V4L/DVB (13954): Correct NULL test
Test the just-allocated value for NULL rather than some other value.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
identifier f;
@@

f(...) { <+... return NULL; ...+> }

@@
expression *x;
expression y;
identifier r.f;
statement S;
@@

x = f(...);
(
if ((x) == NULL) S
|
if (
-   y
+   x
       == NULL)
 S
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:33 -03:00
Laurent Pinchart 46b21094ce V4L/DVB (13556): v4l: Remove unneeded video_device::minor assignments
Now that the video_device registration is tested using
video_is_registered(), drivers don't need to initialize the
video_device::minor field to -1 anymore.

Remove those unneeded assignments.

[mchehab.redhat.com: removed tm6000 changes as tm6000 is not ready yet for submission even on staging]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16 00:17:57 -02:00
Laurent Pinchart f0813b4c9f V4L/DVB (13553): v4l: Use the video_is_registered function in device drivers
Fix all device drivers to use the video_is_registered function 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:56 -02:00
Laurent Pinchart 38c7c03603 V4L/DVB (13550): v4l: Use the new video_device_node_name function
Fix all device drivers to use the new video_device_node_name function.

This also strips kernel log messages from the "/dev/" prefix, has the device
node location is a userspace policy decision unknown to the kernel.

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
Roel Kluin f14a2972e4 V4L/DVB (13241): Cleanup redundant tests on unsigned
The variables are unsigned so the test `>= 0' is always true,
the `< 0' test always fails. In these cases the other part of
the test catches wrapped values.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:04 -02:00
Alexey Dobriyan 2bcd57ab61 headers: utsname.h redux
* remove asm/atomic.h inclusion from linux/utsname.h --
   not needed after kref conversion
 * remove linux/utsname.h inclusion from files which do not need it

NOTE: it looks like fs/binfmt_elf.c do not need utsname.h, however
due to some personality stuff it _is_ needed -- cowardly leave ELF-related
headers and files alone.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-23 18:13:10 -07: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
Jean Delvare e36bc31f82 V4L/DVB (11992): Add missing __devexit_p()
Add missing __devexit_p() to several drivers. Also add a few missing
__init, __devinit and __exit markers. These errors could result in
build failures depending on the kernel configuration.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 19:07:51 -03:00
Roel Kluin 223ffe5f82 V4L/DVB: cleanup redundant tests on unsigned
Remove redundant tests on unsigned.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:58 -03:00
Hans Verkuil 3ff4ad815c V4L/DVB (11377): v4l: increase version numbers of drivers converted to v4l2_subdev.
With all the v4l2_subdev changes that were made to these drivers it is a
good idea to increase the version number of each driver.

It's just the patch level that is increased, except for the zoran and saa7146
drivers where the minor number was increased due to the more substantial
changes that were made to those two drivers.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:26 -03:00
Hans Verkuil f41737ece4 V4L/DVB (11370): v4l2-subdev: move s_std from tuner to core.
s_std didn't belong in the tuner ops. Stricly speaking it should be part of
the video ops, but it is used by audio and tuner devices as well, so it is
more efficient to make it part of the core ops.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:22 -03:00
Janne Grunau a878440d99 V4L/DVB (11354): usbvision: use usb_interface.dev for v4l2_device_register
Signed-off-by: Janne Grunau <j@jannau.net>
Acked-by: Thierry Merle <thierry.merle@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:13 -03:00
Trent Piepho 975f5766be V4L/DVB (11271): usbvision: Remove buffer type checks from enum_fmt_vid_cap, XXXbuf
The v4l2-ioctl core only allows buffer types for which the corresponding
->vidioc_try_fmt_xxx() methods are defined to be used with
vidioc_(q|dq|query)buf() and vidioc_reqbufs().

Since this driver only defines ->vidioc_try_fmt_vid_cap() the checks can be
removed from vidioc_reqbufs(), vidioc_qbuf(), and vidioc_dqbuf().

The ->vidioc_(s|g|try|enum)_fmt_vid_cap() methods are only called on
VIDEO_CAPTURE buffers.  Thus, there is no need to check or set the buffer's
'type' field since it must already be set to VIDEO_CAPTURE.  So setting the
buffer type in vidioc_enum_fmt_vid_cap() can be removed.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:46 -03:00
Hans Verkuil f1ba28c3a6 V4L/DVB (11045): v4l2: call v4l2_device_disconnect in USB drivers.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:23 -03:00
Trent Piepho 3836725518 V4L/DVB (10818): usbvision: Don't need to zero ioctl parameter fields
The v4l2 core code in v4l2_ioctl will zero out the structure the driver is
supposed to fill in for read-only ioctls.  For read/write ioctls, all the
fields which aren't supplied from userspace will be zeroed out.

Zeroing code is removed from g_audio, queryctrl, and enum_fmt_vid_cap.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:06 -03:00
Trent Piepho 9cfb6a3f1b V4L/DVB (10794): v4l2: Move code to zero querybuf output struct to v4l2_ioctl
For VIDIOC_QUERYBUF only the first two fields, size and type, are used as
input.  The rest can be filled in by the driver as output.  Most drivers do
not actually use all the field and unused ones should be zeroed out.  Some
drivers have code to do this and some drivers should but don't.  So put
some zero out code in v4l2_ioctl so that all drivers using that system get
it.

The drivers that have zeroing code get that code removed.

Some drivers checked that the type field was valid, but v4l2_ioctl already
does this so those checks can be removed as well.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:04 -03:00
Mauro Carvalho Chehab 770060385a V4L/DVB (10738): Get rid of video_decoder.h header were uneeded
Now, just a few modules are still dependent of this legacy header:

$ grep -l DECODER_ `find linux/drivers/media/ -name '*.[ch]' -exec grep -l video_decoder '{}' \;`
linux/drivers/media/video/v4l2-ioctl.c
linux/drivers/media/video/indycam.c
linux/drivers/media/video/saa7191.c
linux/drivers/media/video/vino.c

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:59 -03:00
Hans Verkuil 1df795370c V4L/DVB (10692): usbvision: convert to v4l2_device/v4l2_subdev.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:54 -03:00
Thierry MERLE 6f2a278171 V4L/DVB (10306): usbvision: use usb_make_path to report bus info
usb_make_path reports canonical bus info. Use it when reporting bus info
in VIDIOC_QUERYCAP.

Signed-off-by: Thierry MERLE <thierry.merle@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:27 -03:00
Mauro Carvalho Chehab be9ed5117d V4L/DVB (10298): remove err macro from few usb devices
Patch removes err() macros from few usb devices.
It places pr_err in pvrusb2-v4l2.c, dev_err in dabusb and in usbvision
drivers. Beside placing dev_err, patch defines new s2255_dev_err macro
with S2255_DRIVER_NAME in s2255 module.

Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Acked-by: Thierry Merle <thierry.merle@free.fr>
Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:26 -03:00
Julia Lawall 2230c3c803 V4L/DVB (10185): Use negated usb_endpoint_xfer_control, etc
This patch extends 134179823b by using
usb_endpoint_xfer_control, usb_endpoint_xfer_isoc, usb_endpoint_xfer_bulk,
and usb_endpoint_xfer_int in the negated case as well.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@ struct usb_endpoint_descriptor *epd; @@

- (usb_endpoint_type(epd) != \(USB_ENDPOINT_XFER_CONTROL\|0\))
+ !usb_endpoint_xfer_control(epd)

@@ struct usb_endpoint_descriptor *epd; @@

- (usb_endpoint_type(epd) != \(USB_ENDPOINT_XFER_ISOC\|1\))
+ !usb_endpoint_xfer_isoc(epd)

@@ struct usb_endpoint_descriptor *epd; @@

- (usb_endpoint_type(epd) != \(USB_ENDPOINT_XFER_BULK\|2\))
+ !usb_endpoint_xfer_bulk(epd)

@@ struct usb_endpoint_descriptor *epd; @@

- (usb_endpoint_type(epd) != \(USB_ENDPOINT_XFER_INT\|3\))
+ !usb_endpoint_xfer_int(epd)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-07 22:18:56 -02:00
Hans Verkuil aecde8b53b V4L/DVB (10141): v4l2: debugging API changed to match against driver name instead of ID.
Since the i2c driver ID will be removed in the near future we have to
modify the v4l2 debugging API to use the driver name instead of driver ID.

Note that this API is not used in applications other than v4l2-dbg.cpp
as it is for debugging and testing only.

Should anyone use the old VIDIOC_G_CHIP_IDENT, then this will be logged
with a warning that it is deprecated and will be removed in 2.6.30.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:52 -02:00
Hans Verkuil 069b747931 V4L/DVB (10138): v4l2-ioctl: change to long return type to match unlocked_ioctl.
Since internal to v4l2 the ioctl prototype is the same regardless of it
being called through .ioctl or .unlocked_ioctl, we need to convert it all
to the long return type of unlocked_ioctl.

Thanks to Jean-Francois Moine for posting an initial patch for this and
thus bringing it to our attention.

Cc: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:34 -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
Julia Lawall 134179823b V4L/DVB (10130): use USB API functions rather than constants
This set of patches introduces calls to the following set of functions:

usb_endpoint_dir_in(epd)
usb_endpoint_dir_out(epd)
usb_endpoint_is_bulk_in(epd)
usb_endpoint_is_bulk_out(epd)
usb_endpoint_is_int_in(epd)
usb_endpoint_is_int_out(epd)
usb_endpoint_is_isoc_in(epd)
usb_endpoint_is_isoc_out(epd)
usb_endpoint_num(epd)
usb_endpoint_type(epd)
usb_endpoint_xfer_bulk(epd)
usb_endpoint_xfer_control(epd)
usb_endpoint_xfer_int(epd)
usb_endpoint_xfer_isoc(epd)

In some cases, introducing one of these functions is not possible, and it
just replaces an explicit integer value by one of the following constants:

USB_ENDPOINT_XFER_BULK
USB_ENDPOINT_XFER_CONTROL
USB_ENDPOINT_XFER_INT
USB_ENDPOINT_XFER_ISOC

An extract of the semantic patch that makes these changes is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r1@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) ==
- \(USB_ENDPOINT_XFER_CONTROL\|0\))
+ usb_endpoint_xfer_control(epd)

@r5@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
-  \(USB_DIR_IN\|0x80\))
+ usb_endpoint_dir_in(epd)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:40:40 -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
Hans Verkuil f473bf76c7 V4L/DVB (9503): v4l: remove inode argument from video_usercopy
The inode argument was never used. Removing it from video_usercopy
brings the function pointer type of video_usercopy in line with similar
v4l2 functions, thus simplifying several drivers.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29 17:53:26 -02:00
Hans Verkuil c6330fb86f V4L/DVB (9327): v4l: use video_device.num instead of minor in video%d
The kernel number of a v4l2 node (e.g. videoX, radioX or vbiX) is now
independent of the minor number. So instead of using the minor field
of the video_device struct one has to use the num field: this always
contains the kernel number of the device node.

I forgot about this when I did the v4l2 core change, so this patch
converts all drivers that use it in one go. Luckily the change is
trivial.

Cc: michael@mihu.de
Cc: mchehab@infradead.org
Cc: corbet@lwn.net
Cc: luca.risolia@studio.unibo.it
Cc: isely@pobox.com
Cc: pe1rxq@amsat.org
Cc: royale@zerezo.com
Cc: mkrufky@linuxtv.org
Cc: stoth@linuxtv.org
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-21 14:31:37 -02:00
Johannes Berg a65e5d782f remove CONFIG_KMOD from drivers
Straight forward conversions to CONFIG_MODULE; many drivers
include <linux/kmod.h> conditionally and then don't have any
other conditional code so remove it from those.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: video4linux-list@redhat.com
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-ppp@vger.kernel.org
Cc: dm-devel@redhat.com
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2008-10-17 02:38:35 +11:00
Greg Kroah-Hartman a482f327ff V4L/DVB (9116): USB: remove info() macro from usb media drivers
USB should not be having it's own printk macros, so remove info() and
use the system-wide standard of dev_info() wherever possible.

Cc: Douglas Landgraf <dougsland@gmail.com>
Cc: Mike Isely <isely@pobox.com>
Cc: Thierry Merle <thierry.merle@free.fr>
Cc: Antoine Jacquet <royale@zerezo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:37:14 -02:00
Hans Verkuil c170ecf434 V4L/DVB (8788): v4l: replace video_get_drvdata(video_devdata(filp)) with video_drvdata(filp)
Use the new video_drvdata(filp) function where it is safe to do so.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:36:54 -02:00
Hans Verkuil d56dc61265 V4L/DVB (8613): v4l: move BKL down to the driver level.
The BKL is now moved from the video_open function in v4l2-dev.c to the
various drivers. It seems about a third of the drivers already has a
lock of some sort protecting the open(), another third uses
video_exclusive_open (yuck!) and the last third required adding the
BKL in their open function.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:36:47 -02:00
Hans Verkuil 0ea6bc8d43 V4L/DVB (8523): v4l2-dev: remove unused type and type2 field from video_device
The type and type2 fields were unused and so could be removed.
Instead add a vfl_type field that contains the type of the video
device.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-27 11:07:10 -03:00