Commit Graph

20 Commits (dcd6c92267155e70a94b3927bce681ce74b80d1f)

Author SHA1 Message Date
Mauro Carvalho Chehab 083774d8b1 [media] pvrusb2: Use LINUX_VERSION_CODE for VIDIOC_QUERYCAP
pvrusb2 doesn't use vidioc_ioctl2. As the API is changing to use
a common version for all drivers, we need to expliticly fix this
driver.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-07-27 17:53:15 -03:00
Mike Isely e3a5ee73e7 V4L/DVB: pvrusb2: Fix kernel oops on device tear-down
pvrusb2: Delete sysfs class device as the _very_ last step, after
we're sure that all driver contexts have gone away first.  This is
important because it appears that there isn't any protection from a
struct device instance reference a deleted struct class instance.  The
assumption in the kernel code appears to be that the class instance is
assumed to be around for the life of the device.  So we can't let the
class instance go away until all referencing device instances are
gone; this is ensured by delaying removal of the class instance until
after the driver contexts have all gone away.  This bug has been
present for a very long time but it didn't apparently become malignant
until recently (probably because of other changes in the kernel).

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-06-01 01:19:58 -03:00
Tejun Heo 5a0e3ad6af 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: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Mike Isely 94b5ff9cf3 V4L/DVB (10259): pvrusb2: Code module name directly in printk
The name of the pvrusb2 module is not likely to ever change, and there
are plenty of other places where the name is directly coded, so there
is little utility in using a macro to infer the module name here.  In
addition, using that macro complicates other uses of the driver
involving older kernels where this macro works differently.  Yes I
know for many places we don't have to worry about that.  But my
alternative is that I have to build special logic in the pvrusb2
standalone driver to special-case what is otherwise costmetic and that
is just plain nuts for something as trivial as this, especially since
this change does not at all have any compile time or run time impact
on the driver.  I'm just removing a nicety that didn't have a lot of
value here to begin with.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:23 -03: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
Mike Isely 64723b3018 V4L/DVB (7936): pvrusb2: Remove svn Id keyword from all sources
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:06:52 -03:00
Mike Isely e5be15c638 V4L/DVB (7711): pvrusb2: Fix race on module unload
The pvrusb2 driver - for basically forever - was not enforcing a
proper module tear-down.  Kernel threads are used inside the driver
and all must be gone before the module can be safely removed.  This
changeset reimplements a chunk of pvrusb2-context.c to enforce this
correctly.  Unfortunately this is not a simple fix.  The new
implementation also cuts back on kernel thread usage; instead of there
being 1 control thread per instance now it's just 1 control thread
shared by all instances.  (By dropping to a single thread then the
module exit function can block on its shutdown and the thread itself
can monitor and cleanly shut down all of the other instances first.)

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:48 -03:00
Mike Isely c5317b17f6 V4L/DVB (7692): pvrusb2-dvb: Further clean up dvb init/tear-down
Move pvr2_dvb_adapter usage out of the pvrusb2 driver core - it's
really private to the pvrusb2-dvb module and nothing outside of the
dvb implementation should care about it.  Creation / destruction of
the pvr2_dvb_adapter instance is now contained entirely within
pvrusb2-dvb.c.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:47 -03:00
Mike Isely 891d99efc5 V4L/DVB (7689): pvrusb2-dvb: Rework module tear-down
Rather than making an explicit call to tear down the pvrusb2-dvb
module, use the callback in the pvr2_channel structure.  This has the
advantage that now tear-down only happens when it makes sense.  The
previous implementation had scenarios where it was possible for the
tear-down call to happen without a prior initialization.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:46 -03:00
Michael Krufky 04910bdc5c V4L/DVB (7679): pvrusb2: add DVB API framework
Add basic framework for the DVB API.  This is enough to control the
tuner & demod of the digital frontend, but the stream & buffer handling
is still missing.

Additional note from Mike Isely <isely@pobox.com> - also, since these
changes are still very experimental arrange for DVB changes to be
compiled in via new CONFIG_VIDEO_PVRUSB2_DVB option, for now.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:46 -03:00
Mike Isely 066bba2d1c V4L/DVB (6772): pvrusb2: Remove obsolete (and misleading) comment
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:03:26 -02:00
Mike Isely 989eb154ea V4L/DVB (6692): pvrusb2: Centralize device specific attributes into a single place
The pvrusb2 driver currently supports two variants of the Hauppauge
PVR USB2.  However there are other hardware types potentially
supportable, but the driver at the moment is not structured to make it
easy to describe these minor variations.  This changeset is the first
set of changes to make such additional device support possible.
Device attributes are held in several tables all contained within
pvrusb2-devattr.c; all other device-specific driver behavior now
derives from these tables.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:03:02 -02:00
Mike Isely 4f663bdc65 V4L/DVB (6548): pvrusb2: Fix oops on module removal
The pvrusb2 driver is tearing down its sysfs related pieces in the
incorrect order.  This leaves dangling pointers which causes the
kernel device core to oops.  The problem has been present virtually
forever but became malignant with the changeover to the way of
handling /sys/class.  Fix is just to make sure we don't tear down the
class structure until AFTER the driver instances are deregistered.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-11-04 21:41:30 -02:00
Mike Isely 56585386e2 V4L/DVB (6211): pvrusb2: Allocate a debug mask bit for reporting video standard things
It's useful to see specific details for how the pvrusb2 driver is
figuring out things related to the video standard, independent of
other initialization activities.  So let's set up a separate debug
mask bit for this and turn it on.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09 22:14:34 -03:00
Mauro Carvalho Chehab 9c12224a60 V4L/DVB (6079): Cleanup: remove linux/moduleparam.h from drivers/media files
Since at least kernel 2.6.12-rc2, module.h includes moduleparm.h. This
patch removes all occurences of moduleparm.h from drivers/media files.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09 22:06:17 -03:00
Randy Dunlap e63340ae6b header cleaning: don't include smp_lock.h when not used
Remove includes of <linux/smp_lock.h> where it is not used/needed.
Suggested by Al Viro.

Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc,
sparc64, and arm (all 59 defconfigs).

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:07 -07:00
Mauro Carvalho Chehab b59b36db9e V4L/DVB (4339): Removed the remaining config.h stuff
Since kernel include autoconf.h via command line, those config.h inclusion
can be removed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-09-26 09:03:16 -03:00
Mike Isely a0fd1cb171 V4L/DVB (4288): Clean out a zillion sparse warnings in pvrusb2
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-06-30 15:59:50 -03:00
Mike Isely 0885ba1d5e V4L/DVB (4245): Reduce the amount of pvrusb2-sourced noise going into the system log
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-06-27 00:17:33 -03:00
Mike Isely d855497edb V4L/DVB (4228a): pvrusb2 to kernel 2.6.18
Implement V4L2 driver for the Hauppauge PVR USB2 TV tuner.

The Hauppauge PVR USB2 is a USB connected TV tuner with an embedded
cx23416 hardware MPEG2 encoder.  There are two major variants of this
device; this driver handles both.  Any V4L2 application which
understands MPEG2 video stream data should be able to work with this
device.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-06-27 00:17:15 -03:00