]> Git Repo - linux.git/commitdiff
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
authorLinus Torvalds <[email protected]>
Thu, 24 Mar 2011 16:50:13 +0000 (09:50 -0700)
committerLinus Torvalds <[email protected]>
Thu, 24 Mar 2011 16:50:13 +0000 (09:50 -0700)
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (442 commits)
  [media] videobuf2-dma-contig: make cookie() return a pointer to dma_addr_t
  [media] sh_mobile_ceu_camera: Do not call vb2's mem_ops directly
  [media] V4L: soc-camera: explicitly require V4L2_BUF_TYPE_VIDEO_CAPTURE
  [media] v4l: soc-camera: Store negotiated buffer settings
  [media] rc: interim support for 32-bit NEC-ish scancodes
  [media] mceusb: topseed 0x0011 needs gen3 init for tx to work
  [media] lirc_zilog: error out if buffer read bytes != chunk size
  [media] lirc: silence some compile warnings
  [media] hdpvr: use same polling interval as other OS
  [media] ir-kbd-i2c: pass device code w/key in hauppauge case
  [media] rc/keymaps: Remove the obsolete rc-rc5-tv keymap
  [media] remove the old RC_MAP_HAUPPAUGE_NEW RC map
  [media] rc/keymaps: Rename Hauppauge table as rc-hauppauge
  [media] rc-rc5-hauppauge-new: Fix Hauppauge Grey mapping
  [media] rc-rc5-hauppauge-new: Add support for the old Black RC
  [media] rc-rc5-hauppauge-new: Add the old control to the table
  [media] rc-winfast: Fix the keycode tables
  [media] a800: Fix a few wrong IR key assignments
  [media] opera1: Use multimedia keys instead of an app-specific mapping
  [media] dw2102: Use multimedia keys instead of an app-specific mapping
  ...

Fix up trivial conflicts (remove/modify and some real conflicts) in:
arch/arm/mach-omap2/devices.c
drivers/staging/Kconfig
drivers/staging/Makefile
drivers/staging/dabusb/dabusb.c
drivers/staging/dabusb/dabusb.h
drivers/staging/easycap/easycap_ioctl.c
drivers/staging/usbvideo/usbvideo.c
drivers/staging/usbvideo/vicam.c

14 files changed:
1  2 
Documentation/feature-removal-schedule.txt
Documentation/ioctl/ioctl-number.txt
MAINTAINERS
arch/arm/mach-omap2/devices.c
drivers/media/dvb/dvb-usb/dvb-usb-remote.c
drivers/media/radio/radio-wl1273.c
drivers/mfd/Kconfig
drivers/mfd/wl1273-core.c
drivers/staging/Kconfig
drivers/staging/Makefile
drivers/staging/easycap/easycap_ioctl.c
drivers/video/matrox/matroxfb_base.c
sound/soc/codecs/Kconfig
sound/soc/codecs/wl1273.c

index 75c37e4c3d7557c6187dc3a49de4c31bdc355286,61fb823e5a9581f2db62ea23c27a5730957037e2..274b32d12532a2e0e3814e70940b39721dde864a
@@@ -35,17 -35,6 +35,17 @@@ Who:        Luis R. Rodriguez <lrodriguez@athe
  
  ---------------------------
  
 +What: AR9170USB
 +When: 2.6.40
 +
 +Why:  This driver is deprecated and the firmware is no longer
 +      maintained. The replacement driver "carl9170" has been
 +      around for a while, so the devices are still supported.
 +
 +Who:  Christian Lamparter <[email protected]>
 +
 +---------------------------
 +
  What: IRQF_SAMPLE_RANDOM
  Check:        IRQF_SAMPLE_RANDOM
  When: July 2009
@@@ -108,42 -97,6 +108,6 @@@ Who:       Pavel Machek <[email protected]
  
  ---------------------------
  
- What: Video4Linux obsolete drivers using V4L1 API
- When: kernel 2.6.39
- Files:        drivers/staging/se401/* drivers/staging/usbvideo/*
- Check:        drivers/staging/se401/se401.c drivers/staging/usbvideo/usbvideo.c
- Why:  There are some drivers still using V4L1 API, despite all efforts we've done
-       to migrate. Those drivers are for obsolete hardware that the old maintainer
-       didn't care (or not have the hardware anymore), and that no other developer
-       could find any hardware to buy. They probably have no practical usage today,
-       and people with such old hardware could probably keep using an older version
-       of the kernel. Those drivers will be moved to staging on 2.6.38 and, if nobody
-       cares enough to port and test them with V4L2 API, they'll be removed on 2.6.39.
- Who:  Mauro Carvalho Chehab <[email protected]>
- ---------------------------
- What: Video4Linux: Remove obsolete ioctl's
- When: kernel 2.6.39
- Files:        include/media/videodev2.h
- Why:  Some ioctl's were defined wrong on 2.6.2 and 2.6.6, using the wrong
-       type of R/W arguments. They were fixed, but the old ioctl names are
-       still there, maintained to avoid breaking binary compatibility:
-         #define VIDIOC_OVERLAY_OLD    _IOWR('V', 14, int)
-         #define VIDIOC_S_PARM_OLD     _IOW('V', 22, struct v4l2_streamparm)
-         #define VIDIOC_S_CTRL_OLD     _IOW('V', 28, struct v4l2_control)
-         #define VIDIOC_G_AUDIO_OLD    _IOWR('V', 33, struct v4l2_audio)
-         #define VIDIOC_G_AUDOUT_OLD   _IOWR('V', 49, struct v4l2_audioout)
-         #define VIDIOC_CROPCAP_OLD    _IOR('V', 58, struct v4l2_cropcap)
-       There's no sense on preserving those forever, as it is very doubtful
-       that someone would try to use a such old binary with a modern kernel.
-       Removing them will allow us to remove some magic done at the V4L ioctl
-       handler.
- Who:  Mauro Carvalho Chehab <[email protected]>
- ---------------------------
  What: sys_sysctl
  When: September 2010
  Option: CONFIG_SYSCTL_SYSCALL
@@@ -270,6 -223,14 +234,6 @@@ Who:      Zhang Rui <[email protected]
  
  ---------------------------
  
 -What: /proc/acpi/button
 -When: August 2007
 -Why:  /proc/acpi/button has been replaced by events to the input layer
 -      since 2.6.20.
 -Who:  Len Brown <[email protected]>
 -
 ----------------------------
 -
  What: /proc/acpi/event
  When: February 2008
  Why:  /proc/acpi/event has been replaced by events via the input layer
@@@ -577,6 -538,16 +541,6 @@@ Who:    NeilBrown <[email protected]
  
  ----------------------------
  
 -What: i2c_adapter.id
 -When: June 2011
 -Why:  This field is deprecated. I2C device drivers shouldn't change their
 -      behavior based on the underlying I2C adapter. Instead, the I2C
 -      adapter driver should instantiate the I2C devices and provide the
 -      needed platform-specific information.
 -Who:  Jean Delvare <[email protected]>
 -
 -----------------------------
 -
  What: cancel_rearming_delayed_work[queue]()
  When: 2.6.39
  
@@@ -597,13 -568,6 +561,13 @@@ Who:     Jean Delvare <[email protected]
  
  ----------------------------
  
 +What: xt_connlimit rev 0
 +When: 2012
 +Who:  Jan Engelhardt <[email protected]>
 +Files:        net/netfilter/xt_connlimit.c
 +
 +----------------------------
 +
  What: noswapaccount kernel command line parameter
  When: 2.6.40
  Why:  The original implementation of memsw feature enabled by
  Who:  Michal Hocko <[email protected]>
  
  ----------------------------
 +
 +What: ipt_addrtype match include file
 +When: 2012
 +Why:  superseded by xt_addrtype
 +Who:  Florian Westphal <[email protected]>
 +Files:        include/linux/netfilter_ipv4/ipt_addrtype.h
 +
 +----------------------------
 +
 +What: i2c_driver.attach_adapter
 +      i2c_driver.detach_adapter
 +When: September 2011
 +Why:  These legacy callbacks should no longer be used as i2c-core offers
 +      a variety of preferable alternative ways to instantiate I2C devices.
 +Who:  Jean Delvare <[email protected]>
 +
 +----------------------------
index e68543f767d50d33bd0f11740e929bb28651262b,2b8c0592b519a6f1d82ccebedf3f0c02499933c9..a0a5d82b6b0b86c94415284ea7d29387bbaaf7c7
@@@ -133,7 -133,6 +133,7 @@@ Code  Seq#(hex)    Include File            Comment
  'H'   C0-DF   net/bluetooth/hidp/hidp.h       conflict!
  'H'   C0-DF   net/bluetooth/cmtp/cmtp.h       conflict!
  'H'   C0-DF   net/bluetooth/bnep/bnep.h       conflict!
 +'H'   F1      linux/hid-roccat.h      <mailto:[email protected]>
  'I'   all     linux/isdn.h            conflict!
  'I'   00-0F   drivers/isdn/divert/isdn_divert.h       conflict!
  'I'   40-4F   linux/mISDNif.h         conflict!
  'z'   40-7F                           CAN bus card    conflict!
                                        <mailto:[email protected]>
  'z'   10-4F   drivers/s390/crypto/zcrypt_api.h        conflict!
+ '|'   00-7F   linux/media.h
  0x80  00-1F   linux/fb.h
  0x89  00-06   arch/x86/include/asm/sockios.h
  0x89  0B-DF   linux/sockios.h
diff --combined MAINTAINERS
index 2f122abecd4fab48959528b94437cdbc8ee1c4c0,1034f4a67347b3945a4fab3412c10c41185e577f..749f9cd38089c7df22ebdff2eadbd137bc409348
@@@ -72,7 -72,7 +72,7 @@@ Descriptions of section entries
        L: Mailing list that is relevant to this area
        W: Web-page with status/info
        Q: Patchwork web based patch tracking system site
 -      T: SCM tree type and location.  Type is one of: git, hg, quilt, stgit.
 +      T: SCM tree type and location.  Type is one of: git, hg, quilt, stgit, topgit.
        S: Status, one of the following:
           Supported:   Someone is actually paid to look after this.
           Maintained:  Someone actually looks after it.
@@@ -198,7 -198,7 +198,7 @@@ F: Documentation/scsi/aacraid.tx
  F:    drivers/scsi/aacraid/
  
  ABIT UGURU 1,2 HARDWARE MONITOR DRIVER
 -M:    Hans de Goede <[email protected]>
 +M:    Hans de Goede <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/hwmon/abituguru.c
@@@ -288,35 -288,35 +288,35 @@@ F:      sound/pci/ad1889.
  AD525X ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER
  M:    Michael Hennerich <[email protected]>
  L:    [email protected]
 -W:    http://wiki-analog.com/AD5254
 +W:    http://wiki.analog.com/AD5254
  S:    Supported
  F:    drivers/misc/ad525x_dpot.c
  
  AD5398 CURRENT REGULATOR DRIVER (AD5398/AD5821)
  M:    Michael Hennerich <[email protected]>
  L:    [email protected]
 -W:    http://wiki-analog.com/AD5398
 +W:    http://wiki.analog.com/AD5398
  S:    Supported
  F:    drivers/regulator/ad5398.c
  
  AD714X CAPACITANCE TOUCH SENSOR DRIVER (AD7142/3/7/8/7A)
  M:    Michael Hennerich <[email protected]>
  L:    [email protected]
 -W:    http://wiki-analog.com/AD7142
 +W:    http://wiki.analog.com/AD7142
  S:    Supported
  F:    drivers/input/misc/ad714x.c
  
  AD7877 TOUCHSCREEN DRIVER
  M:    Michael Hennerich <[email protected]>
  L:    [email protected]
 -W:    http://wiki-analog.com/AD7877
 +W:    http://wiki.analog.com/AD7877
  S:    Supported
  F:    drivers/input/touchscreen/ad7877.c
  
  AD7879 TOUCHSCREEN DRIVER (AD7879/AD7889)
  M:    Michael Hennerich <[email protected]>
  L:    [email protected]
 -W:    http://wiki-analog.com/AD7879
 +W:    http://wiki.analog.com/AD7879
  S:    Supported
  F:    drivers/input/touchscreen/ad7879.c
  
@@@ -342,18 -342,18 +342,18 @@@ F:      drivers/net/wireless/adm8211.
  ADP5520 BACKLIGHT DRIVER WITH IO EXPANDER (ADP5520/ADP5501)
  M:    Michael Hennerich <[email protected]>
  L:    [email protected]
 -W:    http://wiki-analog.com/ADP5520
 +W:    http://wiki.analog.com/ADP5520
  S:    Supported
  F:    drivers/mfd/adp5520.c
  F:    drivers/video/backlight/adp5520_bl.c
 -F:    drivers/led/leds-adp5520.c
 +F:    drivers/leds/leds-adp5520.c
  F:    drivers/gpio/adp5520-gpio.c
  F:    drivers/input/keyboard/adp5520-keys.c
  
  ADP5588 QWERTY KEYPAD AND IO EXPANDER DRIVER (ADP5588/ADP5587)
  M:    Michael Hennerich <[email protected]>
  L:    [email protected]
 -W:    http://wiki-analog.com/ADP5588
 +W:    http://wiki.analog.com/ADP5588
  S:    Supported
  F:    drivers/input/keyboard/adp5588-keys.c
  F:    drivers/gpio/adp5588-gpio.c
  ADP8860 BACKLIGHT DRIVER (ADP8860/ADP8861/ADP8863)
  M:    Michael Hennerich <[email protected]>
  L:    [email protected]
 -W:    http://wiki-analog.com/ADP8860
 +W:    http://wiki.analog.com/ADP8860
  S:    Supported
  F:    drivers/video/backlight/adp8860_bl.c
  
 +ADS1015 HARDWARE MONITOR DRIVER
 +M:    Dirk Eibach <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/hwmon/ads1015
 +F:    drivers/hwmon/ads1015.c
 +F:    include/linux/i2c/ads1015.h
 +
  ADT746X FAN DRIVER
  M:    Colin Leroy <[email protected]>
  S:    Maintained
@@@ -388,7 -380,7 +388,7 @@@ F: drivers/hwmon/adt7475.
  ADXL34X THREE-AXIS DIGITAL ACCELEROMETER DRIVER (ADXL345/ADXL346)
  M:    Michael Hennerich <[email protected]>
  L:    [email protected]
 -W:    http://wiki-analog.com/ADXL345
 +W:    http://wiki.analog.com/ADXL345
  S:    Supported
  F:    drivers/input/misc/adxl34x.c
  
@@@ -473,16 -465,6 +473,16 @@@ M:       Matt Turner <[email protected]
  L:    [email protected]
  F:    arch/alpha/
  
 +ALTERA UART/JTAG UART SERIAL DRIVERS
 +M:    Tobias Klauser <[email protected]>
 +L:    [email protected]
 +L:    [email protected] (moderated for non-subscribers)
 +S:    Maintained
 +F:    drivers/tty/serial/altera_uart.c
 +F:    drivers/tty/serial/altera_jtaguart.c
 +F:    include/linux/altera_uart.h
 +F:    include/linux/altera_jtaguart.h
 +
  AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER
  M:    Thomas Dahlmann <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
@@@ -528,9 -510,11 +528,9 @@@ F:        drivers/infiniband/hw/amso1100
  ANALOG DEVICES INC ASOC CODEC DRIVERS
  L:    [email protected]
  L:    [email protected] (moderated for non-subscribers)
 -W:    http://wiki-analog.com/
 +W:    http://wiki.analog.com/
  S:    Supported
  F:    sound/soc/codecs/ad1*
 -F:    sound/soc/codecs/adau*
 -F:    sound/soc/codecs/adav*
  F:    sound/soc/codecs/ssm*
  
  ANALOG DEVICES INC ASOC DRIVERS
@@@ -573,13 -557,6 +573,13 @@@ S:       Maintaine
  F:    drivers/net/appletalk/
  F:    net/appletalk/
  
 +ARASAN COMPACT FLASH PATA CONTROLLER
 +M:    Viresh Kumar <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    include/linux/pata_arasan_cf_data.h
 +F:    drivers/ata/pata_arasan_cf.c
 +
  ARC FRAMEBUFFER DRIVER
  M:    Jaya Kumar <[email protected]>
  S:    Maintained
@@@ -695,8 -672,8 +695,8 @@@ S: Maintaine
  ARM/CLKDEV SUPPORT
  M:    Russell King <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
 -F:    arch/arm/common/clkdev.c
  F:    arch/arm/include/asm/clkdev.h
 +F:    drivers/clk/clkdev.c
  
  ARM/COMPULAB CM-X270/EM-X270 and CM-X300 MACHINE SUPPORT
  M:    Mike Rapoport <[email protected]>
@@@ -917,7 -894,6 +917,7 @@@ F: drivers/mmc/host/msm_sdcc.
  F:    drivers/mmc/host/msm_sdcc.h
  F:    drivers/tty/serial/msm_serial.h
  F:    drivers/tty/serial/msm_serial.c
 +F:    drivers/platform/msm/
  T:    git git://codeaurora.org/quic/kernel/davidb/linux-msm.git
  S:    Maintained
  
@@@ -1077,7 -1053,7 +1077,7 @@@ L:      [email protected]
  S:    Maintained
  
  ARM/TETON BGA MACHINE SUPPORT
 -M:    Mark F. Brown <[email protected]>
 +M:    "Mark F. Brown" <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  
@@@ -1238,7 -1214,7 +1238,7 @@@ ATHEROS AR9170 WIRELESS DRIVE
  M:    Christian Lamparter <[email protected]>
  L:    [email protected]
  W:    http://wireless.kernel.org/en/users/Drivers/ar9170
 -S:    Maintained
 +S:    Obsolete
  F:    drivers/net/wireless/ath/ar9170/
  
  CARL9170 LINUX COMMUNITY WIRELESS DRIVER
@@@ -1481,7 -1457,7 +1481,7 @@@ F:      drivers/mtd/devices/block2mtd.
  
  BLUETOOTH DRIVERS
  M:    Marcel Holtmann <[email protected]>
 -M:    Gustavo F. Padovan <[email protected]>
 +M:    "Gustavo F. Padovan" <[email protected]>
  L:    [email protected]
  W:    http://www.bluez.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-2.6.git
@@@ -1490,7 -1466,7 +1490,7 @@@ F:      drivers/bluetooth
  
  BLUETOOTH SUBSYSTEM
  M:    Marcel Holtmann <[email protected]>
 -M:    Gustavo F. Padovan <[email protected]>
 +M:    "Gustavo F. Padovan" <[email protected]>
  L:    [email protected]
  W:    http://www.bluez.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-2.6.git
@@@ -1734,7 -1710,6 +1734,7 @@@ S:      Maintaine
  F:    Documentation/zh_CN/
  
  CISCO VIC ETHERNET NIC DRIVER
 +M:    Christian Benvenuti <[email protected]>
  M:    Vasanthy Kolluri <[email protected]>
  M:    Roopa Prabhu <[email protected]>
  M:    David Wang <[email protected]>
@@@ -2137,12 -2112,6 +2137,12 @@@ F:    Documentation/serial/digiepca.tx
  F:    drivers/char/epca*
  F:    drivers/char/digi*
  
 +DIOLAN U2C-12 I2C DRIVER
 +M:    Guenter Roeck <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/i2c/busses/i2c-diolan-u2c.c
 +
  DIRECTORY NOTIFICATION (DNOTIFY)
  M:    Eric Paris <[email protected]>
  S:    Maintained
@@@ -2389,7 -2358,7 +2389,7 @@@ F:      include/linux/edac_mce.
  
  EDAC-I82975X
  M:    Ranganathan Desikan <[email protected]>
 -M:    "Arvind R." <arvind@jetztechnologies.com>
 +M:    "Arvind R." <arvino55@gmail.com>
  L:    [email protected] (moderated for non-subscribers)
  W:    bluesmoke.sourceforge.net
  S:    Maintained
@@@ -2480,7 -2449,8 +2480,7 @@@ F:      include/linux/cb710.
  ENE KB2426 (ENE0100/ENE020XX) INFRARED RECEIVER
  M:    Maxim Levitsky <[email protected]>
  S:    Maintained
 -F:    drivers/media/IR/ene_ir.c
 -F:    drivers/media/IR/ene_ir.h
 +F:    drivers/media/rc/ene_ir.*
  
  EPSON 1355 FRAMEBUFFER DRIVER
  M:    Christopher Hoover <[email protected]>
@@@ -2631,14 -2601,12 +2631,14 @@@ F:   drivers/net/wan/dlci.
  F:    drivers/net/wan/sdla.c
  
  FRAMEBUFFER LAYER
 +M:    Paul Mundt <[email protected]>
  L:    [email protected]
  W:    http://linux-fbdev.sourceforge.net/
  Q:    http://patchwork.kernel.org/project/linux-fbdev/list/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6.git
 -S:    Orphan
 +S:    Maintained
  F:    Documentation/fb/
 +F:    Documentation/devicetree/bindings/fb/
  F:    drivers/video/
  F:    include/video/
  F:    include/linux/fb.h
@@@ -2826,6 -2794,7 +2826,6 @@@ F:      include/linux/gigaset_dev.
  
  GPIO SUBSYSTEM
  M:    Grant Likely <[email protected]>
 -L:    [email protected]
  S:    Maintained
  T:    git git://git.secretlab.ca/git/linux-2.6.git
  F:    Documentation/gpio/gpio.txt
@@@ -2848,6 -2817,7 +2848,6 @@@ F:      drivers/platform/x86/hdaps.
  HWPOISON MEMORY FAILURE HANDLING
  M:    Andi Kleen <[email protected]>
  L:    [email protected]
 -L:    [email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6.git hwpoison
  S:    Maintained
  F:    mm/memory-failure.c
@@@ -2856,7 -2826,7 +2856,7 @@@ F:      mm/hwpoison-inject.
  HYPERVISOR VIRTUAL CONSOLE DRIVER
  L:    [email protected]
  S:    Odd Fixes
 -F:    drivers/char/hvc_*
 +F:    drivers/tty/hvc/
  
  iSCSI BOOT FIRMWARE TABLE (iBFT) DRIVER
  M:    Peter Jones <[email protected]>
@@@ -2948,7 -2918,7 +2948,7 @@@ F:      Documentation/blockdev/cpqarray.tx
  F:    drivers/block/cpqarray.*
  
  HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa)
 -M:    Stephen M. Cameron <[email protected]>
 +M:    "Stephen M. Cameron" <[email protected]>
  L:    [email protected]
  S:    Supported
  F:    Documentation/scsi/hpsa.txt
@@@ -3005,7 -2975,7 +3005,7 @@@ F:      kernel/hrtimer.
  F:    kernel/time/clockevents.c
  F:    kernel/time/tick*.*
  F:    kernel/time/timer_*.c
 -F     include/linux/clockevents.h
 +F:    include/linux/clockevents.h
  F:    include/linux/hrtimer.h
  
  HIGH-SPEED SCC DRIVER FOR AX.25
  S:    Supported
  F:    drivers/idle/i7300_idle.c
  
 -IEEE 1394 SUBSYSTEM
 -M:    Stefan Richter <[email protected]>
 -L:    [email protected]
 -W:    http://ieee1394.wiki.kernel.org/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git
 -S:    Obsolete
 -F:    Documentation/debugging-via-ohci1394.txt
 -F:    drivers/ieee1394/
 -
  IEEE 802.15.4 SUBSYSTEM
  M:    Dmitry Eremin-Solenikov <[email protected]>
  M:    Sergey Lapin <[email protected]>
@@@ -3462,7 -3441,7 +3462,7 @@@ M:      Jiri Kosina <[email protected]
  M:    David Sterba <[email protected]>
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/ipwireless_cs.git
 -F:    drivers/char/pcmcia/ipwireless/
 +F:    drivers/tty/ipwireless/
  
  IPX NETWORK LAYER
  M:    Arnaldo Carvalho de Melo <[email protected]>
@@@ -3475,7 -3454,6 +3475,7 @@@ F:      net/ipx
  IRDA SUBSYSTEM
  M:    Samuel Ortiz <[email protected]>
  L:    [email protected] (subscribers-only)
 +L:    [email protected]
  W:    http://irda.sourceforge.net/
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/irda-2.6.git
@@@ -3618,6 -3596,12 +3618,6 @@@ W:     http://lse.sourceforge.net/kdump
  S:    Maintained
  F:    Documentation/kdump/
  
 -KERNEL AUTOMOUNTER (AUTOFS)
 -M:    "H. Peter Anvin" <[email protected]>
 -L:    [email protected]
 -S:    Obsolete
 -F:    drivers/staging/autofs/
 -
  KERNEL AUTOMOUNTER v4 (AUTOFS4)
  M:    Ian Kent <[email protected]>
  L:    [email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/chrisw/lsm-2.6.git
  S:    Supported
  
 +LIS3LV02D ACCELEROMETER DRIVER
 +M:    Eric Piel <[email protected]>
 +S:    Maintained
 +F:    Documentation/misc-devices/lis3lv02d
 +F:    drivers/misc/lis3lv02d/
 +
  LLC (802.2)
  M:    Arnaldo Carvalho de Melo <[email protected]>
  S:    Maintained
@@@ -3926,6 -3904,12 +3926,6 @@@ F:     include/linux/llc.
  F:    include/net/llc*
  F:    net/llc/
  
 -LIS3LV02D ACCELEROMETER DRIVER
 -M:    Eric Piel <[email protected]>
 -S:    Maintained
 -F:    Documentation/hwmon/lis3lv02d
 -F:    drivers/hwmon/lis3lv02d.*
 -
  LM73 HARDWARE MONITOR DRIVER
  M:    Guillaume Ligneul <[email protected]>
  L:    [email protected]
@@@ -4221,7 -4205,7 +4221,7 @@@ F:      Documentation/serial/moxa-smarti
  F:    drivers/char/mxser.*
  
  MSI LAPTOP SUPPORT
 -M:    Lee, Chun-Yi <[email protected]>
 +M:    "Lee, Chun-Yi" <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/platform/x86/msi-laptop.c
@@@ -4514,21 -4498,11 +4514,21 @@@ S:   Maintaine
  F:    arch/arm/*omap*/*clock*
  
  OMAP POWER MANAGEMENT SUPPORT
 -M:    Kevin Hilman <khilman@deeprootsystems.com>
 +M:    Kevin Hilman <khilman@ti.com>
  L:    [email protected]
  S:    Maintained
  F:    arch/arm/*omap*/*pm*
  
 +OMAP POWERDOMAIN/CLOCKDOMAIN SOC ADAPTATION LAYER SUPPORT
 +M:    Rajendra Nayak <[email protected]>
 +M:    Paul Walmsley <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
 +F:    arch/arm/mach-omap2/powerdomain44xx.c
 +F:    arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
 +F:    arch/arm/mach-omap2/clockdomain44xx.c
 +
  OMAP AUDIO SUPPORT
  M:    Jarkko Nikula <[email protected]>
  L:    [email protected] (subscribers-only)
@@@ -4537,14 -4511,14 +4537,14 @@@ S:   Maintaine
  F:    sound/soc/omap/
  
  OMAP FRAMEBUFFER SUPPORT
 -M:    Tomi Valkeinen <tomi.valkeinen@nokia.com>
 +M:    Tomi Valkeinen <tomi.valkeinen@ti.com>
  L:    [email protected]
  L:    [email protected]
  S:    Maintained
  F:    drivers/video/omap/
  
  OMAP DISPLAY SUBSYSTEM and FRAMEBUFFER SUPPORT (DSS2)
 -M:    Tomi Valkeinen <tomi.valkeinen@nokia.com>
 +M:    Tomi Valkeinen <tomi.valkeinen@ti.com>
  L:    [email protected]
  L:    [email protected]
  S:    Maintained
  S:    Maintained
  F:    arch/arm/mach-omap2/omap_hwmod_44xx_data.c
  
+ OMAP IMAGE SIGNAL PROCESSOR (ISP)
+ M:    Laurent Pinchart <[email protected]>
+ L:    [email protected]
+ S:    Maintained
+ F:    drivers/media/video/omap3isp/*
  OMAP USB SUPPORT
  M:    Felipe Balbi <[email protected]>
  M:    David Brownell <[email protected]>
@@@ -4716,6 -4696,7 +4722,6 @@@ F:      drivers/i2c/busses/i2c-pasemi.
  
  PADATA PARALLEL EXECUTION MECHANISM
  M:    Steffen Klassert <[email protected]>
 -L:    [email protected]
  L:    [email protected]
  S:    Maintained
  F:    kernel/padata.c
@@@ -4865,6 -4846,7 +4871,6 @@@ F:      include/crypto/pcrypt.
  PER-CPU MEMORY ALLOCATOR
  M:    Tejun Heo <[email protected]>
  M:    Christoph Lameter <[email protected]>
 -L:    [email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu.git
  S:    Maintained
  F:    include/linux/percpu*.h
@@@ -4919,15 -4901,6 +4925,15 @@@ S:    Maintaine
  F:    drivers/block/pktcdvd.c
  F:    include/linux/pktcdvd.h
  
 +PKUNITY SOC DRIVERS
 +M:    Guan Xuetao <[email protected]>
 +W:    http://mprc.pku.edu.cn/~guanxuetao/linux
 +S:    Maintained
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/epip/linux-2.6-unicore32.git
 +F:    drivers/input/serio/i8042-unicore32io.h
 +F:    drivers/i2c/busses/i2c-puv3.c
 +F:    drivers/video/fb-puv3.c
 +
  PMC SIERRA MaxRAID DRIVER
  M:    Anil Ravindranath <[email protected]>
  L:    [email protected]
@@@ -5191,7 -5164,6 +5197,7 @@@ RALINK RT2X00 WIRELESS LAN DRIVE
  P:    rt2x00 project
  M:    Ivo van Doorn <[email protected]>
  M:    Gertjan van Wingerde <[email protected]>
 +M:    Helmut Schaa <[email protected]>
  L:    [email protected]
  L:    [email protected] (moderated for non-subscribers)
  W:    http://rt2x00.serialmonkey.com/
@@@ -5371,7 -5343,8 +5377,7 @@@ S:      Supporte
  F:    drivers/s390/crypto/
  
  S390 ZFCP DRIVER
 -M:    Christof Schmitt <[email protected]>
 -M:    Swen Schillig <[email protected]>
 +M:    Steffen Maier <[email protected]>
  M:    [email protected]
  L:    [email protected]
  W:    http://www.ibm.com/developerworks/linux/linux390/
@@@ -5410,12 -5383,6 +5416,12 @@@ L:    [email protected] (moderat
  S:    Supported
  F:    sound/soc/samsung
  
 +SERIAL DRIVERS
 +M:    Alan Cox <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/tty/serial
 +
  TIMEKEEPING, NTP
  M:    John Stultz <[email protected]>
  M:    Thomas Gleixner <[email protected]>
@@@ -5423,6 -5390,7 +5429,6 @@@ S:      Supporte
  F:    include/linux/clocksource.h
  F:    include/linux/time.h
  F:    include/linux/timex.h
 -F:    include/linux/timekeeping.h
  F:    kernel/time/clocksource.c
  F:    kernel/time/time*.c
  F:    kernel/time/ntp.c
@@@ -5510,7 -5478,7 +5516,7 @@@ SCx200 CPU SUPPOR
  M:    Jim Cromie <[email protected]>
  S:    Odd Fixes
  F:    Documentation/i2c/busses/scx200_acb
 -F:    arch/x86/kernel/scx200_32.c
 +F:    arch/x86/platform/scx200/
  F:    drivers/watchdog/scx200_wdt.c
  F:    drivers/i2c/busses/scx200*
  F:    drivers/mtd/maps/scx200_docflash.c
@@@ -5654,13 -5622,24 +5660,13 @@@ M:   Robin Holt <[email protected]
  S:    Maintained
  F:    drivers/misc/sgi-xp/
  
 -SHARP LH SUPPORT (LH7952X & LH7A40X)
 -M:    Marc Singer <[email protected]>
 -W:    http://projects.buici.com/arm
 -L:    [email protected] (moderated for non-subscribers)
 -S:    Maintained
 -F:    Documentation/arm/Sharp-LH/ADC-LH7-Touchscreen
 -F:    arch/arm/mach-lh7a40x/
 -F:    drivers/tty/serial/serial_lh7a40x.c
 -F:    drivers/usb/gadget/lh7a40*
 -F:    drivers/usb/host/ohci-lh7a40*
 -
  SIMPLE FIRMWARE INTERFACE (SFI)
  M:    Len Brown <[email protected]>
  L:    [email protected]
  W:    http://simplefirmware.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6.git
  S:    Supported
 -F:    arch/x86/kernel/*sfi*
 +F:    arch/x86/platform/sfi/
  F:    drivers/sfi/
  F:    include/linux/sfi*.h
  
@@@ -5682,8 -5661,7 +5688,8 @@@ F:      arch/arm/mach-s3c2410/bast-ide.
  F:    arch/arm/mach-s3c2410/bast-irq.c
  
  TI DAVINCI MACHINE SUPPORT
 -M:    Kevin Hilman <[email protected]>
 +M:    Sekhar Nori <[email protected]>
 +M:    Kevin Hilman <[email protected]>
  L:    [email protected] (subscribers-only)
  Q:    http://patchwork.kernel.org/project/linux-davinci/list/
  S:    Supported
@@@ -5758,13 -5736,6 +5764,13 @@@ S:    Supporte
  F:    Documentation/hwmon/emc2103
  F:    drivers/hwmon/emc2103.c
  
 +SMSC SCH5627 HARDWARE MONITOR DRIVER
 +M:    Hans de Goede <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    Documentation/hwmon/sch5627
 +F:    drivers/hwmon/sch5627.c
 +
  SMSC47B397 HARDWARE MONITOR DRIVER
  M:    "Mark M. Hoffman" <[email protected]>
  L:    [email protected]
@@@ -6116,11 -6087,13 +6122,11 @@@ F:   sound/soc/codecs/twl4030
  TIPC NETWORK LAYER
  M:    Jon Maloy <[email protected]>
  M:    Allan Stephens <[email protected]>
 -L:    [email protected]
 +L:    [email protected] (core kernel code)
 +L:    [email protected] (user apps, general discussion)
  W:    http://tipc.sourceforge.net/
 -W:    http://tipc.cslab.ericsson.net/
 -T:    git git://tipc.cslab.ericsson.net/pub/git/tipc.git
  S:    Maintained
  F:    include/linux/tipc*.h
 -F:    include/net/tipc/
  F:    net/tipc/
  
  TILE ARCHITECTURE
@@@ -6128,9 -6101,8 +6134,9 @@@ M:      Chris Metcalf <[email protected]
  W:    http://www.tilera.com/scm/
  S:    Supported
  F:    arch/tile/
 -F:    drivers/char/hvc_tile.c
 +F:    drivers/tty/hvc/hvc_tile.c
  F:    drivers/net/tile/
 +F:    drivers/edac/tile_edac.c
  
  TLAN NETWORK DRIVER
  M:    Samuel Chessman <[email protected]>
@@@ -6293,13 -6265,6 +6299,13 @@@ F:    drivers/uwb
  F:    include/linux/uwb.h
  F:    include/linux/uwb/
  
 +UNICORE32 ARCHITECTURE:
 +M:    Guan Xuetao <[email protected]>
 +W:    http://mprc.pku.edu.cn/~guanxuetao/linux
 +S:    Maintained
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/epip/linux-2.6-unicore32.git
 +F:    arch/unicore32/
 +
  UNIFDEF
  M:    Tony Finch <[email protected]>
  W:    http://dotat.at/prog/unifdef
@@@ -6468,11 -6433,12 +6474,11 @@@ S:   Maintaine
  F:    drivers/net/usb/rtl8150.c
  
  USB SE401 DRIVER
 -M:    Jeroen Vreeken <[email protected]>
  L:    [email protected]
  W:    http://www.chello.nl/~j.vreeken/se401/
 -S:    Maintained
 +S:    Orphan
  F:    Documentation/video4linux/se401.txt
 -F:    drivers/media/video/se401.*
 +F:    drivers/staging/se401/
  
  USB SERIAL BELKIN F5U103 DRIVER
  M:    William Greathouse <[email protected]>
@@@ -6822,7 -6788,7 +6828,7 @@@ F:      drivers/scsi/wd7000.
  WINBOND CIR DRIVER
  M:    David Härdeman <[email protected]>
  S:    Maintained
 -F:    drivers/input/misc/winbond-cir.c
 +F:    drivers/media/rc/winbond-cir.c
  
  WIMAX STACK
  M:    Inaky Perez-Gonzalez <[email protected]>
@@@ -6899,6 -6865,7 +6905,6 @@@ F:      sound/soc/codecs/wm
  
  WORKQUEUE
  M:    Tejun Heo <[email protected]>
 -L:    [email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git
  S:    Maintained
  F:    include/linux/workqueue.h
index 0d2d6a9c303c5f03ef952f6721d2d88b34f77d8b,145c8f0f6597d12cd9cf66e7029d1340a78f6ea4..e97851492847058f36c2c9056caddc6e830bbf9a
@@@ -15,7 -15,6 +15,7 @@@
  #include <linux/io.h>
  #include <linux/clk.h>
  #include <linux/err.h>
 +#include <linux/slab.h>
  
  #include <mach/hardware.h>
  #include <mach/irqs.h>
  #include <plat/dma.h>
  #include <plat/omap_hwmod.h>
  #include <plat/omap_device.h>
 +#include <plat/omap4-keypad.h>
  
  #include "mux.h"
  #include "control.h"
 -
+ #include "devices.h"
  
 +#define L3_MODULES_MAX_LEN 12
 +#define L3_MODULES 3
 +
 +static int __init omap3_l3_init(void)
 +{
 +      int l;
 +      struct omap_hwmod *oh;
 +      struct omap_device *od;
 +      char oh_name[L3_MODULES_MAX_LEN];
 +
 +      /*
 +       * To avoid code running on other OMAPs in
 +       * multi-omap builds
 +       */
 +      if (!(cpu_is_omap34xx()))
 +              return -ENODEV;
 +
 +      l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
 +
 +      oh = omap_hwmod_lookup(oh_name);
 +
 +      if (!oh)
 +              pr_err("could not look up %s\n", oh_name);
 +
 +      od = omap_device_build("omap_l3_smx", 0, oh, NULL, 0,
 +                                                         NULL, 0, 0);
 +
 +      WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name);
 +
 +      return PTR_ERR(od);
 +}
 +postcore_initcall(omap3_l3_init);
 +
 +static int __init omap4_l3_init(void)
 +{
 +      int l, i;
 +      struct omap_hwmod *oh[3];
 +      struct omap_device *od;
 +      char oh_name[L3_MODULES_MAX_LEN];
 +
 +      /*
 +       * To avoid code running on other OMAPs in
 +       * multi-omap builds
 +       */
 +      if (!(cpu_is_omap44xx()))
 +              return -ENODEV;
 +
 +      for (i = 0; i < L3_MODULES; i++) {
 +              l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1);
 +
 +              oh[i] = omap_hwmod_lookup(oh_name);
 +              if (!(oh[i]))
 +                      pr_err("could not look up %s\n", oh_name);
 +      }
 +
 +      od = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
 +                                                   0, NULL, 0, 0);
 +
 +      WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name);
 +
 +      return PTR_ERR(od);
 +}
 +postcore_initcall(omap4_l3_init);
 +
  #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
  
- static struct resource cam_resources[] = {
+ static struct resource omap2cam_resources[] = {
        {
                .start          = OMAP24XX_CAMERA_BASE,
                .end            = OMAP24XX_CAMERA_BASE + 0xfff,
        }
  };
  
- static struct platform_device omap_cam_device = {
+ static struct platform_device omap2cam_device = {
        .name           = "omap24xxcam",
        .id             = -1,
-       .num_resources  = ARRAY_SIZE(cam_resources),
-       .resource       = cam_resources,
+       .num_resources  = ARRAY_SIZE(omap2cam_resources),
+       .resource       = omap2cam_resources,
  };
- static inline void omap_init_camera(void)
- {
-       platform_device_register(&omap_cam_device);
- }
- #elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
+ #endif
  
  static struct resource omap3isp_resources[] = {
        {
                .end            = OMAP3430_ISP_END,
                .flags          = IORESOURCE_MEM,
        },
-       {
-               .start          = OMAP3430_ISP_CBUFF_BASE,
-               .end            = OMAP3430_ISP_CBUFF_END,
-               .flags          = IORESOURCE_MEM,
-       },
        {
                .start          = OMAP3430_ISP_CCP2_BASE,
                .end            = OMAP3430_ISP_CCP2_END,
                .flags          = IORESOURCE_MEM,
        },
        {
-               .start          = OMAP3430_ISP_CSI2A_BASE,
-               .end            = OMAP3430_ISP_CSI2A_END,
+               .start          = OMAP3430_ISP_CSI2A_REGS1_BASE,
+               .end            = OMAP3430_ISP_CSI2A_REGS1_END,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = OMAP3430_ISP_CSIPHY2_BASE,
+               .end            = OMAP3430_ISP_CSIPHY2_END,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = OMAP3630_ISP_CSI2A_REGS2_BASE,
+               .end            = OMAP3630_ISP_CSI2A_REGS2_END,
                .flags          = IORESOURCE_MEM,
        },
        {
-               .start          = OMAP3430_ISP_CSI2PHY_BASE,
-               .end            = OMAP3430_ISP_CSI2PHY_END,
+               .start          = OMAP3630_ISP_CSI2C_REGS1_BASE,
+               .end            = OMAP3630_ISP_CSI2C_REGS1_END,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = OMAP3630_ISP_CSIPHY1_BASE,
+               .end            = OMAP3630_ISP_CSIPHY1_END,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = OMAP3630_ISP_CSI2C_REGS2_BASE,
+               .end            = OMAP3630_ISP_CSI2C_REGS2_END,
                .flags          = IORESOURCE_MEM,
        },
        {
@@@ -197,80 -142,110 +207,84 @@@ static struct platform_device omap3isp_
        .resource       = omap3isp_resources,
  };
  
static inline void omap_init_camera(void)
int omap3_init_camera(struct isp_platform_data *pdata)
  {
-       platform_device_register(&omap3isp_device);
+       omap3isp_device.dev.platform_data = pdata;
+       return platform_device_register(&omap3isp_device);
  }
- #else
  static inline void omap_init_camera(void)
  {
- }
+ #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
+       if (cpu_is_omap24xx())
+               platform_device_register(&omap2cam_device);
  #endif
+ }
  
 -#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 -
 -#define MBOX_REG_SIZE   0x120
 -
 -#ifdef CONFIG_ARCH_OMAP2
 -static struct resource omap2_mbox_resources[] = {
 -      {
 -              .start          = OMAP24XX_MAILBOX_BASE,
 -              .end            = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
 -              .flags          = IORESOURCE_MEM,
 -      },
 +struct omap_device_pm_latency omap_keyboard_latency[] = {
        {
 -              .start          = INT_24XX_MAIL_U0_MPU,
 -              .flags          = IORESOURCE_IRQ,
 -              .name           = "dsp",
 -      },
 -      {
 -              .start          = INT_24XX_MAIL_U3_MPU,
 -              .flags          = IORESOURCE_IRQ,
 -              .name           = "iva",
 +              .deactivate_func = omap_device_idle_hwmods,
 +              .activate_func   = omap_device_enable_hwmods,
 +              .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
        },
  };
 -static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources);
 -#else
 -#define omap2_mbox_resources          NULL
 -#define omap2_mbox_resources_sz               0
 -#endif
  
 -#ifdef CONFIG_ARCH_OMAP3
 -static struct resource omap3_mbox_resources[] = {
 -      {
 -              .start          = OMAP34XX_MAILBOX_BASE,
 -              .end            = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
 -              .flags          = IORESOURCE_MEM,
 -      },
 -      {
 -              .start          = INT_24XX_MAIL_U0_MPU,
 -              .flags          = IORESOURCE_IRQ,
 -              .name           = "dsp",
 -      },
 -};
 -static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources);
 -#else
 -#define omap3_mbox_resources          NULL
 -#define omap3_mbox_resources_sz               0
 -#endif
 +int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 +                                              *sdp4430_keypad_data)
 +{
 +      struct omap_device *od;
 +      struct omap_hwmod *oh;
 +      struct omap4_keypad_platform_data *keypad_data;
 +      unsigned int id = -1;
 +      char *oh_name = "kbd";
 +      char *name = "omap4-keypad";
 +
 +      oh = omap_hwmod_lookup(oh_name);
 +      if (!oh) {
 +              pr_err("Could not look up %s\n", oh_name);
 +              return -ENODEV;
 +      }
  
 -#ifdef CONFIG_ARCH_OMAP4
 +      keypad_data = sdp4430_keypad_data;
  
 -#define OMAP4_MBOX_REG_SIZE   0x130
 -static struct resource omap4_mbox_resources[] = {
 -      {
 -              .start          = OMAP44XX_MAILBOX_BASE,
 -              .end            = OMAP44XX_MAILBOX_BASE +
 -                                      OMAP4_MBOX_REG_SIZE - 1,
 -              .flags          = IORESOURCE_MEM,
 -      },
 -      {
 -              .start          = OMAP44XX_IRQ_MAIL_U0,
 -              .flags          = IORESOURCE_IRQ,
 -              .name           = "mbox",
 -      },
 -};
 -static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources);
 -#else
 -#define omap4_mbox_resources          NULL
 -#define omap4_mbox_resources_sz               0
 -#endif
 +      od = omap_device_build(name, id, oh, keypad_data,
 +                      sizeof(struct omap4_keypad_platform_data),
 +                      omap_keyboard_latency,
 +                      ARRAY_SIZE(omap_keyboard_latency), 0);
  
 -static struct platform_device mbox_device = {
 -      .name           = "omap-mailbox",
 -      .id             = -1,
 +      if (IS_ERR(od)) {
 +              WARN(1, "Cant build omap_device for %s:%s.\n",
 +                                              name, oh->name);
 +              return PTR_ERR(od);
 +      }
 +
 +      return 0;
 +}
 +
 +#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 +static struct omap_device_pm_latency mbox_latencies[] = {
 +      [0] = {
 +              .activate_func = omap_device_enable_hwmods,
 +              .deactivate_func = omap_device_idle_hwmods,
 +              .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
 +      },
  };
  
  static inline void omap_init_mbox(void)
  {
 -      if (cpu_is_omap24xx()) {
 -              mbox_device.resource = omap2_mbox_resources;
 -              mbox_device.num_resources = omap2_mbox_resources_sz;
 -      } else if (cpu_is_omap34xx()) {
 -              mbox_device.resource = omap3_mbox_resources;
 -              mbox_device.num_resources = omap3_mbox_resources_sz;
 -      } else if (cpu_is_omap44xx()) {
 -              mbox_device.resource = omap4_mbox_resources;
 -              mbox_device.num_resources = omap4_mbox_resources_sz;
 -      } else {
 -              pr_err("%s: platform not supported\n", __func__);
 +      struct omap_hwmod *oh;
 +      struct omap_device *od;
 +
 +      oh = omap_hwmod_lookup("mailbox");
 +      if (!oh) {
 +              pr_err("%s: unable to find hwmod\n", __func__);
                return;
        }
 -      platform_device_register(&mbox_device);
 +
 +      od = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
 +                              mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
 +      WARN(IS_ERR(od), "%s: could not build device, err %ld\n",
 +                                              __func__, PTR_ERR(od));
  }
  #else
  static inline void omap_init_mbox(void) { }
@@@ -319,55 -294,163 +333,55 @@@ static inline void omap_init_audio(void
  
  #include <plat/mcspi.h>
  
 -#define OMAP2_MCSPI1_BASE             0x48098000
 -#define OMAP2_MCSPI2_BASE             0x4809a000
 -#define OMAP2_MCSPI3_BASE             0x480b8000
 -#define OMAP2_MCSPI4_BASE             0x480ba000
 -
 -#define OMAP4_MCSPI1_BASE             0x48098100
 -#define OMAP4_MCSPI2_BASE             0x4809a100
 -#define OMAP4_MCSPI3_BASE             0x480b8100
 -#define OMAP4_MCSPI4_BASE             0x480ba100
 -
 -static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
 -      .num_cs         = 4,
 -};
 -
 -static struct resource omap2_mcspi1_resources[] = {
 -      {
 -              .start          = OMAP2_MCSPI1_BASE,
 -              .end            = OMAP2_MCSPI1_BASE + 0xff,
 -              .flags          = IORESOURCE_MEM,
 -      },
 -};
 -
 -static struct platform_device omap2_mcspi1 = {
 -      .name           = "omap2_mcspi",
 -      .id             = 1,
 -      .num_resources  = ARRAY_SIZE(omap2_mcspi1_resources),
 -      .resource       = omap2_mcspi1_resources,
 -      .dev            = {
 -              .platform_data = &omap2_mcspi1_config,
 -      },
 -};
 -
 -static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
 -      .num_cs         = 2,
 -};
 -
 -static struct resource omap2_mcspi2_resources[] = {
 -      {
 -              .start          = OMAP2_MCSPI2_BASE,
 -              .end            = OMAP2_MCSPI2_BASE + 0xff,
 -              .flags          = IORESOURCE_MEM,
 -      },
 -};
 -
 -static struct platform_device omap2_mcspi2 = {
 -      .name           = "omap2_mcspi",
 -      .id             = 2,
 -      .num_resources  = ARRAY_SIZE(omap2_mcspi2_resources),
 -      .resource       = omap2_mcspi2_resources,
 -      .dev            = {
 -              .platform_data = &omap2_mcspi2_config,
 -      },
 -};
 -
 -#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
 -      defined(CONFIG_ARCH_OMAP4)
 -static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
 -      .num_cs         = 2,
 -};
 -
 -static struct resource omap2_mcspi3_resources[] = {
 -      {
 -      .start          = OMAP2_MCSPI3_BASE,
 -      .end            = OMAP2_MCSPI3_BASE + 0xff,
 -      .flags          = IORESOURCE_MEM,
 -      },
 -};
 -
 -static struct platform_device omap2_mcspi3 = {
 -      .name           = "omap2_mcspi",
 -      .id             = 3,
 -      .num_resources  = ARRAY_SIZE(omap2_mcspi3_resources),
 -      .resource       = omap2_mcspi3_resources,
 -      .dev            = {
 -              .platform_data = &omap2_mcspi3_config,
 +struct omap_device_pm_latency omap_mcspi_latency[] = {
 +      [0] = {
 +              .deactivate_func = omap_device_idle_hwmods,
 +              .activate_func   = omap_device_enable_hwmods,
 +              .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
        },
  };
 -#endif
 -
 -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
 -static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
 -      .num_cs         = 1,
 -};
  
 -static struct resource omap2_mcspi4_resources[] = {
 -      {
 -              .start          = OMAP2_MCSPI4_BASE,
 -              .end            = OMAP2_MCSPI4_BASE + 0xff,
 -              .flags          = IORESOURCE_MEM,
 -      },
 -};
 -
 -static struct platform_device omap2_mcspi4 = {
 -      .name           = "omap2_mcspi",
 -      .id             = 4,
 -      .num_resources  = ARRAY_SIZE(omap2_mcspi4_resources),
 -      .resource       = omap2_mcspi4_resources,
 -      .dev            = {
 -              .platform_data = &omap2_mcspi4_config,
 -      },
 -};
 -#endif
 -
 -#ifdef CONFIG_ARCH_OMAP4
 -static inline void omap4_mcspi_fixup(void)
 +static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
  {
 -      omap2_mcspi1_resources[0].start = OMAP4_MCSPI1_BASE;
 -      omap2_mcspi1_resources[0].end   = OMAP4_MCSPI1_BASE + 0xff;
 -      omap2_mcspi2_resources[0].start = OMAP4_MCSPI2_BASE;
 -      omap2_mcspi2_resources[0].end   = OMAP4_MCSPI2_BASE + 0xff;
 -      omap2_mcspi3_resources[0].start = OMAP4_MCSPI3_BASE;
 -      omap2_mcspi3_resources[0].end   = OMAP4_MCSPI3_BASE + 0xff;
 -      omap2_mcspi4_resources[0].start = OMAP4_MCSPI4_BASE;
 -      omap2_mcspi4_resources[0].end   = OMAP4_MCSPI4_BASE + 0xff;
 -}
 -#else
 -static inline void omap4_mcspi_fixup(void)
 -{
 -}
 -#endif
 +      struct omap_device *od;
 +      char *name = "omap2_mcspi";
 +      struct omap2_mcspi_platform_config *pdata;
 +      static int spi_num;
 +      struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
 +
 +      pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
 +      if (!pdata) {
 +              pr_err("Memory allocation for McSPI device failed\n");
 +              return -ENOMEM;
 +      }
  
 -#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
 -      defined(CONFIG_ARCH_OMAP4)
 -static inline void omap2_mcspi3_init(void)
 -{
 -      platform_device_register(&omap2_mcspi3);
 -}
 -#else
 -static inline void omap2_mcspi3_init(void)
 -{
 -}
 -#endif
 +      pdata->num_cs = mcspi_attrib->num_chipselect;
 +      switch (oh->class->rev) {
 +      case OMAP2_MCSPI_REV:
 +      case OMAP3_MCSPI_REV:
 +                      pdata->regs_offset = 0;
 +                      break;
 +      case OMAP4_MCSPI_REV:
 +                      pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
 +                      break;
 +      default:
 +                      pr_err("Invalid McSPI Revision value\n");
 +                      return -EINVAL;
 +      }
  
 -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
 -static inline void omap2_mcspi4_init(void)
 -{
 -      platform_device_register(&omap2_mcspi4);
 +      spi_num++;
 +      od = omap_device_build(name, spi_num, oh, pdata,
 +                              sizeof(*pdata), omap_mcspi_latency,
 +                              ARRAY_SIZE(omap_mcspi_latency), 0);
 +      WARN(IS_ERR(od), "Cant build omap_device for %s:%s\n",
 +                              name, oh->name);
 +      kfree(pdata);
 +      return 0;
  }
 -#else
 -static inline void omap2_mcspi4_init(void)
 -{
 -}
 -#endif
  
  static void omap_init_mcspi(void)
  {
 -      if (cpu_is_omap44xx())
 -              omap4_mcspi_fixup();
 -
 -      platform_device_register(&omap2_mcspi1);
 -      platform_device_register(&omap2_mcspi2);
 -
 -      if (cpu_is_omap2430() || cpu_is_omap343x() || cpu_is_omap44xx())
 -              omap2_mcspi3_init();
 -
 -      if (cpu_is_omap343x() || cpu_is_omap44xx())
 -              omap2_mcspi4_init();
 +      omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
  }
  
  #else
@@@ -542,10 -625,117 +556,10 @@@ static inline void omap_init_aes(void) 
  
  /*-------------------------------------------------------------------------*/
  
 -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
 -
 -#define MMCHS_SYSCONFIG                       0x0010
 -#define MMCHS_SYSCONFIG_SWRESET               (1 << 1)
 -#define MMCHS_SYSSTATUS                       0x0014
 -#define MMCHS_SYSSTATUS_RESETDONE     (1 << 0)
 -
 -static struct platform_device dummy_pdev = {
 -      .dev = {
 -              .bus = &platform_bus_type,
 -      },
 -};
 -
 -/**
 - * omap_hsmmc_reset() - Full reset of each HS-MMC controller
 - *
 - * Ensure that each MMC controller is fully reset.  Controllers
 - * left in an unknown state (by bootloader) may prevent retention
 - * or OFF-mode.  This is especially important in cases where the
 - * MMC driver is not enabled, _or_ built as a module.
 - *
 - * In order for reset to work, interface, functional and debounce
 - * clocks must be enabled.  The debounce clock comes from func_32k_clk
 - * and is not under SW control, so we only enable i- and f-clocks.
 - **/
 -static void __init omap_hsmmc_reset(void)
 -{
 -      u32 i, nr_controllers;
 -      struct clk *iclk, *fclk;
 -
 -      if (cpu_is_omap242x())
 -              return;
 -
 -      nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
 -              (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
 -
 -      for (i = 0; i < nr_controllers; i++) {
 -              u32 v, base = 0;
 -              struct device *dev = &dummy_pdev.dev;
 +#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
  
 -              switch (i) {
 -              case 0:
 -                      base = OMAP2_MMC1_BASE;
 -                      break;
 -              case 1:
 -                      base = OMAP2_MMC2_BASE;
 -                      break;
 -              case 2:
 -                      base = OMAP3_MMC3_BASE;
 -                      break;
 -              case 3:
 -                      if (!cpu_is_omap44xx())
 -                              return;
 -                      base = OMAP4_MMC4_BASE;
 -                      break;
 -              case 4:
 -                      if (!cpu_is_omap44xx())
 -                              return;
 -                      base = OMAP4_MMC5_BASE;
 -                      break;
 -              }
 -
 -              if (cpu_is_omap44xx())
 -                      base += OMAP4_MMC_REG_OFFSET;
 -
 -              dummy_pdev.id = i;
 -              dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
 -              iclk = clk_get(dev, "ick");
 -              if (IS_ERR(iclk))
 -                      goto err1;
 -              if (clk_enable(iclk))
 -                      goto err2;
 -
 -              fclk = clk_get(dev, "fck");
 -              if (IS_ERR(fclk))
 -                      goto err3;
 -              if (clk_enable(fclk))
 -                      goto err4;
 -
 -              omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
 -              v = omap_readl(base + MMCHS_SYSSTATUS);
 -              while (!(omap_readl(base + MMCHS_SYSSTATUS) &
 -                       MMCHS_SYSSTATUS_RESETDONE))
 -                      cpu_relax();
 -
 -              clk_disable(fclk);
 -              clk_put(fclk);
 -              clk_disable(iclk);
 -              clk_put(iclk);
 -      }
 -      return;
 -
 -err4:
 -      clk_put(fclk);
 -err3:
 -      clk_disable(iclk);
 -err2:
 -      clk_put(iclk);
 -err1:
 -      printk(KERN_WARNING "%s: Unable to enable clocks for MMC%d, "
 -                          "cannot reset.\n",  __func__, i);
 -}
 -#else
 -static inline void omap_hsmmc_reset(void) {}
 -#endif
 -
 -#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
 -      defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 -
 -static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
 -                      int controller_nr)
 +static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
 +                                                      *mmc_controller)
  {
        if ((mmc_controller->slots[0].switch_pin > 0) && \
                (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
                omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
                                        OMAP_PIN_INPUT_PULLUP);
  
 -      if (cpu_is_omap2420() && controller_nr == 0) {
 -              omap_mux_init_signal("sdmmc_cmd", 0);
 -              omap_mux_init_signal("sdmmc_clki", 0);
 -              omap_mux_init_signal("sdmmc_clko", 0);
 -              omap_mux_init_signal("sdmmc_dat0", 0);
 -              omap_mux_init_signal("sdmmc_dat_dir0", 0);
 -              omap_mux_init_signal("sdmmc_cmd_dir", 0);
 -              if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
 -                      omap_mux_init_signal("sdmmc_dat1", 0);
 -                      omap_mux_init_signal("sdmmc_dat2", 0);
 -                      omap_mux_init_signal("sdmmc_dat3", 0);
 -                      omap_mux_init_signal("sdmmc_dat_dir1", 0);
 -                      omap_mux_init_signal("sdmmc_dat_dir2", 0);
 -                      omap_mux_init_signal("sdmmc_dat_dir3", 0);
 -              }
 -
 -              /*
 -               * Use internal loop-back in MMC/SDIO Module Input Clock
 -               * selection
 -               */
 -              if (mmc_controller->slots[0].internal_clock) {
 -                      u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
 -                      v |= (1 << 24);
 -                      omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
 -              }
 +      omap_mux_init_signal("sdmmc_cmd", 0);
 +      omap_mux_init_signal("sdmmc_clki", 0);
 +      omap_mux_init_signal("sdmmc_clko", 0);
 +      omap_mux_init_signal("sdmmc_dat0", 0);
 +      omap_mux_init_signal("sdmmc_dat_dir0", 0);
 +      omap_mux_init_signal("sdmmc_cmd_dir", 0);
 +      if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
 +              omap_mux_init_signal("sdmmc_dat1", 0);
 +              omap_mux_init_signal("sdmmc_dat2", 0);
 +              omap_mux_init_signal("sdmmc_dat3", 0);
 +              omap_mux_init_signal("sdmmc_dat_dir1", 0);
 +              omap_mux_init_signal("sdmmc_dat_dir2", 0);
 +              omap_mux_init_signal("sdmmc_dat_dir3", 0);
        }
  
 -      if (cpu_is_omap34xx()) {
 -              if (controller_nr == 0) {
 -                      omap_mux_init_signal("sdmmc1_clk",
 -                              OMAP_PIN_INPUT_PULLUP);
 -                      omap_mux_init_signal("sdmmc1_cmd",
 -                              OMAP_PIN_INPUT_PULLUP);
 -                      omap_mux_init_signal("sdmmc1_dat0",
 -                              OMAP_PIN_INPUT_PULLUP);
 -                      if (mmc_controller->slots[0].caps &
 -                              (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
 -                              omap_mux_init_signal("sdmmc1_dat1",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc1_dat2",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc1_dat3",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                      }
 -                      if (mmc_controller->slots[0].caps &
 -                                              MMC_CAP_8_BIT_DATA) {
 -                              omap_mux_init_signal("sdmmc1_dat4",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc1_dat5",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc1_dat6",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc1_dat7",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                      }
 -              }
 -              if (controller_nr == 1) {
 -                      /* MMC2 */
 -                      omap_mux_init_signal("sdmmc2_clk",
 -                              OMAP_PIN_INPUT_PULLUP);
 -                      omap_mux_init_signal("sdmmc2_cmd",
 -                              OMAP_PIN_INPUT_PULLUP);
 -                      omap_mux_init_signal("sdmmc2_dat0",
 -                              OMAP_PIN_INPUT_PULLUP);
 -
 -                      /*
 -                       * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
 -                       * in the board-*.c files
 -                       */
 -                      if (mmc_controller->slots[0].caps &
 -                              (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
 -                              omap_mux_init_signal("sdmmc2_dat1",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc2_dat2",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc2_dat3",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                      }
 -                      if (mmc_controller->slots[0].caps &
 -                                                      MMC_CAP_8_BIT_DATA) {
 -                              omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                              omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
 -                                      OMAP_PIN_INPUT_PULLUP);
 -                      }
 -              }
 -
 -              /*
 -               * For MMC3 the pins need to be muxed in the board-*.c files
 -               */
 +      /*
 +       * Use internal loop-back in MMC/SDIO Module Input Clock
 +       * selection
 +       */
 +      if (mmc_controller->slots[0].internal_clock) {
 +              u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
 +              v |= (1 << 24);
 +              omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
        }
  }
  
 -void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
 -                      int nr_controllers)
 +void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
  {
 -      int i;
 -      char *name;
 -
 -      for (i = 0; i < nr_controllers; i++) {
 -              unsigned long base, size;
 -              unsigned int irq = 0;
 +      char *name = "mmci-omap";
  
 -              if (!mmc_data[i])
 -                      continue;
 -
 -              omap2_mmc_mux(mmc_data[i], i);
 +      if (!mmc_data[0]) {
 +              pr_err("%s fails: Incomplete platform data\n", __func__);
 +              return;
 +      }
  
 -              switch (i) {
 -              case 0:
 -                      base = OMAP2_MMC1_BASE;
 -                      irq = INT_24XX_MMC_IRQ;
 -                      break;
 -              case 1:
 -                      base = OMAP2_MMC2_BASE;
 -                      irq = INT_24XX_MMC2_IRQ;
 -                      break;
 -              case 2:
 -                      if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
 -                              return;
 -                      base = OMAP3_MMC3_BASE;
 -                      irq = INT_34XX_MMC3_IRQ;
 -                      break;
 -              case 3:
 -                      if (!cpu_is_omap44xx())
 -                              return;
 -                      base = OMAP4_MMC4_BASE;
 -                      irq = OMAP44XX_IRQ_MMC4;
 -                      break;
 -              case 4:
 -                      if (!cpu_is_omap44xx())
 -                              return;
 -                      base = OMAP4_MMC5_BASE;
 -                      irq = OMAP44XX_IRQ_MMC5;
 -                      break;
 -              default:
 -                      continue;
 -              }
 -
 -              if (cpu_is_omap2420()) {
 -                      size = OMAP2420_MMC_SIZE;
 -                      name = "mmci-omap";
 -              } else if (cpu_is_omap44xx()) {
 -                      if (i < 3)
 -                              irq += OMAP44XX_IRQ_GIC_START;
 -                      size = OMAP4_HSMMC_SIZE;
 -                      name = "mmci-omap-hs";
 -              } else {
 -                      size = OMAP3_HSMMC_SIZE;
 -                      name = "mmci-omap-hs";
 -              }
 -              omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
 -      };
 +      omap242x_mmc_mux(mmc_data[0]);
 +      omap_mmc_add(name, 0, OMAP2_MMC1_BASE, OMAP2420_MMC_SIZE,
 +                                      INT_24XX_MMC_IRQ, mmc_data[0]);
  }
  
  #endif
  /*-------------------------------------------------------------------------*/
  
  #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
 -#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
 +#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
  #define OMAP_HDQ_BASE 0x480B2000
  #endif
  static struct resource omap_hdq_resources[] = {
@@@ -667,6 -976,7 +681,6 @@@ static int __init omap2_init_devices(vo
         * please keep these calls, and their implementations above,
         * in alphabetical order so they're easier to sort through.
         */
 -      omap_hsmmc_reset();
        omap_init_audio();
        omap_init_camera();
        omap_init_mbox();
index b2b9415d874d02142a9944c283c0f613cda1e9b6,f511418b144abe82599d13718c5fb09e29c61abf..41bacff24960b7b7262d435ac575a147fac8c511
@@@ -8,71 -8,60 +8,71 @@@
  #include "dvb-usb-common.h"
  #include <linux/usb/input.h>
  
 +static unsigned int
 +legacy_dvb_usb_get_keymap_index(const struct input_keymap_entry *ke,
 +                              struct rc_map_table *keymap,
 +                              unsigned int keymap_size)
 +{
 +      unsigned int index;
 +      unsigned int scancode;
 +
 +      if (ke->flags & INPUT_KEYMAP_BY_INDEX) {
 +              index = ke->index;
 +      } else {
 +              if (input_scancode_to_scalar(ke, &scancode))
 +                      return keymap_size;
 +
 +              /* See if we can match the raw key code. */
 +              for (index = 0; index < keymap_size; index++)
 +                      if (keymap[index].scancode == scancode)
 +                              break;
 +
 +              /* See if there is an unused hole in the map */
 +              if (index >= keymap_size) {
 +                      for (index = 0; index < keymap_size; index++) {
 +                              if (keymap[index].keycode == KEY_RESERVED ||
 +                                  keymap[index].keycode == KEY_UNKNOWN) {
 +                                      break;
 +                              }
 +                      }
 +              }
 +      }
 +
 +      return index;
 +}
 +
  static int legacy_dvb_usb_getkeycode(struct input_dev *dev,
 -                              unsigned int scancode, unsigned int *keycode)
 +                                   struct input_keymap_entry *ke)
  {
        struct dvb_usb_device *d = input_get_drvdata(dev);
 -
        struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
 -      int i;
 +      unsigned int keymap_size = d->props.rc.legacy.rc_map_size;
 +      unsigned int index;
  
 -      /* See if we can match the raw key code. */
 -      for (i = 0; i < d->props.rc.legacy.rc_map_size; i++)
 -              if (keymap[i].scancode == scancode) {
 -                      *keycode = keymap[i].keycode;
 -                      return 0;
 -              }
 +      index = legacy_dvb_usb_get_keymap_index(ke, keymap, keymap_size);
 +      if (index >= keymap_size)
 +              return -EINVAL;
  
 -      /*
 -       * If is there extra space, returns KEY_RESERVED,
 -       * otherwise, input core won't let legacy_dvb_usb_setkeycode
 -       * to work
 -       */
 -      for (i = 0; i < d->props.rc.legacy.rc_map_size; i++)
 -              if (keymap[i].keycode == KEY_RESERVED ||
 -                  keymap[i].keycode == KEY_UNKNOWN) {
 -                      *keycode = KEY_RESERVED;
 -                      return 0;
 -              }
 +      ke->keycode = keymap[index].keycode;
 +      if (ke->keycode == KEY_UNKNOWN)
 +              ke->keycode = KEY_RESERVED;
 +      ke->len = sizeof(keymap[index].scancode);
 +      memcpy(&ke->scancode, &keymap[index].scancode, ke->len);
 +      ke->index = index;
  
 -      return -EINVAL;
 +      return 0;
  }
  
  static int legacy_dvb_usb_setkeycode(struct input_dev *dev,
 -                              unsigned int scancode, unsigned int keycode)
 +                                   const struct input_keymap_entry *ke,
 +                                   unsigned int *old_keycode)
  {
        struct dvb_usb_device *d = input_get_drvdata(dev);
 -
        struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
 -      int i;
 -
 -      /* Search if it is replacing an existing keycode */
 -      for (i = 0; i < d->props.rc.legacy.rc_map_size; i++)
 -              if (keymap[i].scancode == scancode) {
 -                      keymap[i].keycode = keycode;
 -                      return 0;
 -              }
 -
 -      /* Search if is there a clean entry. If so, use it */
 -      for (i = 0; i < d->props.rc.legacy.rc_map_size; i++)
 -              if (keymap[i].keycode == KEY_RESERVED ||
 -                  keymap[i].keycode == KEY_UNKNOWN) {
 -                      keymap[i].scancode = scancode;
 -                      keymap[i].keycode = keycode;
 -                      return 0;
 -              }
 +      unsigned int keymap_size = d->props.rc.legacy.rc_map_size;
 +      unsigned int index;
  
 +      index = legacy_dvb_usb_get_keymap_index(ke, keymap, keymap_size);
        /*
         * FIXME: Currently, it is not possible to increase the size of
         * scancode table. For it to happen, one possibility
         * copying data, appending the new key on it, and freeing
         * the old one - or maybe just allocating some spare space
         */
 +      if (index >= keymap_size)
 +              return -EINVAL;
 +
 +      *old_keycode = keymap[index].keycode;
 +      keymap->keycode = ke->keycode;
 +      __set_bit(ke->keycode, dev->keybit);
 +
 +      if (*old_keycode != KEY_RESERVED) {
 +              __clear_bit(*old_keycode, dev->keybit);
 +              for (index = 0; index < keymap_size; index++) {
 +                      if (keymap[index].keycode == *old_keycode) {
 +                              __set_bit(*old_keycode, dev->keybit);
 +                              break;
 +                      }
 +              }
 +      }
  
 -      return -EINVAL;
 +      return 0;
  }
  
  /* Remote-control poll function - called every dib->rc_query_interval ms to see
@@@ -273,7 -246,7 +273,7 @@@ static int rc_core_dvb_usb_remote_init(
        dev->map_name = d->props.rc.core.rc_codes;
        dev->change_protocol = d->props.rc.core.change_protocol;
        dev->allowed_protos = d->props.rc.core.allowed_protos;
-       dev->driver_type = RC_DRIVER_SCANCODE;
+       dev->driver_type = d->props.rc.core.driver_type;
        usb_to_input_id(d->udev, &dev->input_id);
        dev->input_name = "IR-receiver inside an USB DVB receiver";
        dev->input_phys = d->rc_phys;
index 4698eb00b59fc99b127fa9c1c596530ad352d07c,46cacf845049941c5ad0efc687e23fd2ad4236d7..e2550dc2944f939812805d2c23778c86df2ff7e0
@@@ -1,7 -1,7 +1,7 @@@
  /*
   * Driver for the Texas Instruments WL1273 FM radio.
   *
-  * Copyright (C) 2010 Nokia Corporation
+  * Copyright (C) 2011 Nokia Corporation
   * Author: Matti J. Aaltonen <[email protected]>
   *
   * This program is free software; you can redistribute it and/or
@@@ -67,7 -67,6 +67,6 @@@ struct wl1273_device 
  
        /* RDS */
        unsigned int rds_on;
-       struct delayed_work work;
  
        wait_queue_head_t read_queue;
        struct mutex lock; /* for serializing fm radio operations */
@@@ -104,58 -103,6 +103,6 @@@ static unsigned int rds_buf = 100
  module_param(rds_buf, uint, 0);
  MODULE_PARM_DESC(rds_buf, "Number of RDS buffer entries. Default = 100");
  
- static int wl1273_fm_read_reg(struct wl1273_core *core, u8 reg, u16 *value)
- {
-       struct i2c_client *client = core->client;
-       u8 b[2];
-       int r;
-       r = i2c_smbus_read_i2c_block_data(client, reg, sizeof(b), b);
-       if (r != 2) {
-               dev_err(&client->dev, "%s: Read: %d fails.\n", __func__, reg);
-               return -EREMOTEIO;
-       }
-       *value = (u16)b[0] << 8 | b[1];
-       return 0;
- }
- static int wl1273_fm_write_cmd(struct wl1273_core *core, u8 cmd, u16 param)
- {
-       struct i2c_client *client = core->client;
-       u8 buf[] = { (param >> 8) & 0xff, param & 0xff };
-       int r;
-       r = i2c_smbus_write_i2c_block_data(client, cmd, sizeof(buf), buf);
-       if (r) {
-               dev_err(&client->dev, "%s: Cmd: %d fails.\n", __func__, cmd);
-               return r;
-       }
-       return 0;
- }
- static int wl1273_fm_write_data(struct wl1273_core *core, u8 *data, u16 len)
- {
-       struct i2c_client *client = core->client;
-       struct i2c_msg msg;
-       int r;
-       msg.addr = client->addr;
-       msg.flags = 0;
-       msg.buf = data;
-       msg.len = len;
-       r = i2c_transfer(client->adapter, &msg, 1);
-       if (r != 1) {
-               dev_err(&client->dev, "%s: write error.\n", __func__);
-               return -EREMOTEIO;
-       }
-       return 0;
- }
  static int wl1273_fm_write_fw(struct wl1273_core *core,
                              __u8 *fw, int len)
  {
        return r;
  }
  
- /**
-  * wl1273_fm_set_audio() -    Set audio mode.
-  * @core:                     A pointer to the device struct.
-  * @new_mode:                 The new audio mode.
-  *
-  * Audio modes are WL1273_AUDIO_DIGITAL and WL1273_AUDIO_ANALOG.
-  */
- static int wl1273_fm_set_audio(struct wl1273_core *core, unsigned int new_mode)
- {
-       int r = 0;
-       if (core->mode == WL1273_MODE_OFF ||
-           core->mode == WL1273_MODE_SUSPENDED)
-               return -EPERM;
-       if (core->mode == WL1273_MODE_RX && new_mode == WL1273_AUDIO_DIGITAL) {
-               r = wl1273_fm_write_cmd(core, WL1273_PCM_MODE_SET,
-                                       WL1273_PCM_DEF_MODE);
-               if (r)
-                       goto out;
-               r = wl1273_fm_write_cmd(core, WL1273_I2S_MODE_CONFIG_SET,
-                                       core->i2s_mode);
-               if (r)
-                       goto out;
-               r = wl1273_fm_write_cmd(core, WL1273_AUDIO_ENABLE,
-                                       WL1273_AUDIO_ENABLE_I2S);
-               if (r)
-                       goto out;
-       } else if (core->mode == WL1273_MODE_RX &&
-                  new_mode == WL1273_AUDIO_ANALOG) {
-               r = wl1273_fm_write_cmd(core, WL1273_AUDIO_ENABLE,
-                                       WL1273_AUDIO_ENABLE_ANALOG);
-               if (r)
-                       goto out;
-       } else if (core->mode == WL1273_MODE_TX &&
-                  new_mode == WL1273_AUDIO_DIGITAL) {
-               r = wl1273_fm_write_cmd(core, WL1273_I2S_MODE_CONFIG_SET,
-                                       core->i2s_mode);
-               if (r)
-                       goto out;
-               r = wl1273_fm_write_cmd(core, WL1273_AUDIO_IO_SET,
-                                       WL1273_AUDIO_IO_SET_I2S);
-               if (r)
-                       goto out;
-       } else if (core->mode == WL1273_MODE_TX &&
-                  new_mode == WL1273_AUDIO_ANALOG) {
-               r = wl1273_fm_write_cmd(core, WL1273_AUDIO_IO_SET,
-                                       WL1273_AUDIO_IO_SET_ANALOG);
-               if (r)
-                       goto out;
-       }
-       core->audio_mode = new_mode;
- out:
-       return r;
- }
- /**
-  * wl1273_fm_set_volume() -   Set volume.
-  * @core:                     A pointer to the device struct.
-  * @volume:                   The new volume value.
-  */
- static int wl1273_fm_set_volume(struct wl1273_core *core, unsigned int volume)
- {
-       u16 val;
-       int r;
-       if (volume > WL1273_MAX_VOLUME)
-               return -EINVAL;
-       if (core->volume == volume)
-               return 0;
-       val = volume;
-       r = wl1273_fm_read_reg(core, WL1273_VOLUME_SET, &val);
-       if (r)
-               return r;
-       core->volume = volume;
-       return 0;
- }
  #define WL1273_FIFO_HAS_DATA(status)  (1 << 5 & status)
  #define WL1273_RDS_CORRECTABLE_ERROR  (1 << 3)
  #define WL1273_RDS_UNCORRECTABLE_ERROR        (1 << 4)
@@@ -306,7 -165,7 +165,7 @@@ static int wl1273_fm_rds(struct wl1273_
        if (core->mode != WL1273_MODE_RX)
                return 0;
  
-       r = wl1273_fm_read_reg(core, WL1273_RDS_SYNC_GET, &val);
+       r = core->read(core, WL1273_RDS_SYNC_GET, &val);
        if (r)
                return r;
  
@@@ -374,7 -233,7 +233,7 @@@ static irqreturn_t wl1273_fm_irq_thread
        u16 flags;
        int r;
  
-       r = wl1273_fm_read_reg(core, WL1273_FLAG_GET, &flags);
+       r = core->read(core, WL1273_FLAG_GET, &flags);
        if (r)
                goto out;
  
        if (flags & WL1273_LEV_EVENT) {
                u16 level;
  
-               r = wl1273_fm_read_reg(core, WL1273_RSSI_LVL_GET, &level);
+               r = core->read(core, WL1273_RSSI_LVL_GET, &level);
                if (r)
                        goto out;
  
                dev_dbg(radio->dev, "IRQ: FR:\n");
  
                if (core->mode == WL1273_MODE_RX) {
-                       r = wl1273_fm_write_cmd(core, WL1273_TUNER_MODE_SET,
-                                               TUNER_MODE_STOP_SEARCH);
+                       r = core->write(core, WL1273_TUNER_MODE_SET,
+                                       TUNER_MODE_STOP_SEARCH);
                        if (r) {
                                dev_err(radio->dev,
                                        "%s: TUNER_MODE_SET fails: %d\n",
                                goto out;
                        }
  
-                       r = wl1273_fm_read_reg(core, WL1273_FREQ_SET, &freq);
+                       r = core->read(core, WL1273_FREQ_SET, &freq);
                        if (r)
                                goto out;
  
                        dev_dbg(radio->dev, "%dkHz\n", radio->rx_frequency);
  
                } else {
-                       r = wl1273_fm_read_reg(core, WL1273_CHANL_SET, &freq);
+                       r = core->read(core, WL1273_CHANL_SET, &freq);
                        if (r)
                                goto out;
  
        }
  
  out:
-       wl1273_fm_write_cmd(core, WL1273_INT_MASK_SET,
-                           radio->irq_flags);
+       core->write(core, WL1273_INT_MASK_SET, radio->irq_flags);
        complete(&radio->busy);
  
        return IRQ_HANDLED;
@@@ -512,7 -370,7 +370,7 @@@ static int wl1273_fm_set_tx_freq(struc
        dev_dbg(radio->dev, "%s: freq: %d kHz\n", __func__, freq);
  
        /* Set the current tx channel */
-       r = wl1273_fm_write_cmd(core, WL1273_CHANL_SET, freq / 10);
+       r = core->write(core, WL1273_CHANL_SET, freq / 10);
        if (r)
                return r;
  
        dev_dbg(radio->dev, "WL1273_CHANL_SET: %d\n", r);
  
        /* Enable the output power */
-       r = wl1273_fm_write_cmd(core, WL1273_POWER_ENB_SET, 1);
+       r = core->write(core, WL1273_POWER_ENB_SET, 1);
        if (r)
                return r;
  
@@@ -566,20 -424,20 +424,20 @@@ static int wl1273_fm_set_rx_freq(struc
  
        dev_dbg(radio->dev, "%s: %dkHz\n", __func__, freq);
  
-       wl1273_fm_write_cmd(core, WL1273_INT_MASK_SET, radio->irq_flags);
+       core->write(core, WL1273_INT_MASK_SET, radio->irq_flags);
  
        if (radio->band == WL1273_BAND_JAPAN)
                f = (freq - WL1273_BAND_JAPAN_LOW) / 50;
        else
                f = (freq - WL1273_BAND_OTHER_LOW) / 50;
  
-       r = wl1273_fm_write_cmd(core, WL1273_FREQ_SET, f);
+       r = core->write(core, WL1273_FREQ_SET, f);
        if (r) {
                dev_err(radio->dev, "FREQ_SET fails\n");
                goto err;
        }
  
-       r = wl1273_fm_write_cmd(core, WL1273_TUNER_MODE_SET, TUNER_MODE_PRESET);
+       r = core->write(core, WL1273_TUNER_MODE_SET, TUNER_MODE_PRESET);
        if (r) {
                dev_err(radio->dev, "TUNER_MODE_SET fails\n");
                goto err;
@@@ -609,7 -467,7 +467,7 @@@ static int wl1273_fm_get_freq(struct wl
        int r;
  
        if (core->mode == WL1273_MODE_RX) {
-               r = wl1273_fm_read_reg(core, WL1273_FREQ_SET, &f);
+               r = core->read(core, WL1273_FREQ_SET, &f);
                if (r)
                        return r;
  
                else
                        freq = WL1273_BAND_OTHER_LOW + 50 * f;
        } else {
-               r = wl1273_fm_read_reg(core, WL1273_CHANL_SET, &f);
+               r = core->read(core, WL1273_CHANL_SET, &f);
                if (r)
                        return r;
  
@@@ -670,7 -528,7 +528,7 @@@ static int wl1273_fm_upload_firmware_pa
        }
  
        /* ignore possible error here */
-       wl1273_fm_write_cmd(core, WL1273_RESET, 0);
+       core->write(core, WL1273_RESET, 0);
  
        dev_dbg(dev, "%s - download OK, r: %d\n", __func__, r);
  out:
@@@ -683,14 -541,14 +541,14 @@@ static int wl1273_fm_stop(struct wl1273
        struct wl1273_core *core = radio->core;
  
        if (core->mode == WL1273_MODE_RX) {
-               int r = wl1273_fm_write_cmd(core, WL1273_POWER_SET,
+               int r = core->write(core, WL1273_POWER_SET,
                                    WL1273_POWER_SET_OFF);
                if (r)
                        dev_err(radio->dev, "%s: POWER_SET fails: %d\n",
                                __func__, r);
        } else if (core->mode == WL1273_MODE_TX) {
-               int r = wl1273_fm_write_cmd(core, WL1273_PUPD_SET,
-                                           WL1273_PUPD_SET_OFF);
+               int r = core->write(core, WL1273_PUPD_SET,
+                                   WL1273_PUPD_SET_OFF);
                if (r)
                        dev_err(radio->dev,
                                "%s: PUPD_SET fails: %d\n", __func__, r);
@@@ -725,11 -583,11 +583,11 @@@ static int wl1273_fm_start(struct wl127
                        val |= WL1273_POWER_SET_RDS;
  
                /* If this fails try again */
-               r = wl1273_fm_write_cmd(core, WL1273_POWER_SET, val);
+               r = core->write(core, WL1273_POWER_SET, val);
                if (r) {
                        msleep(100);
  
-                       r = wl1273_fm_write_cmd(core, WL1273_POWER_SET, val);
+                       r = core->write(core, WL1273_POWER_SET, val);
                        if (r) {
                                dev_err(dev, "%s: POWER_SET fails\n", __func__);
                                goto fail;
  
        } else if (new_mode == WL1273_MODE_TX) {
                /* If this fails try again once */
-               r = wl1273_fm_write_cmd(core, WL1273_PUPD_SET,
-                                       WL1273_PUPD_SET_ON);
+               r = core->write(core, WL1273_PUPD_SET, WL1273_PUPD_SET_ON);
                if (r) {
                        msleep(100);
-                       r = wl1273_fm_write_cmd(core, WL1273_PUPD_SET,
+                       r = core->write(core, WL1273_PUPD_SET,
                                        WL1273_PUPD_SET_ON);
                        if (r) {
                                dev_err(dev, "%s: PUPD_SET fails\n", __func__);
                }
  
                if (radio->rds_on)
-                       r = wl1273_fm_write_cmd(core, WL1273_RDS_DATA_ENB, 1);
+                       r = core->write(core, WL1273_RDS_DATA_ENB, 1);
                else
-                       r = wl1273_fm_write_cmd(core, WL1273_RDS_DATA_ENB, 0);
+                       r = core->write(core, WL1273_RDS_DATA_ENB, 0);
        } else {
                dev_warn(dev, "%s: Illegal mode.\n", __func__);
        }
                        if (radio->rds_on)
                                val |= WL1273_POWER_SET_RDS;
  
-                       r = wl1273_fm_write_cmd(core, WL1273_POWER_SET, val);
+                       r = core->write(core, WL1273_POWER_SET, val);
                        if (r) {
                                dev_err(dev, "%s: POWER_SET fails\n", __func__);
                                goto fail;
                        }
                } else if (new_mode == WL1273_MODE_TX) {
-                       r = wl1273_fm_write_cmd(core, WL1273_PUPD_SET,
-                                               WL1273_PUPD_SET_ON);
+                       r = core->write(core, WL1273_PUPD_SET,
+                                       WL1273_PUPD_SET_ON);
                        if (r) {
                                dev_err(dev, "%s: PUPD_SET fails\n", __func__);
                                goto fail;
@@@ -808,10 -665,10 +665,10 @@@ static int wl1273_fm_suspend(struct wl1
  
        /* Cannot go from OFF to SUSPENDED */
        if (core->mode == WL1273_MODE_RX)
-               r = wl1273_fm_write_cmd(core, WL1273_POWER_SET,
+               r = core->write(core, WL1273_POWER_SET,
                                WL1273_POWER_SET_RETENTION);
        else if (core->mode == WL1273_MODE_TX)
-               r = wl1273_fm_write_cmd(core, WL1273_PUPD_SET,
+               r = core->write(core, WL1273_PUPD_SET,
                                WL1273_PUPD_SET_RETENTION);
        else
                r = -EINVAL;
@@@ -852,8 -709,7 +709,7 @@@ static int wl1273_fm_set_mode(struct wl
                }
  
                core->mode = mode;
-               r = wl1273_fm_write_cmd(core, WL1273_INT_MASK_SET,
-                                       radio->irq_flags);
+               r = core->write(core, WL1273_INT_MASK_SET, radio->irq_flags);
                if (r) {
                        dev_err(dev, "INT_MASK_SET fails.\n");
                        goto out;
@@@ -951,22 -807,21 +807,21 @@@ static int wl1273_fm_set_seek(struct wl
        INIT_COMPLETION(radio->busy);
        dev_dbg(radio->dev, "%s: BUSY\n", __func__);
  
-       r = wl1273_fm_write_cmd(core, WL1273_INT_MASK_SET, radio->irq_flags);
+       r = core->write(core, WL1273_INT_MASK_SET, radio->irq_flags);
        if (r)
                goto out;
  
        dev_dbg(radio->dev, "%s\n", __func__);
  
-       r = wl1273_fm_write_cmd(core, WL1273_SEARCH_LVL_SET, level);
+       r = core->write(core, WL1273_SEARCH_LVL_SET, level);
        if (r)
                goto out;
  
-       r = wl1273_fm_write_cmd(core, WL1273_SEARCH_DIR_SET, dir);
+       r = core->write(core, WL1273_SEARCH_DIR_SET, dir);
        if (r)
                goto out;
  
-       r = wl1273_fm_write_cmd(core, WL1273_TUNER_MODE_SET,
-                               TUNER_MODE_AUTO_SEEK);
+       r = core->write(core, WL1273_TUNER_MODE_SET, TUNER_MODE_AUTO_SEEK);
        if (r)
                goto out;
  
        INIT_COMPLETION(radio->busy);
        dev_dbg(radio->dev, "%s: BUSY\n", __func__);
  
-       r = wl1273_fm_write_cmd(core, WL1273_TUNER_MODE_SET,
-                               TUNER_MODE_AUTO_SEEK);
+       r = core->write(core, WL1273_TUNER_MODE_SET, TUNER_MODE_AUTO_SEEK);
        if (r)
                goto out;
  
@@@ -1020,7 -874,7 +874,7 @@@ static unsigned int wl1273_fm_get_tx_ct
            core->mode == WL1273_MODE_SUSPENDED)
                return -EPERM;
  
-       r = wl1273_fm_read_reg(core, WL1273_READ_FMANT_TUNE_VALUE, &val);
+       r = core->read(core, WL1273_READ_FMANT_TUNE_VALUE, &val);
        if (r) {
                dev_err(dev, "%s: read error: %d\n", __func__, r);
                goto out;
@@@ -1066,7 -920,7 +920,7 @@@ static int wl1273_fm_set_preemphasis(st
                goto out;
        }
  
-       r = wl1273_fm_write_cmd(core, WL1273_PREMPH_SET, em);
+       r = core->write(core, WL1273_PREMPH_SET, em);
        if (r)
                goto out;
  
@@@ -1086,7 -940,7 +940,7 @@@ static int wl1273_fm_rds_on(struct wl12
        if (radio->rds_on)
                return 0;
  
-       r = wl1273_fm_write_cmd(core, WL1273_POWER_SET,
+       r = core->write(core, WL1273_POWER_SET,
                        WL1273_POWER_SET_FM | WL1273_POWER_SET_RDS);
        if (r)
                goto out;
@@@ -1108,19 -962,16 +962,16 @@@ static int wl1273_fm_rds_off(struct wl1
  
        radio->irq_flags &= ~WL1273_RDS_EVENT;
  
-       r = wl1273_fm_write_cmd(core, WL1273_INT_MASK_SET, radio->irq_flags);
+       r = core->write(core, WL1273_INT_MASK_SET, radio->irq_flags);
        if (r)
                goto out;
  
-       /* stop rds reception */
-       cancel_delayed_work(&radio->work);
        /* Service pending read */
        wake_up_interruptible(&radio->read_queue);
  
        dev_dbg(radio->dev, "%s\n", __func__);
  
-       r = wl1273_fm_write_cmd(core, WL1273_POWER_SET, WL1273_POWER_SET_FM);
+       r = core->write(core, WL1273_POWER_SET, WL1273_POWER_SET_FM);
        if (r)
                goto out;
  
@@@ -1143,14 -994,14 +994,14 @@@ static int wl1273_fm_set_rds(struct wl1
                return -EPERM;
  
        if (new_mode == WL1273_RDS_RESET) {
-               r = wl1273_fm_write_cmd(core, WL1273_RDS_CNTRL_SET, 1);
+               r = core->write(core, WL1273_RDS_CNTRL_SET, 1);
                return r;
        }
  
        if (core->mode == WL1273_MODE_TX && new_mode == WL1273_RDS_OFF) {
-               r = wl1273_fm_write_cmd(core, WL1273_RDS_DATA_ENB, 0);
+               r = core->write(core, WL1273_RDS_DATA_ENB, 0);
        } else if (core->mode == WL1273_MODE_TX && new_mode == WL1273_RDS_ON) {
-               r = wl1273_fm_write_cmd(core, WL1273_RDS_DATA_ENB, 1);
+               r = core->write(core, WL1273_RDS_DATA_ENB, 1);
        } else if (core->mode == WL1273_MODE_RX && new_mode == WL1273_RDS_OFF) {
                r = wl1273_fm_rds_off(radio);
        } else if (core->mode == WL1273_MODE_RX && new_mode == WL1273_RDS_ON) {
@@@ -1171,12 -1022,13 +1022,13 @@@ static ssize_t wl1273_fm_fops_write(str
                                    size_t count, loff_t *ppos)
  {
        struct wl1273_device *radio = video_get_drvdata(video_devdata(file));
+       struct wl1273_core *core = radio->core;
        u16 val;
        int r;
  
        dev_dbg(radio->dev, "%s\n", __func__);
  
-       if (radio->core->mode != WL1273_MODE_TX)
+       if (core->mode != WL1273_MODE_TX)
                return count;
  
        if (radio->rds_users == 0) {
                return 0;
        }
  
-       if (mutex_lock_interruptible(&radio->core->lock))
+       if (mutex_lock_interruptible(&core->lock))
                return -EINTR;
        /*
         * Multiple processes can open the device, but only
        else
                val = count;
  
-       wl1273_fm_write_cmd(radio->core, WL1273_RDS_CONFIG_DATA_SET, val);
+       core->write(core, WL1273_RDS_CONFIG_DATA_SET, val);
  
        if (copy_from_user(radio->write_buf + 1, buf, val)) {
                r = -EFAULT;
        dev_dbg(radio->dev, "From user: \"%s\"\n", radio->write_buf);
  
        radio->write_buf[0] = WL1273_RDS_DATA_SET;
-       wl1273_fm_write_data(radio->core, radio->write_buf, val + 1);
+       core->write_data(core, radio->write_buf, val + 1);
  
        r = val;
  out:
-       mutex_unlock(&radio->core->lock);
+       mutex_unlock(&core->lock);
  
        return r;
  }
@@@ -1263,8 -1115,8 +1115,8 @@@ static int wl1273_fm_fops_open(struct f
  
                radio->irq_flags |= WL1273_RDS_EVENT;
  
-               r = wl1273_fm_write_cmd(core, WL1273_INT_MASK_SET,
-                                       radio->irq_flags);
+               r = core->write(core, WL1273_INT_MASK_SET,
+                               radio->irq_flags);
                if (r) {
                        mutex_unlock(&core->lock);
                        goto out;
@@@ -1295,9 -1147,9 +1147,9 @@@ static int wl1273_fm_fops_release(struc
                        radio->irq_flags &= ~WL1273_RDS_EVENT;
  
                        if (core->mode == WL1273_MODE_RX) {
-                               r = wl1273_fm_write_cmd(core,
-                                                       WL1273_INT_MASK_SET,
-                                                       radio->irq_flags);
+                               r = core->write(core,
+                                               WL1273_INT_MASK_SET,
+                                               radio->irq_flags);
                                if (r) {
                                        mutex_unlock(&core->lock);
                                        goto out;
@@@ -1324,7 -1176,7 +1176,7 @@@ static ssize_t wl1273_fm_fops_read(stru
  
        dev_dbg(radio->dev, "%s\n", __func__);
  
-       if (radio->core->mode != WL1273_MODE_RX)
+       if (core->mode != WL1273_MODE_RX)
                return 0;
  
        if (radio->rds_users == 0) {
        }
        radio->owner = file;
  
-       r = wl1273_fm_read_reg(core, WL1273_RDS_SYNC_GET, &val);
+       r = core->read(core, WL1273_RDS_SYNC_GET, &val);
        if (r) {
                dev_err(radio->dev, "%s: Get RDS_SYNC fails.\n", __func__);
                goto out;
@@@ -1466,23 -1318,24 +1318,24 @@@ static int wl1273_fm_vidioc_s_input(str
   */
  static int wl1273_fm_set_tx_power(struct wl1273_device *radio, u16 power)
  {
+       struct wl1273_core *core = radio->core;
        int r;
  
-       if (radio->core->mode == WL1273_MODE_OFF ||
-           radio->core->mode == WL1273_MODE_SUSPENDED)
+       if (core->mode == WL1273_MODE_OFF ||
+           core->mode == WL1273_MODE_SUSPENDED)
                return -EPERM;
  
-       mutex_lock(&radio->core->lock);
+       mutex_lock(&core->lock);
  
        /* Convert the dBuV value to chip presentation */
-       r = wl1273_fm_write_cmd(radio->core, WL1273_POWER_LEV_SET, 122 - power);
+       r = core->write(core, WL1273_POWER_LEV_SET, 122 - power);
        if (r)
                goto out;
  
        radio->tx_power = power;
  
  out:
-       mutex_unlock(&radio->core->lock);
+       mutex_unlock(&core->lock);
        return r;
  }
  
  static int wl1273_fm_tx_set_spacing(struct wl1273_device *radio,
                                    unsigned int spacing)
  {
+       struct wl1273_core *core = radio->core;
        int r;
  
        if (spacing == 0) {
-               r = wl1273_fm_write_cmd(radio->core, WL1273_SCAN_SPACING_SET,
-                                       WL1273_SPACING_100kHz);
+               r = core->write(core, WL1273_SCAN_SPACING_SET,
+                               WL1273_SPACING_100kHz);
                radio->spacing = 100;
        } else if (spacing - 50000 < 25000) {
-               r = wl1273_fm_write_cmd(radio->core, WL1273_SCAN_SPACING_SET,
-                                       WL1273_SPACING_50kHz);
+               r = core->write(core, WL1273_SCAN_SPACING_SET,
+                               WL1273_SPACING_50kHz);
                radio->spacing = 50;
        } else if (spacing - 100000 < 50000) {
-               r = wl1273_fm_write_cmd(radio->core, WL1273_SCAN_SPACING_SET,
-                                       WL1273_SPACING_100kHz);
+               r = core->write(core, WL1273_SCAN_SPACING_SET,
+                               WL1273_SPACING_100kHz);
                radio->spacing = 100;
        } else {
-               r = wl1273_fm_write_cmd(radio->core, WL1273_SCAN_SPACING_SET,
-                                       WL1273_SPACING_200kHz);
+               r = core->write(core, WL1273_SCAN_SPACING_SET,
+                               WL1273_SPACING_200kHz);
                radio->spacing = 200;
        }
  
@@@ -1567,17 -1421,17 +1421,17 @@@ static int wl1273_fm_vidioc_s_ctrl(stru
                        return -EINTR;
  
                if (core->mode == WL1273_MODE_RX && ctrl->val)
-                       r = wl1273_fm_write_cmd(core,
-                                               WL1273_MUTE_STATUS_SET,
-                                               WL1273_MUTE_HARD_LEFT |
-                                               WL1273_MUTE_HARD_RIGHT);
+                       r = core->write(core,
+                                       WL1273_MUTE_STATUS_SET,
+                                       WL1273_MUTE_HARD_LEFT |
+                                       WL1273_MUTE_HARD_RIGHT);
                else if (core->mode == WL1273_MODE_RX)
-                       r = wl1273_fm_write_cmd(core,
-                                               WL1273_MUTE_STATUS_SET, 0x0);
+                       r = core->write(core,
+                                       WL1273_MUTE_STATUS_SET, 0x0);
                else if (core->mode == WL1273_MODE_TX && ctrl->val)
-                       r = wl1273_fm_write_cmd(core, WL1273_MUTE, 1);
+                       r = core->write(core, WL1273_MUTE, 1);
                else if (core->mode == WL1273_MODE_TX)
-                       r = wl1273_fm_write_cmd(core, WL1273_MUTE, 0);
+                       r = core->write(core, WL1273_MUTE, 0);
  
                mutex_unlock(&core->lock);
                break;
@@@ -1672,7 -1526,7 +1526,7 @@@ static int wl1273_fm_vidioc_g_tuner(str
        if (mutex_lock_interruptible(&core->lock))
                return -EINTR;
  
-       r = wl1273_fm_read_reg(core, WL1273_STEREO_GET, &val);
+       r = core->read(core, WL1273_STEREO_GET, &val);
        if (r)
                goto out;
  
        else
                tuner->rxsubchans = V4L2_TUNER_SUB_MONO;
  
-       r = wl1273_fm_read_reg(core, WL1273_RSSI_LVL_GET, &val);
+       r = core->read(core, WL1273_RSSI_LVL_GET, &val);
        if (r)
                goto out;
  
  
        tuner->afc = 0;
  
-       r = wl1273_fm_read_reg(core, WL1273_RDS_SYNC_GET, &val);
+       r = core->read(core, WL1273_RDS_SYNC_GET, &val);
        if (r)
                goto out;
  
@@@ -1736,8 -1590,7 +1590,7 @@@ static int wl1273_fm_vidioc_s_tuner(str
                dev_warn(radio->dev, "%s: RDS fails: %d\n", __func__, r);
  
        if (tuner->audmode == V4L2_TUNER_MODE_MONO) {
-               r = wl1273_fm_write_cmd(core, WL1273_MOST_MODE_SET,
-                                       WL1273_RX_MONO);
+               r = core->write(core, WL1273_MOST_MODE_SET, WL1273_RX_MONO);
                if (r < 0) {
                        dev_warn(radio->dev, "%s: MOST_MODE fails: %d\n",
                                 __func__, r);
                }
                radio->stereo = false;
        } else if (tuner->audmode == V4L2_TUNER_MODE_STEREO) {
-               r = wl1273_fm_write_cmd(core, WL1273_MOST_MODE_SET,
-                                       WL1273_RX_STEREO);
+               r = core->write(core, WL1273_MOST_MODE_SET, WL1273_RX_STEREO);
                if (r < 0) {
                        dev_warn(radio->dev, "%s: MOST_MODE fails: %d\n",
                                 __func__, r);
@@@ -1885,10 -1737,10 +1737,10 @@@ static int wl1273_fm_vidioc_s_modulator
                r = wl1273_fm_set_rds(radio, WL1273_RDS_OFF);
  
        if (modulator->txsubchans & V4L2_TUNER_SUB_MONO)
-               r = wl1273_fm_write_cmd(core, WL1273_MONO_SET, WL1273_TX_MONO);
+               r = core->write(core, WL1273_MONO_SET, WL1273_TX_MONO);
        else
-               r = wl1273_fm_write_cmd(core, WL1273_MONO_SET,
-                                       WL1273_RX_STEREO);
+               r = core->write(core, WL1273_MONO_SET,
+                               WL1273_RX_STEREO);
        if (r < 0)
                dev_warn(radio->dev, WL1273_FM_DRIVER_NAME
                         "MONO_SET fails: %d\n", r);
@@@ -1923,7 -1775,7 +1775,7 @@@ static int wl1273_fm_vidioc_g_modulator
        if (mutex_lock_interruptible(&core->lock))
                return -EINTR;
  
-       r = wl1273_fm_read_reg(core, WL1273_MONO_SET, &val);
+       r = core->read(core, WL1273_MONO_SET, &val);
        if (r)
                goto out;
  
@@@ -1960,38 -1812,38 +1812,38 @@@ static int wl1273_fm_vidioc_log_status(
                return 0;
        }
  
-       r = wl1273_fm_read_reg(core, WL1273_ASIC_ID_GET, &val);
+       r = core->read(core, WL1273_ASIC_ID_GET, &val);
        if (r)
                dev_err(dev, "%s: Get ASIC_ID fails.\n", __func__);
        else
                dev_info(dev, "ASIC_ID: 0x%04x\n", val);
  
-       r = wl1273_fm_read_reg(core, WL1273_ASIC_VER_GET, &val);
+       r = core->read(core, WL1273_ASIC_VER_GET, &val);
        if (r)
                dev_err(dev, "%s: Get ASIC_VER fails.\n", __func__);
        else
                dev_info(dev, "ASIC Version: 0x%04x\n", val);
  
-       r = wl1273_fm_read_reg(core, WL1273_FIRM_VER_GET, &val);
+       r = core->read(core, WL1273_FIRM_VER_GET, &val);
        if (r)
                dev_err(dev, "%s: Get FIRM_VER fails.\n", __func__);
        else
                dev_info(dev, "FW version: %d(0x%04x)\n", val, val);
  
-       r = wl1273_fm_read_reg(core, WL1273_BAND_SET, &val);
+       r = core->read(core, WL1273_BAND_SET, &val);
        if (r)
                dev_err(dev, "%s: Get BAND fails.\n", __func__);
        else
                dev_info(dev, "BAND: %d\n", val);
  
        if (core->mode == WL1273_MODE_TX) {
-               r = wl1273_fm_read_reg(core, WL1273_PUPD_SET, &val);
+               r = core->read(core, WL1273_PUPD_SET, &val);
                if (r)
                        dev_err(dev, "%s: Get PUPD fails.\n", __func__);
                else
                        dev_info(dev, "PUPD: 0x%04x\n", val);
  
-               r = wl1273_fm_read_reg(core, WL1273_CHANL_SET, &val);
+               r = core->read(core, WL1273_CHANL_SET, &val);
                if (r)
                        dev_err(dev, "%s: Get CHANL fails.\n", __func__);
                else
        } else if (core->mode == WL1273_MODE_RX) {
                int bf = radio->rangelow;
  
-               r = wl1273_fm_read_reg(core, WL1273_FREQ_SET, &val);
+               r = core->read(core, WL1273_FREQ_SET, &val);
                if (r)
                        dev_err(dev, "%s: Get FREQ fails.\n", __func__);
                else
                        dev_info(dev, "RX Frequency: %dkHz\n", bf + val*50);
  
-               r = wl1273_fm_read_reg(core, WL1273_MOST_MODE_SET, &val);
+               r = core->read(core, WL1273_MOST_MODE_SET, &val);
                if (r)
                        dev_err(dev, "%s: Get MOST_MODE fails.\n",
                                __func__);
                else
                        dev_info(dev, "MOST_MODE: Unexpected value: %d\n", val);
  
-               r = wl1273_fm_read_reg(core, WL1273_MOST_BLEND_SET, &val);
+               r = core->read(core, WL1273_MOST_BLEND_SET, &val);
                if (r)
                        dev_err(dev, "%s: Get MOST_BLEND fails.\n", __func__);
                else if (val == 0)
                else
                        dev_info(dev, "MOST_BLEND: Unexpected val: %d\n", val);
  
-               r = wl1273_fm_read_reg(core, WL1273_STEREO_GET, &val);
+               r = core->read(core, WL1273_STEREO_GET, &val);
                if (r)
                        dev_err(dev, "%s: Get STEREO fails.\n", __func__);
                else if (val == 0)
                else
                        dev_info(dev, "STEREO: Unexpected value: %d\n", val);
  
-               r = wl1273_fm_read_reg(core, WL1273_RSSI_LVL_GET, &val);
+               r = core->read(core, WL1273_RSSI_LVL_GET, &val);
                if (r)
                        dev_err(dev, "%s: Get RSSI_LVL fails.\n", __func__);
                else
                        dev_info(dev, "RX signal strength: %d\n", (s16) val);
  
-               r = wl1273_fm_read_reg(core, WL1273_POWER_SET, &val);
+               r = core->read(core, WL1273_POWER_SET, &val);
                if (r)
                        dev_err(dev, "%s: Get POWER fails.\n", __func__);
                else
                        dev_info(dev, "POWER: 0x%04x\n", val);
  
-               r = wl1273_fm_read_reg(core, WL1273_INT_MASK_SET, &val);
+               r = core->read(core, WL1273_INT_MASK_SET, &val);
                if (r)
                        dev_err(dev, "%s: Get INT_MASK fails.\n", __func__);
                else
                        dev_info(dev, "INT_MASK: 0x%04x\n", val);
  
-               r = wl1273_fm_read_reg(core, WL1273_RDS_SYNC_GET, &val);
+               r = core->read(core, WL1273_RDS_SYNC_GET, &val);
                if (r)
                        dev_err(dev, "%s: Get RDS_SYNC fails.\n",
                                __func__);
                else
                        dev_info(dev, "RDS_SYNC: Unexpected value: %d\n", val);
  
-               r = wl1273_fm_read_reg(core, WL1273_I2S_MODE_CONFIG_SET, &val);
+               r = core->read(core, WL1273_I2S_MODE_CONFIG_SET, &val);
                if (r)
                        dev_err(dev, "%s: Get I2S_MODE_CONFIG fails.\n",
                                __func__);
                else
                        dev_info(dev, "I2S_MODE_CONFIG: 0x%04x\n", val);
  
-               r = wl1273_fm_read_reg(core, WL1273_VOLUME_SET, &val);
+               r = core->read(core, WL1273_VOLUME_SET, &val);
                if (r)
                        dev_err(dev, "%s: Get VOLUME fails.\n", __func__);
                else
@@@ -2138,7 -1990,7 +1990,7 @@@ static int wl1273_fm_radio_remove(struc
  
  static int __devinit wl1273_fm_radio_probe(struct platform_device *pdev)
  {
 -      struct wl1273_core **core = pdev->dev.platform_data;
 +      struct wl1273_core **core = mfd_get_data(pdev);
        struct wl1273_device *radio;
        struct v4l2_ctrl *ctrl;
        int r = 0;
        radio->stereo = true;
        radio->bus_type = "I2C";
  
-       radio->core->write = wl1273_fm_write_cmd;
-       radio->core->set_audio = wl1273_fm_set_audio;
-       radio->core->set_volume = wl1273_fm_set_volume;
        if (radio->core->pdata->request_resources) {
                r = radio->core->pdata->request_resources(radio->core->client);
                if (r) {
@@@ -2319,7 -2167,6 +2167,6 @@@ module_init(wl1273_fm_module_init)
  
  static void __exit wl1273_fm_module_exit(void)
  {
-       flush_scheduled_work();
        platform_driver_unregister(&wl1273_fm_radio_driver);
        pr_info(DRIVER_DESC ", Exiting.\n");
  }
diff --combined drivers/mfd/Kconfig
index 8d7d098f7a039599d6a3455945dfc3d322894a49,9db079be0e08f6bd4ff9657d0535d54c3353e01e..a9a1af49281eea983265c3084c6a1f8bed1585a9
@@@ -81,17 -81,6 +81,17 @@@ config MFD_DM355EVM_MS
          boards.  MSP430 firmware manages resets and power sequencing,
          inputs from buttons and the IR remote, LEDs, an RTC, and more.
  
 +config MFD_TI_SSP
 +      tristate "TI Sequencer Serial Port support"
 +      depends on ARCH_DAVINCI_TNETV107X
 +      select MFD_CORE
 +      ---help---
 +        Say Y here if you want support for the Sequencer Serial Port
 +        in a Texas Instruments TNETV107X SoC.
 +
 +        To compile this driver as a module, choose M here: the
 +        module will be called ti-ssp.
 +
  config HTC_EGPIO
        bool "HTC EGPIO support"
        depends on GENERIC_HARDIRQS && GPIOLIB && ARM
@@@ -129,17 -118,6 +129,17 @@@ config UCB1400_COR
          To compile this driver as a module, choose M here: the
          module will be called ucb1400_core.
  
 +config TPS6105X
 +      tristate "TPS61050/61052 Boost Converters"
 +      depends on I2C
 +      select REGULATOR
 +      select REGULATOR_FIXED_VOLTAGE
 +      help
 +        This option enables a driver for the TP61050/TPS61052
 +        high-power "white LED driver". This boost converter is
 +        sometimes used for other things than white LEDs, and
 +        also contains a GPIO pin.
 +
  config TPS65010
        tristate "TPS6501x Power Management chips"
        depends on I2C && GPIOLIB
@@@ -189,16 -167,6 +189,16 @@@ config TWL4030_COR
          high speed USB OTG transceiver, an audio codec (on most
          versions) and many other features.
  
 +config TWL4030_MADC
 +      tristate "Texas Instruments TWL4030 MADC"
 +      depends on TWL4030_CORE
 +      help
 +      This driver provides support for triton TWL4030-MADC. The
 +      driver supports both RT and SW conversion methods.
 +
 +      This driver can be built as a module. If so it will be
 +      named twl4030-madc
 +
  config TWL4030_POWER
        bool "Support power resources on TWL4030 family chips"
        depends on TWL4030_CORE && ARM
@@@ -325,18 -293,6 +325,18 @@@ config MFD_MAX892
          accessing the device, additional drivers must be enabled in order
          to use the functionality of the device.
  
 +config MFD_MAX8997
 +      bool "Maxim Semiconductor MAX8997/8966 PMIC Support"
 +      depends on I2C=y && GENERIC_HARDIRQS
 +      select MFD_CORE
 +      help
 +        Say yes here to support for Maxim Semiconductor MAX8998/8966.
 +        This is a Power Management IC with RTC, Flash, Fuel Gauge, Haptic,
 +        MUIC controls on chip.
 +        This driver provides common support for accessing the device;
 +        additional drivers must be enabled in order to use the functionality
 +        of the device.
 +
  config MFD_MAX8998
        bool "Maxim Semiconductor MAX8998/National LP3974 PMIC Support"
        depends on I2C=y && GENERIC_HARDIRQS
@@@ -567,13 -523,6 +567,13 @@@ config AB8500_DEBU
           Select this option if you want debug information using the debug
           filesystem, debugfs.
  
 +config AB8500_GPADC
 +      bool "AB8500 GPADC driver"
 +      depends on AB8500_CORE && REGULATOR_AB8500
 +      default y
 +      help
 +        AB8500 GPADC driver used to convert Acc and battery/ac/usb voltage
 +
  config AB3550_CORE
          bool "ST-Ericsson AB3550 Mixed Signal Circuit core functions"
        select MFD_CORE
@@@ -666,7 -615,7 +666,7 @@@ config MFD_VX85
          and/or vx855_gpio drivers for this to do anything useful.
  
  config MFD_WL1273_CORE
-       tristate
+       tristate "Support for TI WL1273 FM radio."
        depends on I2C
        select MFD_CORE
        default n
          driver connects the radio-wl1273 V4L2 module and the wl1273
          audio codec.
  
 +config MFD_OMAP_USB_HOST
 +      bool "Support OMAP USBHS core driver"
 +      depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
 +      default y
 +      help
 +        This is the core driver for the OAMP EHCI and OHCI drivers.
 +        This MFD driver does the required setup functionalities for
 +        OMAP USB Host drivers.
 +
  endif # MFD_SUPPORT
  
  menu "Multimedia Capabilities Port drivers"
index 529d65ba5353bd58de151ffe876355ad900c62ba,4025a4bec8d54601b89dc7f93de5a9ff2398637d..f76f6c798046434baeb0dddea523de6b05158d0a
@@@ -1,7 -1,7 +1,7 @@@
  /*
   * MFD driver for wl1273 FM radio and audio codec submodules.
   *
-  * Copyright (C) 2010 Nokia Corporation
+  * Copyright (C) 2011 Nokia Corporation
   * Author: Matti Aaltonen <[email protected]>
   *
   * This program is free software; you can redistribute it and/or modify
@@@ -31,6 -31,145 +31,145 @@@ static struct i2c_device_id wl1273_driv
  };
  MODULE_DEVICE_TABLE(i2c, wl1273_driver_id_table);
  
+ static int wl1273_fm_read_reg(struct wl1273_core *core, u8 reg, u16 *value)
+ {
+       struct i2c_client *client = core->client;
+       u8 b[2];
+       int r;
+       r = i2c_smbus_read_i2c_block_data(client, reg, sizeof(b), b);
+       if (r != 2) {
+               dev_err(&client->dev, "%s: Read: %d fails.\n", __func__, reg);
+               return -EREMOTEIO;
+       }
+       *value = (u16)b[0] << 8 | b[1];
+       return 0;
+ }
+ static int wl1273_fm_write_cmd(struct wl1273_core *core, u8 cmd, u16 param)
+ {
+       struct i2c_client *client = core->client;
+       u8 buf[] = { (param >> 8) & 0xff, param & 0xff };
+       int r;
+       r = i2c_smbus_write_i2c_block_data(client, cmd, sizeof(buf), buf);
+       if (r) {
+               dev_err(&client->dev, "%s: Cmd: %d fails.\n", __func__, cmd);
+               return r;
+       }
+       return 0;
+ }
+ static int wl1273_fm_write_data(struct wl1273_core *core, u8 *data, u16 len)
+ {
+       struct i2c_client *client = core->client;
+       struct i2c_msg msg;
+       int r;
+       msg.addr = client->addr;
+       msg.flags = 0;
+       msg.buf = data;
+       msg.len = len;
+       r = i2c_transfer(client->adapter, &msg, 1);
+       if (r != 1) {
+               dev_err(&client->dev, "%s: write error.\n", __func__);
+               return -EREMOTEIO;
+       }
+       return 0;
+ }
+ /**
+  * wl1273_fm_set_audio() -    Set audio mode.
+  * @core:                     A pointer to the device struct.
+  * @new_mode:                 The new audio mode.
+  *
+  * Audio modes are WL1273_AUDIO_DIGITAL and WL1273_AUDIO_ANALOG.
+  */
+ static int wl1273_fm_set_audio(struct wl1273_core *core, unsigned int new_mode)
+ {
+       int r = 0;
+       if (core->mode == WL1273_MODE_OFF ||
+           core->mode == WL1273_MODE_SUSPENDED)
+               return -EPERM;
+       if (core->mode == WL1273_MODE_RX && new_mode == WL1273_AUDIO_DIGITAL) {
+               r = wl1273_fm_write_cmd(core, WL1273_PCM_MODE_SET,
+                                       WL1273_PCM_DEF_MODE);
+               if (r)
+                       goto out;
+               r = wl1273_fm_write_cmd(core, WL1273_I2S_MODE_CONFIG_SET,
+                                       core->i2s_mode);
+               if (r)
+                       goto out;
+               r = wl1273_fm_write_cmd(core, WL1273_AUDIO_ENABLE,
+                                       WL1273_AUDIO_ENABLE_I2S);
+               if (r)
+                       goto out;
+       } else if (core->mode == WL1273_MODE_RX &&
+                  new_mode == WL1273_AUDIO_ANALOG) {
+               r = wl1273_fm_write_cmd(core, WL1273_AUDIO_ENABLE,
+                                       WL1273_AUDIO_ENABLE_ANALOG);
+               if (r)
+                       goto out;
+       } else if (core->mode == WL1273_MODE_TX &&
+                  new_mode == WL1273_AUDIO_DIGITAL) {
+               r = wl1273_fm_write_cmd(core, WL1273_I2S_MODE_CONFIG_SET,
+                                       core->i2s_mode);
+               if (r)
+                       goto out;
+               r = wl1273_fm_write_cmd(core, WL1273_AUDIO_IO_SET,
+                                       WL1273_AUDIO_IO_SET_I2S);
+               if (r)
+                       goto out;
+       } else if (core->mode == WL1273_MODE_TX &&
+                  new_mode == WL1273_AUDIO_ANALOG) {
+               r = wl1273_fm_write_cmd(core, WL1273_AUDIO_IO_SET,
+                                       WL1273_AUDIO_IO_SET_ANALOG);
+               if (r)
+                       goto out;
+       }
+       core->audio_mode = new_mode;
+ out:
+       return r;
+ }
+ /**
+  * wl1273_fm_set_volume() -   Set volume.
+  * @core:                     A pointer to the device struct.
+  * @volume:                   The new volume value.
+  */
+ static int wl1273_fm_set_volume(struct wl1273_core *core, unsigned int volume)
+ {
+       u16 val;
+       int r;
+       if (volume > WL1273_MAX_VOLUME)
+               return -EINVAL;
+       if (core->volume == volume)
+               return 0;
+       r = wl1273_fm_write_cmd(core, WL1273_VOLUME_SET, volume);
+       if (r)
+               return r;
+       core->volume = volume;
+       return 0;
+ }
  static int wl1273_core_remove(struct i2c_client *client)
  {
        struct wl1273_core *core = i2c_get_clientdata(client);
@@@ -78,15 -217,23 +217,21 @@@ static int __devinit wl1273_core_probe(
  
        cell = &core->cells[children];
        cell->name = "wl1273_fm_radio";
 -      cell->platform_data = &core;
 -      cell->data_size = sizeof(core);
 +      cell->mfd_data = &core;
        children++;
  
+       core->read = wl1273_fm_read_reg;
+       core->write = wl1273_fm_write_cmd;
+       core->write_data = wl1273_fm_write_data;
+       core->set_audio = wl1273_fm_set_audio;
+       core->set_volume = wl1273_fm_set_volume;
        if (pdata->children & WL1273_CODEC_CHILD) {
                cell = &core->cells[children];
  
                dev_dbg(&client->dev, "%s: Have codec.\n", __func__);
                cell->name = "wl1273-codec";
 -              cell->platform_data = &core;
 -              cell->data_size = sizeof(core);
 +              cell->mfd_data = &core;
                children++;
        }
  
diff --combined drivers/staging/Kconfig
index ccaa2009414b9404c567a812c85c3fba2aea66cd,74a8b272154fc6b23b1af996c95fa8fa3f5b0f4a..18b43fcb4171bc267585bf90dc133c2dd57a1f4c
@@@ -41,10 -41,6 +41,10 @@@ config STAGING_EXCLUDE_BUIL
  
  if !STAGING_EXCLUDE_BUILD
  
 +source "drivers/staging/tty/Kconfig"
 +
 +source "drivers/staging/generic_serial/Kconfig"
 +
  source "drivers/staging/et131x/Kconfig"
  
  source "drivers/staging/slicoss/Kconfig"
@@@ -55,11 -51,7 +55,7 @@@ source "drivers/staging/cx25821/Kconfig
  
  source "drivers/staging/tm6000/Kconfig"
  
- source "drivers/staging/dabusb/Kconfig"
- source "drivers/staging/se401/Kconfig"
- source "drivers/staging/usbvideo/Kconfig"
+ source "drivers/staging/cxd2099/Kconfig"
  
  source "drivers/staging/usbip/Kconfig"
  
@@@ -91,12 -83,12 +87,12 @@@ source "drivers/staging/rtl8192e/Kconfi
  
  source "drivers/staging/rtl8712/Kconfig"
  
 +source "drivers/staging/rts_pstor/Kconfig"
 +
  source "drivers/staging/frontier/Kconfig"
  
  source "drivers/staging/pohmelfs/Kconfig"
  
 -source "drivers/staging/autofs/Kconfig"
 -
  source "drivers/staging/phison/Kconfig"
  
  source "drivers/staging/line6/Kconfig"
@@@ -131,8 -123,6 +127,8 @@@ source "drivers/staging/cs5535_gpio/Kco
  
  source "drivers/staging/zram/Kconfig"
  
 +source "drivers/staging/zcache/Kconfig"
 +
  source "drivers/staging/wlags49_h2/Kconfig"
  
  source "drivers/staging/wlags49_h25/Kconfig"
@@@ -147,12 -137,16 +143,12 @@@ source "drivers/staging/crystalhd/Kconf
  
  source "drivers/staging/cxt1e1/Kconfig"
  
 -source "drivers/staging/ti-st/Kconfig"
 -
  source "drivers/staging/xgifb/Kconfig"
  
  source "drivers/staging/msm/Kconfig"
  
  source "drivers/staging/lirc/Kconfig"
  
 -source "drivers/staging/smbfs/Kconfig"
 -
  source "drivers/staging/easycap/Kconfig"
  
  source "drivers/staging/solo6x10/Kconfig"
@@@ -181,7 -175,7 +177,9 @@@ source "drivers/staging/cptm1217/Kconfi
  
  source "drivers/staging/ste_rmi4/Kconfig"
  
 +source "drivers/staging/gma500/Kconfig"
 +
+ source "drivers/staging/altera-stapl/Kconfig"
  endif # !STAGING_EXCLUDE_BUILD
  endif # STAGING
diff --combined drivers/staging/Makefile
index 3b223cbf86b4e5608692754e76a8d8348e24f535,9f50ec90f9d831f4d27e0e0b290d7d14080c1501..cfd13cd55efbb96778c190299c8e0850a784adc1
@@@ -3,16 -3,12 +3,14 @@@
  # fix for build system bug...
  obj-$(CONFIG_STAGING)         += staging.o
  
 +obj-y += tty/
 +obj-y += generic_serial/
  obj-$(CONFIG_ET131X)          += et131x/
  obj-$(CONFIG_SLICOSS)         += slicoss/
  obj-$(CONFIG_VIDEO_GO7007)    += go7007/
  obj-$(CONFIG_VIDEO_CX25821)   += cx25821/
  obj-$(CONFIG_VIDEO_TM6000)    += tm6000/
- obj-$(CONFIG_USB_DABUSB)        += dabusb/
- obj-$(CONFIG_USB_VICAM)         += usbvideo/
- obj-$(CONFIG_USB_SE401)         += se401/
+ obj-$(CONFIG_DVB_CXD2099)     += cxd2099/
  obj-$(CONFIG_LIRC_STAGING)    += lirc/
  obj-$(CONFIG_USB_IP_COMMON)   += usbip/
  obj-$(CONFIG_W35UND)          += winbond/
@@@ -29,13 -25,14 +27,13 @@@ obj-$(CONFIG_R8187SE)              += rtl8187se
  obj-$(CONFIG_RTL8192U)                += rtl8192u/
  obj-$(CONFIG_RTL8192E)                += rtl8192e/
  obj-$(CONFIG_R8712U)          += rtl8712/
 +obj-$(CONFIG_RTS_PSTOR)               += rts_pstor/
  obj-$(CONFIG_SPECTRA)         += spectra/
  obj-$(CONFIG_TRANZPORT)               += frontier/
  obj-$(CONFIG_POHMELFS)                += pohmelfs/
 -obj-$(CONFIG_AUTOFS_FS)               += autofs/
  obj-$(CONFIG_IDE_PHISON)      += phison/
  obj-$(CONFIG_LINE6_USB)               += line6/
  obj-$(CONFIG_USB_SERIAL_QUATECH2)     += serqt_usb2/
 -obj-$(CONFIG_SMB_FS)          += smbfs/
  obj-$(CONFIG_USB_SERIAL_QUATECH_USB2) += quatech_usb2/
  obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
  obj-$(CONFIG_VT6655)          += vt6655/
@@@ -47,8 -44,6 +45,8 @@@ obj-$(CONFIG_DX_SEP)            += sep
  obj-$(CONFIG_IIO)             += iio/
  obj-$(CONFIG_CS5535_GPIO)     += cs5535_gpio/
  obj-$(CONFIG_ZRAM)            += zram/
 +obj-$(CONFIG_XVMALLOC)                += zram/
 +obj-$(CONFIG_ZCACHE)          += zcache/
  obj-$(CONFIG_WLAGS49_H2)      += wlags49_h2/
  obj-$(CONFIG_WLAGS49_H25)     += wlags49_h25/
  obj-$(CONFIG_SAMSUNG_LAPTOP)  += samsung-laptop/
@@@ -56,6 -51,7 +54,6 @@@ obj-$(CONFIG_FB_SM7XX)                += sm7xx
  obj-$(CONFIG_VIDEO_DT3155)    += dt3155v4l/
  obj-$(CONFIG_CRYSTALHD)               += crystalhd/
  obj-$(CONFIG_CXT1E1)          += cxt1e1/
 -obj-$(CONFIG_TI_ST)           += ti-st/
  obj-$(CONFIG_FB_XGI)          += xgifb/
  obj-$(CONFIG_MSM_STAGING)     += msm/
  obj-$(CONFIG_EASYCAP)         += easycap/
@@@ -63,13 -59,13 +61,14 @@@ obj-$(CONFIG_SOLO6X10)             += solo6x10
  obj-$(CONFIG_TIDSPBRIDGE)     += tidspbridge/
  obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/
  obj-$(CONFIG_WESTBRIDGE_ASTORIA)      += westbridge/astoria/
 -obj-$(CONFIG_SBE_2T3E3)       += sbe-2t3e3/
 +obj-$(CONFIG_SBE_2T3E3)               += sbe-2t3e3/
  obj-$(CONFIG_ATH6K_LEGACY)    += ath6kl/
  obj-$(CONFIG_USB_ENESTORAGE)  += keucr/
 -obj-$(CONFIG_BCM_WIMAX)       += bcm/
 +obj-$(CONFIG_BCM_WIMAX)               += bcm/
  obj-$(CONFIG_FT1000)          += ft1000/
 -obj-$(CONFIG_SND_INTEL_SST)           += intel_sst/
 -obj-$(CONFIG_SPEAKUP) += speakup/
 +obj-$(CONFIG_SND_INTEL_SST)   += intel_sst/
 +obj-$(CONFIG_SPEAKUP)         += speakup/
+ obj-$(CONFIG_ALTERA_STAPL)    +=altera-stapl/
  obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217)     += cptm1217/
  obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4)  += ste_rmi4/
 +obj-$(CONFIG_DRM_PSB)         += gma500/
index 28a28e02c9ce14df3d55ad06f5b54e48f67cbd0d,7ac43da4e252650053d8c9170ee62b5e083aba42..b3bd11d5879f67d1b42ba1907d31e829a361db56
  */
  /*****************************************************************************/
  
 -#include <linux/smp_lock.h>
  #include "easycap.h"
 -#include "easycap_debug.h"
 -#include "easycap_standard.h"
 -#include "easycap_ioctl.h"
  
  /*--------------------------------------------------------------------------*/
  /*
  /*---------------------------------------------------------------------------*/
  int adjust_standard(struct easycap *peasycap, v4l2_std_id std_id)
  {
 -struct easycap_standard const *peasycap_standard;
 -__u16 reg, set;
 -int ir, rc, need, k;
 -unsigned int itwas, isnow;
 -bool resubmit;
 -
 -if (NULL == peasycap) {
 -      SAY("ERROR: peasycap is NULL\n");
 -      return -EFAULT;
 -}
 -if ((struct usb_device *)NULL == peasycap->pusb_device) {
 -      SAM("ERROR: peasycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -peasycap_standard = &easycap_standard[0];
 -while (0xFFFF != peasycap_standard->mask) {
 -      if (std_id == peasycap_standard->v4l2_standard.id)
 -              break;
 -      peasycap_standard++;
 -}
 -if (0xFFFF == peasycap_standard->mask) {
 +      struct easycap_standard const *peasycap_standard;
 +      u16 reg, set;
 +      int ir, rc, need, k;
 +      unsigned int itwas, isnow;
 +      bool resubmit;
 +
 +      if (!peasycap) {
 +              SAY("ERROR: peasycap is NULL\n");
 +              return -EFAULT;
 +      }
 +      if (!peasycap->pusb_device) {
 +              SAM("ERROR: peasycap->pusb_device is NULL\n");
 +              return -EFAULT;
 +      }
        peasycap_standard = &easycap_standard[0];
        while (0xFFFF != peasycap_standard->mask) {
 -              if (std_id & peasycap_standard->v4l2_standard.id)
 +              if (std_id == peasycap_standard->v4l2_standard.id)
                        break;
                peasycap_standard++;
        }
 -}
 -if (0xFFFF == peasycap_standard->mask) {
 -      SAM("ERROR: 0x%08X=std_id: standard not found\n", \
 -                                                      (unsigned int)std_id);
 -      return -EINVAL;
 -}
 -SAM("selected standard: %s\n", \
 -                      &(peasycap_standard->v4l2_standard.name[0]));
 -if (peasycap->standard_offset == \
 -                      (int)(peasycap_standard - &easycap_standard[0])) {
 -      SAM("requested standard already in effect\n");
 -      return 0;
 -}
 -peasycap->standard_offset = (int)(peasycap_standard - &easycap_standard[0]);
 -for (k = 0; k < INPUT_MANY;  k++) {
 -      if (!peasycap->inputset[k].standard_offset_ok) {
 -                      peasycap->inputset[k].standard_offset = \
 -                                              peasycap->standard_offset;
 +      if (0xFFFF == peasycap_standard->mask) {
 +              peasycap_standard = &easycap_standard[0];
 +              while (0xFFFF != peasycap_standard->mask) {
 +                      if (std_id & peasycap_standard->v4l2_standard.id)
 +                              break;
 +                      peasycap_standard++;
 +              }
        }
 -}
 -if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 -      peasycap->inputset[peasycap->input].standard_offset = \
 -                                              peasycap->standard_offset;
 -      peasycap->inputset[peasycap->input].standard_offset_ok = 1;
 -} else
 -      JOM(8, "%i=peasycap->input\n", peasycap->input);
 -peasycap->fps = peasycap_standard->v4l2_standard.frameperiod.denominator / \
 -              peasycap_standard->v4l2_standard.frameperiod.numerator;
 -switch (peasycap->fps) {
 -case 6:
 -case 30: {
 -      peasycap->ntsc = true;
 -      break;
 -}
 -case 5:
 -case 25: {
 -      peasycap->ntsc = false;
 -      break;
 -}
 -default: {
 -      SAM("MISTAKE: %i=frames-per-second\n", peasycap->fps);
 -      return -ENOENT;
 -}
 -}
 -JOM(8, "%i frames-per-second\n", peasycap->fps);
 -if (0x8000 & peasycap_standard->mask) {
 -      peasycap->skip = 5;
 -      peasycap->usec = 1000000 / (2 * (5 * peasycap->fps));
 -      peasycap->tolerate = 1000 * (25 / (5 * peasycap->fps));
 -} else {
 -      peasycap->skip = 0;
 -      peasycap->usec = 1000000 / (2 * peasycap->fps);
 -      peasycap->tolerate = 1000 * (25 / peasycap->fps);
 -}
 -if (peasycap->video_isoc_streaming) {
 -      resubmit = true;
 -      kill_video_urbs(peasycap);
 -} else
 -      resubmit = false;
 +      if (0xFFFF == peasycap_standard->mask) {
 +              SAM("ERROR: 0x%08X=std_id: standard not found\n",
 +                  (unsigned int)std_id);
 +              return -EINVAL;
 +      }
 +      SAM("selected standard: %s\n",
 +          &(peasycap_standard->v4l2_standard.name[0]));
 +      if (peasycap->standard_offset == peasycap_standard - easycap_standard) {
 +              SAM("requested standard already in effect\n");
 +              return 0;
 +      }
 +      peasycap->standard_offset = peasycap_standard - easycap_standard;
 +      for (k = 0; k < INPUT_MANY;  k++) {
 +              if (!peasycap->inputset[k].standard_offset_ok) {
 +                      peasycap->inputset[k].standard_offset =
 +                              peasycap->standard_offset;
 +              }
 +      }
 +      if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 +              peasycap->inputset[peasycap->input].standard_offset =
 +                      peasycap->standard_offset;
 +              peasycap->inputset[peasycap->input].standard_offset_ok = 1;
 +      } else
 +              JOM(8, "%i=peasycap->input\n", peasycap->input);
 +
 +      peasycap->fps = peasycap_standard->v4l2_standard.frameperiod.denominator /
 +                      peasycap_standard->v4l2_standard.frameperiod.numerator;
 +      switch (peasycap->fps) {
 +      case 6:
 +      case 30: {
 +              peasycap->ntsc = true;
 +              break;
 +      }
 +      case 5:
 +      case 25: {
 +              peasycap->ntsc = false;
 +              break;
 +      }
 +      default: {
 +              SAM("MISTAKE: %i=frames-per-second\n", peasycap->fps);
 +              return -ENOENT;
 +      }
 +      }
 +      JOM(8, "%i frames-per-second\n", peasycap->fps);
 +      if (0x8000 & peasycap_standard->mask) {
 +              peasycap->skip = 5;
 +              peasycap->usec = 1000000 / (2 * (5 * peasycap->fps));
 +              peasycap->tolerate = 1000 * (25 / (5 * peasycap->fps));
 +      } else {
 +              peasycap->skip = 0;
 +              peasycap->usec = 1000000 / (2 * peasycap->fps);
 +              peasycap->tolerate = 1000 * (25 / peasycap->fps);
 +      }
 +      if (peasycap->video_isoc_streaming) {
 +              resubmit = true;
 +              kill_video_urbs(peasycap);
 +      } else
 +              resubmit = false;
  /*--------------------------------------------------------------------------*/
  /*
   *  SAA7113H DATASHEET PAGE 44, TABLE 42
   */
  /*--------------------------------------------------------------------------*/
 -need = 0;  itwas = 0;  reg = 0x00;  set = 0x00;
 -switch (peasycap_standard->mask & 0x000F) {
 -case NTSC_M_JP: {
 -      reg = 0x0A;  set = 0x95;
 -      ir = read_saa(peasycap->pusb_device, reg);
 -      if (0 > ir)
 -              SAM("ERROR: cannot read SAA register 0x%02X\n", reg);
 -      else
 -              itwas = (unsigned int)ir;
 -      rc = write_saa(peasycap->pusb_device, reg, set);
 -      if (0 != rc)
 -              SAM("ERROR: failed to set SAA register " \
 -                      "0x%02X to 0x%02X for JP standard\n", reg, set);
 -      else {
 -              isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 +      need = 0;
 +      itwas = 0;
 +      reg = 0x00;
 +      set = 0x00;
 +      switch (peasycap_standard->mask & 0x000F) {
 +      case NTSC_M_JP: {
 +              reg = 0x0A;
 +              set = 0x95;
 +              ir = read_saa(peasycap->pusb_device, reg);
                if (0 > ir)
 -                      JOM(8, "SAA register 0x%02X changed " \
 -                              "to 0x%02X\n", reg, isnow);
 +                      SAM("ERROR: cannot read SAA register 0x%02X\n", reg);
                else
 -                      JOM(8, "SAA register 0x%02X changed " \
 -                              "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 -      }
 +                      itwas = (unsigned int)ir;
 +              rc = write_saa(peasycap->pusb_device, reg, set);
 +              if (rc)
 +                      SAM("ERROR: failed to set SAA register "
 +                          "0x%02X to 0x%02X for JP standard\n", reg, set);
 +              else {
 +                      isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 +                      if (0 > ir)
 +                              JOM(8, "SAA register 0x%02X changed "
 +                                  "to 0x%02X\n", reg, isnow);
 +                      else
 +                              JOM(8, "SAA register 0x%02X changed "
 +                                  "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 +              }
  
 -      reg = 0x0B;  set = 0x48;
 -      ir = read_saa(peasycap->pusb_device, reg);
 -      if (0 > ir)
 -              SAM("ERROR: cannot read SAA register 0x%02X\n", reg);
 -      else
 -              itwas = (unsigned int)ir;
 -      rc = write_saa(peasycap->pusb_device, reg, set);
 -      if (0 != rc)
 -              SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X " \
 -                                              "for JP standard\n", reg, set);
 -      else {
 -              isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 +              reg = 0x0B;
 +              set = 0x48;
 +              ir = read_saa(peasycap->pusb_device, reg);
                if (0 > ir)
 -                      JOM(8, "SAA register 0x%02X changed " \
 -                              "to 0x%02X\n", reg, isnow);
 +                      SAM("ERROR: cannot read SAA register 0x%02X\n", reg);
                else
 -                      JOM(8, "SAA register 0x%02X changed " \
 -                              "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 -      }
 +                      itwas = (unsigned int)ir;
 +              rc = write_saa(peasycap->pusb_device, reg, set);
 +              if (rc)
 +                      SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X "
 +                          "for JP standard\n", reg, set);
 +              else {
 +                      isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 +                      if (0 > ir)
 +                              JOM(8, "SAA register 0x%02X changed "
 +                                  "to 0x%02X\n", reg, isnow);
 +                      else
 +                              JOM(8, "SAA register 0x%02X changed "
 +                                  "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 +              }
  /*--------------------------------------------------------------------------*/
  /*
   *  NOTE:  NO break HERE:  RUN ON TO NEXT CASE
   */
  /*--------------------------------------------------------------------------*/
 -}
 -case NTSC_M:
 -case PAL_BGHIN: {
 -      reg = 0x0E;  set = 0x01;  need = 1;  break;
 -}
 -case NTSC_N_443:
 -case PAL_60: {
 -      reg = 0x0E;  set = 0x11;  need = 1;  break;
 -}
 -case NTSC_443:
 -case PAL_Nc: {
 -      reg = 0x0E;  set = 0x21;  need = 1;  break;
 -}
 -case NTSC_N:
 -case PAL_M: {
 -      reg = 0x0E;  set = 0x31;  need = 1;  break;
 -}
 -case SECAM: {
 -      reg = 0x0E;  set = 0x51;  need = 1;  break;
 -}
 -default:
 -      break;
 -}
 +      }
 +      case NTSC_M:
 +      case PAL_BGHIN: {
 +              reg = 0x0E;
 +              set = 0x01;
 +              need = 1;
 +              break;
 +      }
 +      case NTSC_N_443:
 +      case PAL_60: {
 +              reg = 0x0E;
 +              set = 0x11;
 +              need = 1;
 +              break;
 +      }
 +      case NTSC_443:
 +      case PAL_Nc: {
 +              reg = 0x0E;
 +              set = 0x21;
 +              need = 1;
 +              break;
 +      }
 +      case NTSC_N:
 +      case PAL_M: {
 +              reg = 0x0E;
 +              set = 0x31;
 +              need = 1;
 +              break;
 +      }
 +      case SECAM: {
 +              reg = 0x0E;
 +              set = 0x51;
 +              need = 1;
 +              break;
 +      }
 +      default:
 +              break;
 +      }
  /*--------------------------------------------------------------------------*/
 -if (need) {
 -      ir = read_saa(peasycap->pusb_device, reg);
 -      if (0 > ir)
 -              SAM("ERROR: failed to read SAA register 0x%02X\n", reg);
 -      else
 -              itwas = (unsigned int)ir;
 -      rc = write_saa(peasycap->pusb_device, reg, set);
 -      if (0 != write_saa(peasycap->pusb_device, reg, set)) {
 -              SAM("ERROR: failed to set SAA register " \
 -                      "0x%02X to 0x%02X for table 42\n", reg, set);
 -      } else {
 -              isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 +      if (need) {
 +              ir = read_saa(peasycap->pusb_device, reg);
                if (0 > ir)
 -                      JOM(8, "SAA register 0x%02X changed " \
 -                              "to 0x%02X\n", reg, isnow);
 +                      SAM("ERROR: failed to read SAA register 0x%02X\n", reg);
                else
 -                      JOM(8, "SAA register 0x%02X changed " \
 -                              "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 +                      itwas = (unsigned int)ir;
 +              rc = write_saa(peasycap->pusb_device, reg, set);
 +              if (0 != write_saa(peasycap->pusb_device, reg, set)) {
 +                      SAM("ERROR: failed to set SAA register "
 +                          "0x%02X to 0x%02X for table 42\n", reg, set);
 +              } else {
 +                      isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 +                      if (0 > ir)
 +                              JOM(8, "SAA register 0x%02X changed "
 +                                  "to 0x%02X\n", reg, isnow);
 +                      else
 +                              JOM(8, "SAA register 0x%02X changed "
 +                                  "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 +              }
        }
 -}
  /*--------------------------------------------------------------------------*/
  /*
 - *  SAA7113H DATASHEET PAGE 41
 - */
 +       *  SAA7113H DATASHEET PAGE 41
 +       */
  /*--------------------------------------------------------------------------*/
 -reg = 0x08;
 -ir = read_saa(peasycap->pusb_device, reg);
 -if (0 > ir)
 -      SAM("ERROR: failed to read SAA register 0x%02X " \
 -                                              "so cannot reset\n", reg);
 -else {
 -      itwas = (unsigned int)ir;
 -      if (peasycap_standard->mask & 0x0001)
 -              set = itwas | 0x40 ;
 -      else
 -              set = itwas & ~0x40 ;
 -      rc  = write_saa(peasycap->pusb_device, reg, set);
 -      if (0 != rc)
 -              SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n", \
 -                                                              reg, set);
 +      reg = 0x08;
 +      ir = read_saa(peasycap->pusb_device, reg);
 +      if (0 > ir)
 +              SAM("ERROR: failed to read SAA register 0x%02X "
 +                  "so cannot reset\n", reg);
        else {
 -              isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 -              if (0 > ir)
 -                      JOM(8, "SAA register 0x%02X changed to 0x%02X\n", \
 -                                                              reg, isnow);
 +              itwas = (unsigned int)ir;
 +              if (peasycap_standard->mask & 0x0001)
 +                      set = itwas | 0x40 ;
                else
 -                      JOM(8, "SAA register 0x%02X changed " \
 -                              "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 +                      set = itwas & ~0x40 ;
 +              rc  = write_saa(peasycap->pusb_device, reg, set);
 +              if (rc)
 +                      SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n",
 +                          reg, set);
 +              else {
 +                      isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 +                      if (0 > ir)
 +                              JOM(8, "SAA register 0x%02X changed to 0x%02X\n",
 +                                  reg, isnow);
 +                      else
 +                              JOM(8, "SAA register 0x%02X changed "
 +                                  "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 +              }
        }
 -}
  /*--------------------------------------------------------------------------*/
  /*
   *  SAA7113H DATASHEET PAGE 51, TABLE 57
   */
  /*---------------------------------------------------------------------------*/
 -reg = 0x40;
 -ir = read_saa(peasycap->pusb_device, reg);
 -if (0 > ir)
 -      SAM("ERROR: failed to read SAA register 0x%02X " \
 -                                              "so cannot reset\n", reg);
 -else {
 -      itwas = (unsigned int)ir;
 -      if (peasycap_standard->mask & 0x0001)
 -              set = itwas | 0x80 ;
 -      else
 -              set = itwas & ~0x80 ;
 -      rc = write_saa(peasycap->pusb_device, reg, set);
 -      if (0 != rc)
 -              SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n", \
 -                                                              reg, set);
 +      reg = 0x40;
 +      ir = read_saa(peasycap->pusb_device, reg);
 +      if (0 > ir)
 +              SAM("ERROR: failed to read SAA register 0x%02X "
 +                  "so cannot reset\n", reg);
        else {
 -              isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 -              if (0 > ir)
 -                      JOM(8, "SAA register 0x%02X changed to 0x%02X\n", \
 -                                                              reg, isnow);
 +              itwas = (unsigned int)ir;
 +              if (peasycap_standard->mask & 0x0001)
 +                      set = itwas | 0x80 ;
                else
 -                      JOM(8, "SAA register 0x%02X changed " \
 -                              "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 +                      set = itwas & ~0x80 ;
 +              rc = write_saa(peasycap->pusb_device, reg, set);
 +              if (rc)
 +                      SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n",
 +                          reg, set);
 +              else {
 +                      isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
 +                      if (0 > ir)
 +                              JOM(8, "SAA register 0x%02X changed to 0x%02X\n",
 +                                  reg, isnow);
 +                      else
 +                              JOM(8, "SAA register 0x%02X changed "
 +                                  "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 +              }
        }
 -}
  /*--------------------------------------------------------------------------*/
  /*
 - *  SAA7113H DATASHEET PAGE 53, TABLE 66
 - */
 +       *  SAA7113H DATASHEET PAGE 53, TABLE 66
 +       */
  /*--------------------------------------------------------------------------*/
 -reg = 0x5A;
 -ir = read_saa(peasycap->pusb_device, reg);
 -if (0 > ir)
 -      SAM("ERROR: failed to read SAA register 0x%02X but continuing\n", reg);
 +      reg = 0x5A;
 +      ir = read_saa(peasycap->pusb_device, reg);
 +      if (0 > ir)
 +              SAM("ERROR: failed to read SAA register 0x%02X but continuing\n", reg);
        itwas = (unsigned int)ir;
        if (peasycap_standard->mask & 0x0001)
                set = 0x0A ;
        else
                set = 0x07 ;
        if (0 != write_saa(peasycap->pusb_device, reg, set))
 -              SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n", \
 -                                                              reg, set);
 +              SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n",
 +                  reg, set);
        else {
                isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
                if (0 > ir)
                        JOM(8, "SAA register 0x%02X changed "
 -                              "to 0x%02X\n", reg, isnow);
 +                          "to 0x%02X\n", reg, isnow);
                else
                        JOM(8, "SAA register 0x%02X changed "
 -                              "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
 +                          "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
        }
 -if (true == resubmit)
 -      submit_video_urbs(peasycap);
 -return 0;
 +      if (resubmit)
 +              submit_video_urbs(peasycap);
 +      return 0;
  }
  /*****************************************************************************/
  /*--------------------------------------------------------------------------*/
   *  ERRORS RETURN A NEGATIVE NUMBER.
   */
  /*--------------------------------------------------------------------------*/
 -int adjust_format(struct easycap *peasycap, \
 -      __u32 width, __u32 height, __u32 pixelformat, int field, bool try)
 +int adjust_format(struct easycap *peasycap,
 +                u32 width, u32 height, u32 pixelformat, int field, bool try)
  {
 -struct easycap_format *peasycap_format, *peasycap_best_format;
 -__u16 mask;
 -struct usb_device *p;
 -int miss, multiplier, best, k;
 -char bf[5], fo[32], *pc;
 -__u32 uc;
 -bool resubmit;
 -
 -if (NULL == peasycap) {
 -      SAY("ERROR: peasycap is NULL\n");
 -      return -EFAULT;
 -}
 -if (0 > peasycap->standard_offset) {
 -      JOM(8, "%i=peasycap->standard_offset\n", peasycap->standard_offset);
 -      return -EBUSY;
 -}
 -p = peasycap->pusb_device;
 -if ((struct usb_device *)NULL == p) {
 -      SAM("ERROR: peaycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -pc = &bf[0];
 -uc = pixelformat;
 -memcpy((void *)pc, (void *)(&uc), 4);
 -bf[4] = 0;
 -mask = 0xFF & easycap_standard[peasycap->standard_offset].mask;
 -SAM("sought:    %ix%i,%s(0x%08X),%i=field,0x%02X=std mask\n", \
 -                              width, height, pc, pixelformat, field, mask);
 -switch (field) {
 -case V4L2_FIELD_ANY: {
 -      strcpy(&fo[0], "V4L2_FIELD_ANY ");
 -      break;
 -}
 -case V4L2_FIELD_NONE: {
 -      strcpy(&fo[0], "V4L2_FIELD_NONE");
 -      break;
 -}
 -case V4L2_FIELD_TOP: {
 -      strcpy(&fo[0], "V4L2_FIELD_TOP");
 -      break;
 -}
 -case V4L2_FIELD_BOTTOM: {
 -      strcpy(&fo[0], "V4L2_FIELD_BOTTOM");
 -      break;
 -}
 -case V4L2_FIELD_INTERLACED: {
 -      strcpy(&fo[0], "V4L2_FIELD_INTERLACED");
 -      break;
 -}
 -case V4L2_FIELD_SEQ_TB: {
 -      strcpy(&fo[0], "V4L2_FIELD_SEQ_TB");
 -      break;
 -}
 -case V4L2_FIELD_SEQ_BT: {
 -      strcpy(&fo[0], "V4L2_FIELD_SEQ_BT");
 -      break;
 -}
 -case V4L2_FIELD_ALTERNATE: {
 -      strcpy(&fo[0], "V4L2_FIELD_ALTERNATE");
 -      break;
 -}
 -case V4L2_FIELD_INTERLACED_TB: {
 -      strcpy(&fo[0], "V4L2_FIELD_INTERLACED_TB");
 -      break;
 -}
 -case V4L2_FIELD_INTERLACED_BT: {
 -      strcpy(&fo[0], "V4L2_FIELD_INTERLACED_BT");
 -      break;
 -}
 -default: {
 -      strcpy(&fo[0], "V4L2_FIELD_... UNKNOWN  ");
 -      break;
 -}
 -}
 -SAM("sought:    %s\n", &fo[0]);
 -if (V4L2_FIELD_ANY == field) {
 -      field = V4L2_FIELD_NONE;
 -      SAM("prefer:    V4L2_FIELD_NONE=field, was V4L2_FIELD_ANY\n");
 -}
 -peasycap_best_format = (struct easycap_format *)NULL;
 -peasycap_format = &easycap_format[0];
 -while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
 -      JOM(16, ".> %i %i 0x%08X %ix%i\n", \
 -              peasycap_format->mask & 0x01,
 -              peasycap_format->v4l2_format.fmt.pix.field,
 -              peasycap_format->v4l2_format.fmt.pix.pixelformat,
 -              peasycap_format->v4l2_format.fmt.pix.width,
 -              peasycap_format->v4l2_format.fmt.pix.height);
 -
 -      if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) && \
 -              (peasycap_format->v4l2_format.fmt.pix.field == field) && \
 -              (peasycap_format->v4l2_format.fmt.pix.pixelformat == \
 -                                                      pixelformat) && \
 -              (peasycap_format->v4l2_format.fmt.pix.width  == width) && \
 -              (peasycap_format->v4l2_format.fmt.pix.height == height)) {
 +      struct easycap_format *peasycap_format, *peasycap_best_format;
 +      u16 mask;
 +      struct usb_device *p;
 +      int miss, multiplier, best, k;
 +      char bf[5], fo[32], *pc;
 +      u32 uc;
 +      bool resubmit;
 +
 +      if (!peasycap) {
 +              SAY("ERROR: peasycap is NULL\n");
 +              return -EFAULT;
 +      }
 +      if (0 > peasycap->standard_offset) {
 +              JOM(8, "%i=peasycap->standard_offset\n", peasycap->standard_offset);
 +              return -EBUSY;
 +      }
 +      p = peasycap->pusb_device;
 +      if (!p) {
 +              SAM("ERROR: peaycap->pusb_device is NULL\n");
 +              return -EFAULT;
 +      }
 +      pc = &bf[0];
 +      uc = pixelformat;
 +      memcpy((void *)pc, (void *)(&uc), 4);
 +      bf[4] = 0;
 +      mask = 0xFF & easycap_standard[peasycap->standard_offset].mask;
 +      SAM("sought:    %ix%i,%s(0x%08X),%i=field,0x%02X=std mask\n",
 +          width, height, pc, pixelformat, field, mask);
 +      switch (field) {
 +      case V4L2_FIELD_ANY: {
 +              strcpy(&fo[0], "V4L2_FIELD_ANY ");
 +              break;
 +      }
 +      case V4L2_FIELD_NONE: {
 +              strcpy(&fo[0], "V4L2_FIELD_NONE");
 +              break;
 +      }
 +      case V4L2_FIELD_TOP: {
 +              strcpy(&fo[0], "V4L2_FIELD_TOP");
 +              break;
 +      }
 +      case V4L2_FIELD_BOTTOM: {
 +              strcpy(&fo[0], "V4L2_FIELD_BOTTOM");
 +              break;
 +      }
 +      case V4L2_FIELD_INTERLACED: {
 +              strcpy(&fo[0], "V4L2_FIELD_INTERLACED");
 +              break;
 +      }
 +      case V4L2_FIELD_SEQ_TB: {
 +              strcpy(&fo[0], "V4L2_FIELD_SEQ_TB");
 +              break;
 +      }
 +      case V4L2_FIELD_SEQ_BT: {
 +              strcpy(&fo[0], "V4L2_FIELD_SEQ_BT");
 +              break;
 +      }
 +      case V4L2_FIELD_ALTERNATE: {
 +              strcpy(&fo[0], "V4L2_FIELD_ALTERNATE");
 +              break;
 +      }
 +      case V4L2_FIELD_INTERLACED_TB: {
 +              strcpy(&fo[0], "V4L2_FIELD_INTERLACED_TB");
 +              break;
 +      }
 +      case V4L2_FIELD_INTERLACED_BT: {
 +              strcpy(&fo[0], "V4L2_FIELD_INTERLACED_BT");
 +              break;
 +      }
 +      default: {
 +              strcpy(&fo[0], "V4L2_FIELD_... UNKNOWN  ");
 +              break;
 +      }
 +      }
 +      SAM("sought:    %s\n", &fo[0]);
 +      if (V4L2_FIELD_ANY == field) {
 +              field = V4L2_FIELD_NONE;
 +              SAM("prefer:    V4L2_FIELD_NONE=field, was V4L2_FIELD_ANY\n");
 +      }
 +      peasycap_best_format = NULL;
 +      peasycap_format = &easycap_format[0];
 +      while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
 +              JOM(16, ".> %i %i 0x%08X %ix%i\n",
 +                  peasycap_format->mask & 0x01,
 +                  peasycap_format->v4l2_format.fmt.pix.field,
 +                  peasycap_format->v4l2_format.fmt.pix.pixelformat,
 +                  peasycap_format->v4l2_format.fmt.pix.width,
 +                  peasycap_format->v4l2_format.fmt.pix.height);
 +
 +              if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) &&
 +                  (peasycap_format->v4l2_format.fmt.pix.field == field) &&
 +                  (peasycap_format->v4l2_format.fmt.pix.pixelformat == pixelformat) &&
 +                  (peasycap_format->v4l2_format.fmt.pix.width  == width) &&
 +                  (peasycap_format->v4l2_format.fmt.pix.height == height)) {
 +
                        peasycap_best_format = peasycap_format;
                        break;
                }
 -      peasycap_format++;
 -}
 -if (0 == peasycap_format->v4l2_format.fmt.pix.width) {
 -      SAM("cannot do: %ix%i with standard mask 0x%02X\n", \
 -                                                      width, height, mask);
 -      peasycap_format = &easycap_format[0];  best = -1;
 -      while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
 -              if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) && \
 -                               (peasycap_format->v4l2_format.fmt.pix\
 -                                              .field == field) && \
 -                               (peasycap_format->v4l2_format.fmt.pix\
 -                                              .pixelformat == pixelformat)) {
 -                      miss = abs(peasycap_format->\
 -                                      v4l2_format.fmt.pix.width  - width);
 -                      if ((best > miss) || (best < 0)) {
 -                              best = miss;
 -                              peasycap_best_format = peasycap_format;
 -                              if (!miss)
 -                                      break;
 +              peasycap_format++;
 +      }
 +      if (0 == peasycap_format->v4l2_format.fmt.pix.width) {
 +              SAM("cannot do: %ix%i with standard mask 0x%02X\n",
 +                  width, height, mask);
 +              peasycap_format = &easycap_format[0];
 +              best = -1;
 +              while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
 +                      if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) &&
 +                          (peasycap_format->v4l2_format.fmt.pix.field == field) &&
 +                          (peasycap_format->v4l2_format.fmt.pix.pixelformat == pixelformat)) {
 +
 +                              miss = abs(peasycap_format->v4l2_format.fmt.pix.width  - width);
 +                              if ((best > miss) || (best < 0)) {
 +                                      best = miss;
 +                                      peasycap_best_format = peasycap_format;
 +                                      if (!miss)
 +                                              break;
 +                              }
                        }
 +                      peasycap_format++;
 +              }
 +              if (-1 == best) {
 +                      SAM("cannot do %ix... with standard mask 0x%02X\n",
 +                          width, mask);
 +                      SAM("cannot do ...x%i with standard mask 0x%02X\n",
 +                          height, mask);
 +                      SAM("           %ix%i unmatched\n", width, height);
 +                      return peasycap->format_offset;
                }
 -              peasycap_format++;
        }
 -      if (-1 == best) {
 -              SAM("cannot do %ix... with standard mask 0x%02X\n", \
 -                                                              width, mask);
 -              SAM("cannot do ...x%i with standard mask 0x%02X\n", \
 -                                                              height, mask);
 -              SAM("           %ix%i unmatched\n", width, height);
 -              return peasycap->format_offset;
 +      if (!peasycap_best_format) {
 +              SAM("MISTAKE: peasycap_best_format is NULL");
 +              return -EINVAL;
        }
 -}
 -if ((struct easycap_format *)NULL == peasycap_best_format) {
 -      SAM("MISTAKE: peasycap_best_format is NULL");
 -      return -EINVAL;
 -}
 -peasycap_format = peasycap_best_format;
 +      peasycap_format = peasycap_best_format;
  
  /*...........................................................................*/
 -if (true == try)
 -      return (int)(peasycap_best_format - &easycap_format[0]);
 +      if (try)
 +              return peasycap_best_format - easycap_format;
  /*...........................................................................*/
  
 -if (false != try) {
 -      SAM("MISTAKE: true==try where is should be false\n");
 -      return -EINVAL;
 -}
 -SAM("actioning: %ix%i %s\n", \
 -                      peasycap_format->v4l2_format.fmt.pix.width, \
 -                      peasycap_format->v4l2_format.fmt.pix.height,
 -                      &peasycap_format->name[0]);
 -peasycap->height        = peasycap_format->v4l2_format.fmt.pix.height;
 -peasycap->width         = peasycap_format->v4l2_format.fmt.pix.width;
 -peasycap->pixelformat   = peasycap_format->v4l2_format.fmt.pix.pixelformat;
 -peasycap->format_offset = (int)(peasycap_format - &easycap_format[0]);
 +      if (false != try) {
 +              SAM("MISTAKE: true==try where is should be false\n");
 +              return -EINVAL;
 +      }
 +      SAM("actioning: %ix%i %s\n",
 +          peasycap_format->v4l2_format.fmt.pix.width,
 +          peasycap_format->v4l2_format.fmt.pix.height,
 +          &peasycap_format->name[0]);
 +      peasycap->height        = peasycap_format->v4l2_format.fmt.pix.height;
 +      peasycap->width         = peasycap_format->v4l2_format.fmt.pix.width;
 +      peasycap->pixelformat   = peasycap_format->v4l2_format.fmt.pix.pixelformat;
 +      peasycap->format_offset = peasycap_format - easycap_format;
  
  
 -for (k = 0; k < INPUT_MANY; k++) {
 -      if (!peasycap->inputset[k].format_offset_ok) {
 -              peasycap->inputset[k].format_offset = \
 -                                              peasycap->format_offset;
 +      for (k = 0; k < INPUT_MANY; k++) {
 +              if (!peasycap->inputset[k].format_offset_ok) {
 +                      peasycap->inputset[k].format_offset =
 +                              peasycap->format_offset;
 +              }
        }
 -}
 -if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 -      peasycap->inputset[peasycap->input].format_offset = \
 -                                              peasycap->format_offset;
 -      peasycap->inputset[peasycap->input].format_offset_ok = 1;
 -} else
 -      JOM(8, "%i=peasycap->input\n", peasycap->input);
 -
 -
 -
 -peasycap->bytesperpixel = (0x00E0 & peasycap_format->mask) >> 5 ;
 -if (0x0100 & peasycap_format->mask)
 -      peasycap->byteswaporder = true;
 -else
 -      peasycap->byteswaporder = false;
 -if (0x0200 & peasycap_format->mask)
 -      peasycap->skip = 5;
 -else
 -      peasycap->skip = 0;
 -if (0x0800 & peasycap_format->mask)
 -      peasycap->decimatepixel = true;
 -else
 -      peasycap->decimatepixel = false;
 -if (0x1000 & peasycap_format->mask)
 -      peasycap->offerfields = true;
 -else
 -      peasycap->offerfields = false;
 -if (true == peasycap->decimatepixel)
 -      multiplier = 2;
 -else
 -      multiplier = 1;
 -peasycap->videofieldamount = multiplier * peasycap->width * \
 -                                      multiplier * peasycap->height;
 -peasycap->frame_buffer_used = peasycap->bytesperpixel * \
 -                                      peasycap->width * peasycap->height;
 -if (peasycap->video_isoc_streaming) {
 -      resubmit = true;
 -      kill_video_urbs(peasycap);
 -} else
 -      resubmit = false;
 +      if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 +              peasycap->inputset[peasycap->input].format_offset =
 +                      peasycap->format_offset;
 +              peasycap->inputset[peasycap->input].format_offset_ok = 1;
 +      } else
 +              JOM(8, "%i=peasycap->input\n", peasycap->input);
 +
 +
 +
 +      peasycap->bytesperpixel = (0x00E0 & peasycap_format->mask) >> 5 ;
 +      if (0x0100 & peasycap_format->mask)
 +              peasycap->byteswaporder = true;
 +      else
 +              peasycap->byteswaporder = false;
 +      if (0x0200 & peasycap_format->mask)
 +              peasycap->skip = 5;
 +      else
 +              peasycap->skip = 0;
 +      if (0x0800 & peasycap_format->mask)
 +              peasycap->decimatepixel = true;
 +      else
 +              peasycap->decimatepixel = false;
 +      if (0x1000 & peasycap_format->mask)
 +              peasycap->offerfields = true;
 +      else
 +              peasycap->offerfields = false;
 +      if (peasycap->decimatepixel)
 +              multiplier = 2;
 +      else
 +              multiplier = 1;
 +      peasycap->videofieldamount =
 +              multiplier * peasycap->width * multiplier * peasycap->height;
 +      peasycap->frame_buffer_used =
 +              peasycap->bytesperpixel * peasycap->width * peasycap->height;
 +      if (peasycap->video_isoc_streaming) {
 +              resubmit = true;
 +              kill_video_urbs(peasycap);
 +      } else
 +              resubmit = false;
  /*---------------------------------------------------------------------------*/
  /*
 - *  PAL
 - */
 +       *  PAL
 +       */
  /*---------------------------------------------------------------------------*/
 -if (0 == (0x01 & peasycap_format->mask)) {
 -      if (((720 == peasycap_format->v4l2_format.fmt.pix.width) && \
 -                      (576 == \
 -                      peasycap_format->v4l2_format.fmt.pix.height)) || \
 -                      ((360 == \
 -                      peasycap_format->v4l2_format.fmt.pix.width) && \
 -                      (288 == \
 -                      peasycap_format->v4l2_format.fmt.pix.height))) {
 -              if (0 != set_resolution(p, 0x0000, 0x0001, 0x05A0, 0x0121)) {
 -                      SAM("ERROR: set_resolution() failed\n");
 -                      return -EINVAL;
 -              }
 -      } else if ((704 == peasycap_format->v4l2_format.fmt.pix.width) && \
 -                      (576 == peasycap_format->v4l2_format.fmt.pix.height)) {
 -              if (0 != set_resolution(p, 0x0004, 0x0001, 0x0584, 0x0121)) {
 -                      SAM("ERROR: set_resolution() failed\n");
 -                      return -EINVAL;
 -              }
 -      } else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) && \
 -                      (480 == \
 -                      peasycap_format->v4l2_format.fmt.pix.height)) || \
 -                      ((320 == \
 -                      peasycap_format->v4l2_format.fmt.pix.width) && \
 -                      (240 == \
 -                      peasycap_format->v4l2_format.fmt.pix.height))) {
 -              if (0 != set_resolution(p, 0x0014, 0x0020, 0x0514, 0x0110)) {
 -                      SAM("ERROR: set_resolution() failed\n");
 +      if (0 == (0x01 & peasycap_format->mask)) {
 +              if (((720 == peasycap_format->v4l2_format.fmt.pix.width) &&
 +                   (576 == peasycap_format->v4l2_format.fmt.pix.height)) ||
 +                  ((360 == peasycap_format->v4l2_format.fmt.pix.width) &&
 +                   (288 == peasycap_format->v4l2_format.fmt.pix.height))) {
 +                      if (set_resolution(p, 0x0000, 0x0001, 0x05A0, 0x0121)) {
 +                              SAM("ERROR: set_resolution() failed\n");
 +                              return -EINVAL;
 +                      }
 +              } else if ((704 == peasycap_format->v4l2_format.fmt.pix.width) &&
 +                         (576 == peasycap_format->v4l2_format.fmt.pix.height)) {
 +                      if (set_resolution(p, 0x0004, 0x0001, 0x0584, 0x0121)) {
 +                              SAM("ERROR: set_resolution() failed\n");
 +                              return -EINVAL;
 +                      }
 +              } else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) &&
 +                          (480 == peasycap_format->v4l2_format.fmt.pix.height)) ||
 +                         ((320 == peasycap_format->v4l2_format.fmt.pix.width) &&
 +                          (240 == peasycap_format->v4l2_format.fmt.pix.height))) {
 +                      if (set_resolution(p, 0x0014, 0x0020, 0x0514, 0x0110)) {
 +                              SAM("ERROR: set_resolution() failed\n");
 +                              return -EINVAL;
 +                      }
 +              } else {
 +                      SAM("MISTAKE: bad format, cannot set resolution\n");
                        return -EINVAL;
                }
 -      } else {
 -              SAM("MISTAKE: bad format, cannot set resolution\n");
 -              return -EINVAL;
 -      }
  /*---------------------------------------------------------------------------*/
  /*
   *  NTSC
   */
  /*---------------------------------------------------------------------------*/
 -} else {
 -      if (((720 == peasycap_format->v4l2_format.fmt.pix.width) && \
 -                      (480 == \
 -                      peasycap_format->v4l2_format.fmt.pix.height)) || \
 -                      ((360 == \
 -                      peasycap_format->v4l2_format.fmt.pix.width) && \
 -                      (240 == \
 -                      peasycap_format->v4l2_format.fmt.pix.height))) {
 -              if (0 != set_resolution(p, 0x0000, 0x0003, 0x05A0, 0x00F3)) {
 -                      SAM("ERROR: set_resolution() failed\n");
 -                      return -EINVAL;
 -              }
 -      } else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) && \
 -                      (480 == \
 -                      peasycap_format->v4l2_format.fmt.pix.height)) || \
 -                      ((320 == \
 -                      peasycap_format->v4l2_format.fmt.pix.width) && \
 -                      (240 == \
 -                      peasycap_format->v4l2_format.fmt.pix.height))) {
 -              if (0 != set_resolution(p, 0x0014, 0x0003, 0x0514, 0x00F3)) {
 -                      SAM("ERROR: set_resolution() failed\n");
 +      } else {
 +              if (((720 == peasycap_format->v4l2_format.fmt.pix.width) &&
 +                   (480 == peasycap_format->v4l2_format.fmt.pix.height)) ||
 +                  ((360 == peasycap_format->v4l2_format.fmt.pix.width) &&
 +                   (240 == peasycap_format->v4l2_format.fmt.pix.height))) {
 +                      if (set_resolution(p, 0x0000, 0x0003, 0x05A0, 0x00F3)) {
 +                              SAM("ERROR: set_resolution() failed\n");
 +                              return -EINVAL;
 +                      }
 +              } else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) &&
 +                          (480 == peasycap_format->v4l2_format.fmt.pix.height)) ||
 +                         ((320 == peasycap_format->v4l2_format.fmt.pix.width) &&
 +                          (240 == peasycap_format->v4l2_format.fmt.pix.height))) {
 +                      if (set_resolution(p, 0x0014, 0x0003, 0x0514, 0x00F3)) {
 +                              SAM("ERROR: set_resolution() failed\n");
 +                              return -EINVAL;
 +                      }
 +              } else {
 +                      SAM("MISTAKE: bad format, cannot set resolution\n");
                        return -EINVAL;
                }
 -      } else {
 -              SAM("MISTAKE: bad format, cannot set resolution\n");
 -              return -EINVAL;
        }
 -}
  /*---------------------------------------------------------------------------*/
 -if (true == resubmit)
 -      submit_video_urbs(peasycap);
 -return (int)(peasycap_best_format - &easycap_format[0]);
 +      if (resubmit)
 +              submit_video_urbs(peasycap);
 +
 +      return peasycap_best_format - easycap_format;
  }
  /*****************************************************************************/
  int adjust_brightness(struct easycap *peasycap, int value)
  {
 -unsigned int mood;
 -int i1, k;
 +      unsigned int mood;
 +      int i1, k;
  
 -if (NULL == peasycap) {
 -      SAY("ERROR: peasycap is NULL\n");
 -      return -EFAULT;
 -}
 -if ((struct usb_device *)NULL == peasycap->pusb_device) {
 -      SAM("ERROR: peasycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -i1 = 0;
 -while (0xFFFFFFFF != easycap_control[i1].id) {
 -      if (V4L2_CID_BRIGHTNESS == easycap_control[i1].id) {
 -              if ((easycap_control[i1].minimum > value) || \
 -                                      (easycap_control[i1].maximum < value))
 -                      value = easycap_control[i1].default_value;
 -
 -              if ((easycap_control[i1].minimum <= peasycap->brightness) && \
 -                                      (easycap_control[i1].maximum >= \
 -                                              peasycap->brightness)) {
 -                      if (peasycap->brightness == value) {
 -                              SAM("unchanged brightness at  0x%02X\n", \
 -                                                              value);
 +      if (!peasycap) {
 +              SAY("ERROR: peasycap is NULL\n");
 +              return -EFAULT;
 +      }
 +      if (!peasycap->pusb_device) {
 +              SAM("ERROR: peasycap->pusb_device is NULL\n");
 +              return -EFAULT;
 +      }
 +      i1 = 0;
 +      while (0xFFFFFFFF != easycap_control[i1].id) {
 +              if (V4L2_CID_BRIGHTNESS == easycap_control[i1].id) {
 +                      if ((easycap_control[i1].minimum > value) ||
 +                          (easycap_control[i1].maximum < value))
 +                              value = easycap_control[i1].default_value;
 +
 +                      if ((easycap_control[i1].minimum <= peasycap->brightness) &&
 +                          (easycap_control[i1].maximum >= peasycap->brightness)) {
 +                              if (peasycap->brightness == value) {
 +                                      SAM("unchanged brightness at  0x%02X\n",
 +                                          value);
 +                                      return 0;
 +                              }
 +                      }
 +                      peasycap->brightness = value;
 +                      for (k = 0; k < INPUT_MANY; k++) {
 +                              if (!peasycap->inputset[k].brightness_ok)
 +                                      peasycap->inputset[k].brightness =
 +                                              peasycap->brightness;
 +                      }
 +                      if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 +                              peasycap->inputset[peasycap->input].brightness =
 +                                      peasycap->brightness;
 +                              peasycap->inputset[peasycap->input].brightness_ok = 1;
 +                      } else
 +                              JOM(8, "%i=peasycap->input\n", peasycap->input);
 +                      mood = 0x00FF & (unsigned int)peasycap->brightness;
 +                      if (!write_saa(peasycap->pusb_device, 0x0A, mood)) {
 +                              SAM("adjusting brightness to  0x%02X\n", mood);
                                return 0;
 +                      } else {
 +                              SAM("WARNING: failed to adjust brightness "
 +                                  "to 0x%02X\n", mood);
 +                              return -ENOENT;
                        }
 +                      break;
                }
 -              peasycap->brightness = value;
 -              for (k = 0; k < INPUT_MANY; k++) {
 -                      if (!peasycap->inputset[k].brightness_ok)
 -                              peasycap->inputset[k].brightness = \
 -                                                      peasycap->brightness;
 -              }
 -              if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 -                      peasycap->inputset[peasycap->input].brightness = \
 -                                                      peasycap->brightness;
 -                      peasycap->inputset[peasycap->input].brightness_ok = 1;
 -              } else
 -                      JOM(8, "%i=peasycap->input\n", peasycap->input);
 -              mood = 0x00FF & (unsigned int)peasycap->brightness;
 -              if (!write_saa(peasycap->pusb_device, 0x0A, mood)) {
 -                      SAM("adjusting brightness to  0x%02X\n", mood);
 -                      return 0;
 -              } else {
 -                      SAM("WARNING: failed to adjust brightness " \
 -                                                      "to 0x%02X\n", mood);
 -                      return -ENOENT;
 -              }
 -              break;
 +              i1++;
        }
 -      i1++;
 -}
 -SAM("WARNING: failed to adjust brightness: control not found\n");
 -return -ENOENT;
 +      SAM("WARNING: failed to adjust brightness: control not found\n");
 +      return -ENOENT;
  }
  /*****************************************************************************/
  int adjust_contrast(struct easycap *peasycap, int value)
  {
 -unsigned int mood;
 -int i1, k;
 -
 -if (NULL == peasycap) {
 -      SAY("ERROR: peasycap is NULL\n");
 -      return -EFAULT;
 -}
 -if ((struct usb_device *)NULL == peasycap->pusb_device) {
 -      SAM("ERROR: peasycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -i1 = 0;
 -while (0xFFFFFFFF != easycap_control[i1].id) {
 -      if (V4L2_CID_CONTRAST == easycap_control[i1].id) {
 -              if ((easycap_control[i1].minimum > value) || \
 -                                      (easycap_control[i1].maximum < value))
 -                      value = easycap_control[i1].default_value;
 +      unsigned int mood;
 +      int i1, k;
  
 +      if (!peasycap) {
 +              SAY("ERROR: peasycap is NULL\n");
 +              return -EFAULT;
 +      }
 +      if (!peasycap->pusb_device) {
 +              SAM("ERROR: peasycap->pusb_device is NULL\n");
 +              return -EFAULT;
 +      }
 +      i1 = 0;
 +      while (0xFFFFFFFF != easycap_control[i1].id) {
 +              if (V4L2_CID_CONTRAST == easycap_control[i1].id) {
 +                      if ((easycap_control[i1].minimum > value) ||
 +                          (easycap_control[i1].maximum < value))
 +                              value = easycap_control[i1].default_value;
 +
 +
 +                      if ((easycap_control[i1].minimum <= peasycap->contrast) &&
 +                          (easycap_control[i1].maximum >= peasycap->contrast)) {
 +                              if (peasycap->contrast == value) {
 +                                      SAM("unchanged contrast at  0x%02X\n", value);
 +                                      return 0;
 +                              }
 +                      }
 +                      peasycap->contrast = value;
 +                      for (k = 0; k < INPUT_MANY; k++) {
 +                              if (!peasycap->inputset[k].contrast_ok)
 +                                      peasycap->inputset[k].contrast = peasycap->contrast;
 +                      }
  
 +                      if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 +                              peasycap->inputset[peasycap->input].contrast =
 +                                              peasycap->contrast;
 +                              peasycap->inputset[peasycap->input].contrast_ok = 1;
 +                      } else
 +                              JOM(8, "%i=peasycap->input\n", peasycap->input);
  
 -              if ((easycap_control[i1].minimum <= peasycap->contrast) && \
 -                              (easycap_control[i1].maximum >= \
 -                                                      peasycap->contrast)) {
 -                      if (peasycap->contrast == value) {
 -                              SAM("unchanged contrast at  0x%02X\n", value);
 +                      mood = 0x00FF & (unsigned int) (peasycap->contrast - 128);
 +                      if (!write_saa(peasycap->pusb_device, 0x0B, mood)) {
 +                              SAM("adjusting contrast to  0x%02X\n", mood);
                                return 0;
 +                      } else {
 +                              SAM("WARNING: failed to adjust contrast to "
 +                                  "0x%02X\n", mood);
 +                              return -ENOENT;
                        }
 +                      break;
                }
 -              peasycap->contrast = value;
 -              for (k = 0; k < INPUT_MANY; k++) {
 -                      if (!peasycap->inputset[k].contrast_ok) {
 -                              peasycap->inputset[k].contrast = \
 -                                                      peasycap->contrast;
 -                      }
 -              }
 -              if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 -                      peasycap->inputset[peasycap->input].contrast = \
 -                                                      peasycap->contrast;
 -                      peasycap->inputset[peasycap->input].contrast_ok = 1;
 -              } else
 -                      JOM(8, "%i=peasycap->input\n", peasycap->input);
 -              mood = 0x00FF & (unsigned int) (peasycap->contrast - 128);
 -              if (!write_saa(peasycap->pusb_device, 0x0B, mood)) {
 -                      SAM("adjusting contrast to  0x%02X\n", mood);
 -                      return 0;
 -              } else {
 -                      SAM("WARNING: failed to adjust contrast to " \
 -                                                      "0x%02X\n", mood);
 -                      return -ENOENT;
 -              }
 -              break;
 +              i1++;
        }
 -      i1++;
 -}
 -SAM("WARNING: failed to adjust contrast: control not found\n");
 -return -ENOENT;
 +      SAM("WARNING: failed to adjust contrast: control not found\n");
 +      return -ENOENT;
  }
  /*****************************************************************************/
  int adjust_saturation(struct easycap *peasycap, int value)
  {
 -unsigned int mood;
 -int i1, k;
 +      unsigned int mood;
 +      int i1, k;
  
 -if (NULL == peasycap) {
 -      SAY("ERROR: peasycap is NULL\n");
 -      return -EFAULT;
 -}
 -if ((struct usb_device *)NULL == peasycap->pusb_device) {
 -      SAM("ERROR: peasycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -i1 = 0;
 -while (0xFFFFFFFF != easycap_control[i1].id) {
 -      if (V4L2_CID_SATURATION == easycap_control[i1].id) {
 -              if ((easycap_control[i1].minimum > value) || \
 -                                      (easycap_control[i1].maximum < value))
 -                      value = easycap_control[i1].default_value;
 -
 -
 -              if ((easycap_control[i1].minimum <= peasycap->saturation) && \
 -                                      (easycap_control[i1].maximum >= \
 -                                              peasycap->saturation)) {
 -                      if (peasycap->saturation == value) {
 -                              SAM("unchanged saturation at  0x%02X\n", \
 -                                                              value);
 -                              return 0;
 -                      }
 -              }
 -              peasycap->saturation = value;
 -              for (k = 0; k < INPUT_MANY; k++) {
 -                      if (!peasycap->inputset[k].saturation_ok) {
 -                              peasycap->inputset[k].saturation = \
 -                                                      peasycap->saturation;
 -                      }
 -              }
 -              if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 -                      peasycap->inputset[peasycap->input].saturation = \
 -                                                      peasycap->saturation;
 -                      peasycap->inputset[peasycap->input].saturation_ok = 1;
 -              } else
 -                      JOM(8, "%i=peasycap->input\n", peasycap->input);
 -              mood = 0x00FF & (unsigned int) (peasycap->saturation - 128);
 -              if (!write_saa(peasycap->pusb_device, 0x0C, mood)) {
 -                      SAM("adjusting saturation to  0x%02X\n", mood);
 -                      return 0;
 -              } else {
 -                      SAM("WARNING: failed to adjust saturation to " \
 -                                                      "0x%02X\n", mood);
 -                      return -ENOENT;
 +      if (!peasycap) {
 +              SAY("ERROR: peasycap is NULL\n");
 +              return -EFAULT;
 +      }
 +      if (!peasycap->pusb_device) {
 +              SAM("ERROR: peasycap->pusb_device is NULL\n");
 +              return -EFAULT;
 +      }
 +      i1 = 0;
 +      while (0xFFFFFFFF != easycap_control[i1].id) {
 +              if (V4L2_CID_SATURATION == easycap_control[i1].id) {
 +                      if ((easycap_control[i1].minimum > value) ||
 +                          (easycap_control[i1].maximum < value))
 +                              value = easycap_control[i1].default_value;
 +
 +
 +                      if ((easycap_control[i1].minimum <= peasycap->saturation) &&
 +                          (easycap_control[i1].maximum >= peasycap->saturation)) {
 +                              if (peasycap->saturation == value) {
 +                                      SAM("unchanged saturation at  0x%02X\n",
 +                                          value);
 +                                      return 0;
 +                              }
 +                      }
 +                      peasycap->saturation = value;
 +                      for (k = 0; k < INPUT_MANY; k++) {
 +                              if (!peasycap->inputset[k].saturation_ok)
 +                                      peasycap->inputset[k].saturation =
 +                                              peasycap->saturation;
 +                      }
 +                      if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 +                              peasycap->inputset[peasycap->input].saturation =
 +                                      peasycap->saturation;
 +                              peasycap->inputset[peasycap->input].saturation_ok = 1;
 +                      } else
 +                              JOM(8, "%i=peasycap->input\n", peasycap->input);
 +                      mood = 0x00FF & (unsigned int) (peasycap->saturation - 128);
 +                      if (!write_saa(peasycap->pusb_device, 0x0C, mood)) {
 +                              SAM("adjusting saturation to  0x%02X\n", mood);
 +                              return 0;
 +                      } else {
 +                              SAM("WARNING: failed to adjust saturation to "
 +                                  "0x%02X\n", mood);
 +                              return -ENOENT;
 +                      }
 +                      break;
                }
 -              break;
 +              i1++;
        }
 -      i1++;
 -}
 -SAM("WARNING: failed to adjust saturation: control not found\n");
 -return -ENOENT;
 +      SAM("WARNING: failed to adjust saturation: control not found\n");
 +      return -ENOENT;
  }
  /*****************************************************************************/
  int adjust_hue(struct easycap *peasycap, int value)
  {
 -unsigned int mood;
 -int i1, i2, k;
 +      unsigned int mood;
 +      int i1, i2, k;
  
 -if (NULL == peasycap) {
 -      SAY("ERROR: peasycap is NULL\n");
 -      return -EFAULT;
 -}
 -if ((struct usb_device *)NULL == peasycap->pusb_device) {
 -      SAM("ERROR: peasycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -i1 = 0;
 -while (0xFFFFFFFF != easycap_control[i1].id) {
 -      if (V4L2_CID_HUE == easycap_control[i1].id) {
 -              if ((easycap_control[i1].minimum > value) || \
 -                                      (easycap_control[i1].maximum < value))
 -                      value = easycap_control[i1].default_value;
 -
 -              if ((easycap_control[i1].minimum <= peasycap->hue) && \
 -                                      (easycap_control[i1].maximum >= \
 -                                                      peasycap->hue)) {
 -                      if (peasycap->hue == value) {
 -                              SAM("unchanged hue at  0x%02X\n", value);
 +      if (!peasycap) {
 +              SAY("ERROR: peasycap is NULL\n");
 +              return -EFAULT;
 +      }
 +      if (!peasycap->pusb_device) {
 +              SAM("ERROR: peasycap->pusb_device is NULL\n");
 +              return -EFAULT;
 +      }
 +      i1 = 0;
 +      while (0xFFFFFFFF != easycap_control[i1].id) {
 +              if (V4L2_CID_HUE == easycap_control[i1].id) {
 +                      if ((easycap_control[i1].minimum > value) ||
 +                          (easycap_control[i1].maximum < value))
 +                              value = easycap_control[i1].default_value;
 +
 +                      if ((easycap_control[i1].minimum <= peasycap->hue) &&
 +                          (easycap_control[i1].maximum >= peasycap->hue)) {
 +                              if (peasycap->hue == value) {
 +                                      SAM("unchanged hue at  0x%02X\n", value);
 +                                      return 0;
 +                              }
 +                      }
 +                      peasycap->hue = value;
 +                      for (k = 0; k < INPUT_MANY; k++) {
 +                              if (!peasycap->inputset[k].hue_ok)
 +                                      peasycap->inputset[k].hue = peasycap->hue;
 +                      }
 +                      if (0 <= peasycap->input && INPUT_MANY > peasycap->input) {
 +                              peasycap->inputset[peasycap->input].hue = peasycap->hue;
 +                              peasycap->inputset[peasycap->input].hue_ok = 1;
 +                      } else
 +                              JOM(8, "%i=peasycap->input\n", peasycap->input);
 +                      i2 = peasycap->hue - 128;
 +                      mood = 0x00FF & ((int) i2);
 +                      if (!write_saa(peasycap->pusb_device, 0x0D, mood)) {
 +                              SAM("adjusting hue to  0x%02X\n", mood);
                                return 0;
 +                      } else {
 +                              SAM("WARNING: failed to adjust hue to 0x%02X\n", mood);
 +                              return -ENOENT;
                        }
 +                      break;
                }
 -              peasycap->hue = value;
 -              for (k = 0; k < INPUT_MANY; k++) {
 -                      if (!peasycap->inputset[k].hue_ok)
 -                              peasycap->inputset[k].hue = peasycap->hue;
 -              }
 -              if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
 -                      peasycap->inputset[peasycap->input].hue = \
 -                                                      peasycap->hue;
 -                      peasycap->inputset[peasycap->input].hue_ok = 1;
 -              } else
 -                      JOM(8, "%i=peasycap->input\n", peasycap->input);
 -              i2 = peasycap->hue - 128;
 -              mood = 0x00FF & ((int) i2);
 -              if (!write_saa(peasycap->pusb_device, 0x0D, mood)) {
 -                      SAM("adjusting hue to  0x%02X\n", mood);
 -                      return 0;
 -              } else {
 -                      SAM("WARNING: failed to adjust hue to 0x%02X\n", mood);
 -                      return -ENOENT;
 -              }
 -              break;
 +              i1++;
        }
 -      i1++;
 -}
 -SAM("WARNING: failed to adjust hue: control not found\n");
 -return -ENOENT;
 +      SAM("WARNING: failed to adjust hue: control not found\n");
 +      return -ENOENT;
  }
  /*****************************************************************************/
  int adjust_volume(struct easycap *peasycap, int value)
  {
 -__s8 mood;
 -int i1;
 +      s8 mood;
 +      int i1;
  
 -if (NULL == peasycap) {
 -      SAY("ERROR: peasycap is NULL\n");
 -      return -EFAULT;
 -}
 -if ((struct usb_device *)NULL == peasycap->pusb_device) {
 -      SAM("ERROR: peasycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -i1 = 0;
 -while (0xFFFFFFFF != easycap_control[i1].id) {
 -      if (V4L2_CID_AUDIO_VOLUME == easycap_control[i1].id) {
 -              if ((easycap_control[i1].minimum > value) || \
 -                              (easycap_control[i1].maximum < value))
 -                      value = easycap_control[i1].default_value;
 -              if ((easycap_control[i1].minimum <= peasycap->volume) && \
 -                                      (easycap_control[i1].maximum >= \
 -                                                      peasycap->volume)) {
 -                      if (peasycap->volume == value) {
 -                              SAM("unchanged volume at  0x%02X\n", value);
 +      if (!peasycap) {
 +              SAY("ERROR: peasycap is NULL\n");
 +              return -EFAULT;
 +      }
 +      if (!peasycap->pusb_device) {
 +              SAM("ERROR: peasycap->pusb_device is NULL\n");
 +              return -EFAULT;
 +      }
 +      i1 = 0;
 +      while (0xFFFFFFFF != easycap_control[i1].id) {
 +              if (V4L2_CID_AUDIO_VOLUME == easycap_control[i1].id) {
 +                      if ((easycap_control[i1].minimum > value) ||
 +                          (easycap_control[i1].maximum < value))
 +                              value = easycap_control[i1].default_value;
 +
 +                      if ((easycap_control[i1].minimum <= peasycap->volume) &&
 +                          (easycap_control[i1].maximum >= peasycap->volume)) {
 +                              if (peasycap->volume == value) {
 +                                      SAM("unchanged volume at  0x%02X\n", value);
 +                                      return 0;
 +                              }
 +                      }
 +                      peasycap->volume = value;
 +                      mood = (16 > peasycap->volume) ? 16 :
 +                              ((31 < peasycap->volume) ? 31 :
 +                                (s8) peasycap->volume);
 +                      if (!audio_gainset(peasycap->pusb_device, mood)) {
 +                              SAM("adjusting volume to 0x%02X\n", mood);
                                return 0;
 +                      } else {
 +                              SAM("WARNING: failed to adjust volume to "
 +                                  "0x%2X\n", mood);
 +                              return -ENOENT;
                        }
 +                      break;
                }
 -              peasycap->volume = value;
 -              mood = (16 > peasycap->volume) ? 16 : \
 -                      ((31 < peasycap->volume) ? 31 : \
 -                      (__s8) peasycap->volume);
 -              if (!audio_gainset(peasycap->pusb_device, mood)) {
 -                      SAM("adjusting volume to 0x%02X\n", mood);
 -                      return 0;
 -              } else {
 -                      SAM("WARNING: failed to adjust volume to " \
 -                                                      "0x%2X\n", mood);
 -                      return -ENOENT;
 -              }
 -              break;
 +              i1++;
        }
 -i1++;
 -}
 -SAM("WARNING: failed to adjust volume: control not found\n");
 -return -ENOENT;
 +      SAM("WARNING: failed to adjust volume: control not found\n");
 +      return -ENOENT;
  }
  /*****************************************************************************/
  /*---------------------------------------------------------------------------*/
  /*
   *  AN ALTERNATIVE METHOD OF MUTING MIGHT SEEM TO BE:
 - *            usb_set_interface(peasycap->pusb_device, \
 - *                              peasycap->audio_interface, \
 + *            usb_set_interface(peasycap->pusb_device,
 + *                              peasycap->audio_interface,
   *                              peasycap->audio_altsetting_off);
   *  HOWEVER, AFTER THIS COMMAND IS ISSUED ALL SUBSEQUENT URBS RECEIVE STATUS
 - *  -ESHUTDOWN.  THE HANDLER ROUTINE easysnd_complete() DECLINES TO RESUBMIT
 + *  -ESHUTDOWN.  THE HANDLER ROUTINE easyxxx_complete() DECLINES TO RESUBMIT
   *  THE URB AND THE PIPELINE COLLAPSES IRRETRIEVABLY.  BEWARE.
   */
  /*---------------------------------------------------------------------------*/
 -int adjust_mute(struct easycap *peasycap, int value)
 +static int adjust_mute(struct easycap *peasycap, int value)
  {
 -int i1;
 +      int i1;
  
 -if (NULL == peasycap) {
 -      SAY("ERROR: peasycap is NULL\n");
 -      return -EFAULT;
 -}
 -if ((struct usb_device *)NULL == peasycap->pusb_device) {
 -      SAM("ERROR: peasycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -i1 = 0;
 -while (0xFFFFFFFF != easycap_control[i1].id) {
 -      if (V4L2_CID_AUDIO_MUTE == easycap_control[i1].id) {
 -              peasycap->mute = value;
 -              switch (peasycap->mute) {
 -              case 1: {
 -                      peasycap->audio_idle = 1;
 -                      peasycap->timeval0.tv_sec = 0;
 -                      SAM("adjusting mute: %i=peasycap->audio_idle\n", \
 -                                                      peasycap->audio_idle);
 -                      return 0;
 -              }
 -              default: {
 -                      peasycap->audio_idle = 0;
 -                      SAM("adjusting mute: %i=peasycap->audio_idle\n", \
 -                                                      peasycap->audio_idle);
 -                      return 0;
 -              }
 +      if (!peasycap) {
 +              SAY("ERROR: peasycap is NULL\n");
 +              return -EFAULT;
 +      }
 +      if (!peasycap->pusb_device) {
 +              SAM("ERROR: peasycap->pusb_device is NULL\n");
 +              return -EFAULT;
 +      }
 +      i1 = 0;
 +      while (0xFFFFFFFF != easycap_control[i1].id) {
 +              if (V4L2_CID_AUDIO_MUTE == easycap_control[i1].id) {
 +                      peasycap->mute = value;
 +                      switch (peasycap->mute) {
 +                      case 1: {
 +                              peasycap->audio_idle = 1;
 +                              peasycap->timeval0.tv_sec = 0;
 +                              SAM("adjusting mute: %i=peasycap->audio_idle\n",
 +                                  peasycap->audio_idle);
 +                              return 0;
 +                      }
 +                      default: {
 +                              peasycap->audio_idle = 0;
 +                              SAM("adjusting mute: %i=peasycap->audio_idle\n",
 +                                  peasycap->audio_idle);
 +                              return 0;
 +                      }
 +                      }
 +                      break;
                }
 -              break;
 +              i1++;
        }
 -      i1++;
 -}
 -SAM("WARNING: failed to adjust mute: control not found\n");
 -return -ENOENT;
 -}
 -/*****************************************************************************/
 -/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
 -#if ((defined(EASYCAP_IS_VIDEODEV_CLIENT)) || \
 -      (defined(EASYCAP_NEEDS_UNLOCKED_IOCTL)))
 -long
 -easycap_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg) {
 -      return (long)easycap_ioctl((struct inode *)NULL, file, cmd, arg);
 +      SAM("WARNING: failed to adjust mute: control not found\n");
 +      return -ENOENT;
  }
 -#endif /*EASYCAP_IS_VIDEODEV_CLIENT||EASYCAP_NEEDS_UNLOCKED_IOCTL*/
 -/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
  /*---------------------------------------------------------------------------*/
 -int
 -easycap_ioctl(struct inode *inode, struct file *file,
 -                                      unsigned int cmd, unsigned long arg)
 +long easycap_unlocked_ioctl(struct file *file,
 +                          unsigned int cmd, unsigned long arg)
  {
 -struct easycap *peasycap;
 -struct usb_device *p;
 -int kd;
 +      struct easycap *peasycap;
 +      struct usb_device *p;
 +      int kd;
  
 -if (NULL == file) {
 -      SAY("ERROR:  file is NULL\n");
 -      return -ERESTARTSYS;
 -}
 -peasycap = file->private_data;
 -if (NULL == peasycap) {
 -      SAY("ERROR:  peasycap is NULL\n");
 -      return -1;
 -}
 -if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
 -      SAY("ERROR: bad peasycap\n");
 -      return -EFAULT;
 -}
 -p = peasycap->pusb_device;
 -if (NULL == p) {
 -      SAM("ERROR: peasycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -kd = isdongle(peasycap);
 -if (0 <= kd && DONGLE_MANY > kd) {
 -      if (mutex_lock_interruptible(&easycap_dongle[kd].mutex_video)) {
 -              SAY("ERROR: cannot lock easycap_dongle[%i].mutex_video\n", kd);
 -              return -ERESTARTSYS;
 -      }
 -      JOM(4, "locked easycap_dongle[%i].mutex_video\n", kd);
 -/*---------------------------------------------------------------------------*/
 -/*
 - *  MEANWHILE, easycap_usb_disconnect() MAY HAVE FREED POINTER peasycap,
 - *  IN WHICH CASE A REPEAT CALL TO isdongle() WILL FAIL.
 - *  IF NECESSARY, BAIL OUT.
 -*/
 -/*---------------------------------------------------------------------------*/
 -      if (kd != isdongle(peasycap))
 -              return -ERESTARTSYS;
 -      if (NULL == file) {
 +      if (!file) {
                SAY("ERROR:  file is NULL\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
                return -ERESTARTSYS;
        }
        peasycap = file->private_data;
 -      if (NULL == peasycap) {
 +      if (!peasycap) {
                SAY("ERROR:  peasycap is NULL\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -ERESTARTSYS;
 +              return -1;
        }
        if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
                SAY("ERROR: bad peasycap\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
                return -EFAULT;
        }
        p = peasycap->pusb_device;
 -      if (NULL == peasycap->pusb_device) {
 +      if (!p) {
                SAM("ERROR: peasycap->pusb_device is NULL\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -ERESTARTSYS;
 +              return -EFAULT;
        }
 -} else {
 +      kd = isdongle(peasycap);
 +      if (0 <= kd && DONGLE_MANY > kd) {
 +              if (mutex_lock_interruptible(&easycapdc60_dongle[kd].mutex_video)) {
 +                      SAY("ERROR: cannot lock "
 +                          "easycapdc60_dongle[%i].mutex_video\n", kd);
 +                      return -ERESTARTSYS;
 +              }
 +              JOM(4, "locked easycapdc60_dongle[%i].mutex_video\n", kd);
 +/*---------------------------------------------------------------------------*/
 +/*
 + *  MEANWHILE, easycap_usb_disconnect() MAY HAVE FREED POINTER peasycap,
 + *  IN WHICH CASE A REPEAT CALL TO isdongle() WILL FAIL.
 + *  IF NECESSARY, BAIL OUT.
 + */
 +/*---------------------------------------------------------------------------*/
 +              if (kd != isdongle(peasycap))
 +                      return -ERESTARTSYS;
 +              if (!file) {
 +                      SAY("ERROR:  file is NULL\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ERESTARTSYS;
 +              }
 +              peasycap = file->private_data;
 +              if (!peasycap) {
 +                      SAY("ERROR:  peasycap is NULL\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ERESTARTSYS;
 +              }
 +              if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
 +                      SAY("ERROR: bad peasycap\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              p = peasycap->pusb_device;
 +              if (!peasycap->pusb_device) {
 +                      SAM("ERROR: peasycap->pusb_device is NULL\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ERESTARTSYS;
 +              }
 +      } else {
  /*---------------------------------------------------------------------------*/
  /*
   *  IF easycap_usb_disconnect() HAS ALREADY FREED POINTER peasycap BEFORE THE
   *  ATTEMPT TO ACQUIRE THE SEMAPHORE, isdongle() WILL HAVE FAILED.  BAIL OUT.
 -*/
 -/*---------------------------------------------------------------------------*/
 -      return -ERESTARTSYS;
 -}
 + */
  /*---------------------------------------------------------------------------*/
 -switch (cmd) {
 -case VIDIOC_QUERYCAP: {
 -      struct v4l2_capability v4l2_capability;
 -      char version[16], *p1, *p2;
 -      int i, rc, k[3];
 -      long lng;
 -
 -      JOM(8, "VIDIOC_QUERYCAP\n");
 -
 -      if (16 <= strlen(EASYCAP_DRIVER_VERSION)) {
 -              SAM("ERROR: bad driver version string\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 +              return -ERESTARTSYS;
        }
 -      strcpy(&version[0], EASYCAP_DRIVER_VERSION);
 -      for (i = 0; i < 3; i++)
 -              k[i] = 0;
 -      p2 = &version[0];  i = 0;
 -      while (*p2) {
 -              p1 = p2;
 -              while (*p2 && ('.' != *p2))
 -                      p2++;
 -              if (*p2)
 -                      *p2++ = 0;
 -              if (3 > i) {
 -                      rc = (int) strict_strtol(p1, 10, &lng);
 -                      if (0 != rc) {
 -                              SAM("ERROR: %i=strict_strtol(%s,.,,)\n", \
 -                                                              rc, p1);
 -                              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -                              return -EINVAL;
 +/*---------------------------------------------------------------------------*/
 +      switch (cmd) {
 +      case VIDIOC_QUERYCAP: {
 +              struct v4l2_capability v4l2_capability;
 +              char version[16], *p1, *p2;
 +              int i, rc, k[3];
 +              long lng;
 +
 +              JOM(8, "VIDIOC_QUERYCAP\n");
 +
 +              if (16 <= strlen(EASYCAP_DRIVER_VERSION)) {
 +                      SAM("ERROR: bad driver version string\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              strcpy(&version[0], EASYCAP_DRIVER_VERSION);
 +              for (i = 0; i < 3; i++)
 +                      k[i] = 0;
 +              p2 = &version[0];
 +              i = 0;
 +              while (*p2) {
 +                      p1 = p2;
 +                      while (*p2 && ('.' != *p2))
 +                              p2++;
 +                      if (*p2)
 +                              *p2++ = 0;
 +                      if (3 > i) {
 +                              rc = (int) strict_strtol(p1, 10, &lng);
 +                              if (rc) {
 +                                      SAM("ERROR: %i=strict_strtol(%s,.,,)\n",
 +                                          rc, p1);
 +                                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                                      return -EINVAL;
 +                              }
 +                              k[i] = (int)lng;
                        }
 -                      k[i] = (int)lng;
 +                      i++;
                }
 -              i++;
 -      }
  
 -      memset(&v4l2_capability, 0, sizeof(struct v4l2_capability));
 -      strlcpy(&v4l2_capability.driver[0], "easycap", \
 -                                      sizeof(v4l2_capability.driver));
 +              memset(&v4l2_capability, 0, sizeof(struct v4l2_capability));
 +              strlcpy(&v4l2_capability.driver[0],
 +                      "easycap", sizeof(v4l2_capability.driver));
  
 -      v4l2_capability.capabilities = \
 -                              V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | \
 -                              V4L2_CAP_AUDIO         | V4L2_CAP_READWRITE;
 +              v4l2_capability.capabilities = V4L2_CAP_VIDEO_CAPTURE |
 +                                              V4L2_CAP_STREAMING |
 +                                              V4L2_CAP_AUDIO |
 +                                              V4L2_CAP_READWRITE;
  
 -      v4l2_capability.version = KERNEL_VERSION(k[0], k[1], k[2]);
 -      JOM(8, "v4l2_capability.version=(%i,%i,%i)\n", k[0], k[1], k[2]);
 +              v4l2_capability.version = KERNEL_VERSION(k[0], k[1], k[2]);
 +              JOM(8, "v4l2_capability.version=(%i,%i,%i)\n", k[0], k[1], k[2]);
  
 -      strlcpy(&v4l2_capability.card[0], "EasyCAP DC60", \
 -              sizeof(v4l2_capability.card));
 +              strlcpy(&v4l2_capability.card[0],
 +                      "EasyCAP DC60", sizeof(v4l2_capability.card));
  
 -      if (usb_make_path(peasycap->pusb_device, &v4l2_capability.bus_info[0],\
 +              if (usb_make_path(peasycap->pusb_device,
 +                              &v4l2_capability.bus_info[0],
                                sizeof(v4l2_capability.bus_info)) < 0) {
 -              strlcpy(&v4l2_capability.bus_info[0], "EasyCAP bus_info", \
 -                                      sizeof(v4l2_capability.bus_info));
 -              JOM(8, "%s=v4l2_capability.bus_info\n", \
 -                                      &v4l2_capability.bus_info[0]);
 -      }
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_capability, \
 -                                      sizeof(struct v4l2_capability))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +
 +                      strlcpy(&v4l2_capability.bus_info[0], "EasyCAP bus_info",
 +                              sizeof(v4l2_capability.bus_info));
 +                      JOM(8, "%s=v4l2_capability.bus_info\n",
 +                              &v4l2_capability.bus_info[0]);
 +              }
 +              if (copy_to_user((void __user *)arg, &v4l2_capability,
 +                              sizeof(struct v4l2_capability))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_ENUMINPUT: {
 -      struct v4l2_input v4l2_input;
 -      __u32 index;
 +      case VIDIOC_ENUMINPUT: {
 +              struct v4l2_input v4l2_input;
 +              u32 index;
  
 -      JOM(8, "VIDIOC_ENUMINPUT\n");
 +              JOM(8, "VIDIOC_ENUMINPUT\n");
  
 -      if (0 != copy_from_user(&v4l2_input, (void __user *)arg, \
 +              if (copy_from_user(&v4l2_input, (void __user *)arg,
                                        sizeof(struct v4l2_input))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      index = v4l2_input.index;
 -      memset(&v4l2_input, 0, sizeof(struct v4l2_input));
 -
 -      switch (index) {
 -      case 0: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS0");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 1: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS1");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 2: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS2");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 3: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS3");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 4: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS4");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 5: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "S-VIDEO");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      default: {
 -              JOM(8, "%i=index: exhausts inputs\n", index);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      }
 +              index = v4l2_input.index;
 +              memset(&v4l2_input, 0, sizeof(struct v4l2_input));
  
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_input, \
 -                                              sizeof(struct v4l2_input))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              switch (index) {
 +              case 0: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS0");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL |
 +                                      V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 1: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS1");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 2: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS2");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 3: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS3");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 4: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS4");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 5: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "S-VIDEO");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              default: {
 +                      JOM(8, "%i=index: exhausts inputs\n", index);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              }
 +
 +              if (copy_to_user((void __user *)arg, &v4l2_input,
 +                              sizeof(struct v4l2_input))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_INPUT: {
 -      __u32 index;
 -
 -      JOM(8, "VIDIOC_G_INPUT\n");
 -      index = (__u32)peasycap->input;
 -      JOM(8, "user is told: %i\n", index);
 -      if (0 != copy_to_user((void __user *)arg, &index, sizeof(__u32))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +      case VIDIOC_G_INPUT: {
 +              u32 index;
 +
 +              JOM(8, "VIDIOC_G_INPUT\n");
 +              index = (u32)peasycap->input;
 +              JOM(8, "user is told: %i\n", index);
 +              if (copy_to_user((void __user *)arg, &index, sizeof(u32))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_INPUT:
 +      case VIDIOC_S_INPUT:
        {
 -      __u32 index;
 -      int rc;
 +              u32 index;
 +              int rc;
  
 -      JOM(8, "VIDIOC_S_INPUT\n");
 +              JOM(8, "VIDIOC_S_INPUT\n");
  
 -      if (0 != copy_from_user(&index, (void __user *)arg, sizeof(__u32))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (0 != copy_from_user(&index, (void __user *)arg, sizeof(u32))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      JOM(8, "user requests input %i\n", index);
 +              JOM(8, "user requests input %i\n", index);
  
 -      if ((int)index == peasycap->input) {
 -              SAM("requested input already in effect\n");
 -              break;
 -      }
 +              if ((int)index == peasycap->input) {
 +                      SAM("requested input already in effect\n");
 +                      break;
 +              }
  
 -      if ((0 > index) || (INPUT_MANY <= index)) {
 -              JOM(8, "ERROR:  bad requested input: %i\n", index);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 +              if ((0 > index) || (INPUT_MANY <= index)) {
 +                      JOM(8, "ERROR:  bad requested input: %i\n", index);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
  
 -      rc = newinput(peasycap, (int)index);
 -      if (0 == rc) {
 -              JOM(8, "newinput(.,%i) OK\n", (int)index);
 -      } else {
 -              SAM("ERROR: newinput(.,%i) returned %i\n", (int)index, rc);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              rc = newinput(peasycap, (int)index);
 +              if (0 == rc) {
 +                      JOM(8, "newinput(.,%i) OK\n", (int)index);
 +              } else {
 +                      SAM("ERROR: newinput(.,%i) returned %i\n", (int)index, rc);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_ENUMAUDIO: {
 -      JOM(8, "VIDIOC_ENUMAUDIO\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 +      case VIDIOC_ENUMAUDIO: {
 +              JOM(8, "VIDIOC_ENUMAUDIO\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
 +      }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_ENUMAUDOUT: {
 -      struct v4l2_audioout v4l2_audioout;
 +      case VIDIOC_ENUMAUDOUT: {
 +              struct v4l2_audioout v4l2_audioout;
  
 -      JOM(8, "VIDIOC_ENUMAUDOUT\n");
 +              JOM(8, "VIDIOC_ENUMAUDOUT\n");
  
 -      if (0 != copy_from_user(&v4l2_audioout, (void __user *)arg, \
 +              if (copy_from_user(&v4l2_audioout, (void __user *)arg,
                                        sizeof(struct v4l2_audioout))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (0 != v4l2_audioout.index) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      memset(&v4l2_audioout, 0, sizeof(struct v4l2_audioout));
 -      v4l2_audioout.index = 0;
 -      strcpy(&v4l2_audioout.name[0], "Soundtrack");
 +              if (0 != v4l2_audioout.index) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              memset(&v4l2_audioout, 0, sizeof(struct v4l2_audioout));
 +              v4l2_audioout.index = 0;
 +              strcpy(&v4l2_audioout.name[0], "Soundtrack");
  
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_audioout, \
 -                                      sizeof(struct v4l2_audioout))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              if (copy_to_user((void __user *)arg, &v4l2_audioout,
 +                              sizeof(struct v4l2_audioout))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_QUERYCTRL: {
 -      int i1;
 -      struct v4l2_queryctrl v4l2_queryctrl;
 +      case VIDIOC_QUERYCTRL: {
 +              int i1;
 +              struct v4l2_queryctrl v4l2_queryctrl;
  
 -      JOM(8, "VIDIOC_QUERYCTRL\n");
 +              JOM(8, "VIDIOC_QUERYCTRL\n");
  
 -      if (0 != copy_from_user(&v4l2_queryctrl, (void __user *)arg, \
 -                                      sizeof(struct v4l2_queryctrl))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (0 != copy_from_user(&v4l2_queryctrl, (void __user *)arg,
 +                              sizeof(struct v4l2_queryctrl))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      i1 = 0;
 -      while (0xFFFFFFFF != easycap_control[i1].id) {
 -              if (easycap_control[i1].id == v4l2_queryctrl.id) {
 -                      JOM(8, "VIDIOC_QUERYCTRL  %s=easycap_control[%i]" \
 -                              ".name\n", &easycap_control[i1].name[0], i1);
 -                      memcpy(&v4l2_queryctrl, &easycap_control[i1], \
 -                                              sizeof(struct v4l2_queryctrl));
 -                      break;
 +              i1 = 0;
 +              while (0xFFFFFFFF != easycap_control[i1].id) {
 +                      if (easycap_control[i1].id == v4l2_queryctrl.id) {
 +                              JOM(8, "VIDIOC_QUERYCTRL  %s=easycap_control[%i]"
 +                                  ".name\n", &easycap_control[i1].name[0], i1);
 +                              memcpy(&v4l2_queryctrl, &easycap_control[i1],
 +                                     sizeof(struct v4l2_queryctrl));
 +                              break;
 +                      }
 +                      i1++;
                }
 -              i1++;
 +              if (0xFFFFFFFF == easycap_control[i1].id) {
 +                      JOM(8, "%i=index: exhausts controls\n", i1);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              if (copy_to_user((void __user *)arg, &v4l2_queryctrl,
 +                              sizeof(struct v4l2_queryctrl))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      if (0xFFFFFFFF == easycap_control[i1].id) {
 -              JOM(8, "%i=index: exhausts controls\n", i1);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_QUERYMENU: {
 +              JOM(8, "VIDIOC_QUERYMENU unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
                return -EINVAL;
        }
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_queryctrl, \
 -                                      sizeof(struct v4l2_queryctrl))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_QUERYMENU: {
 -      JOM(8, "VIDIOC_QUERYMENU unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_CTRL: {
 -      struct v4l2_control *pv4l2_control;
 -
 -      JOM(8, "VIDIOC_G_CTRL\n");
 -      pv4l2_control = kzalloc(sizeof(struct v4l2_control), GFP_KERNEL);
 -      if (!pv4l2_control) {
 -              SAM("ERROR: out of memory\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -ENOMEM;
 -      }
 -      if (0 != copy_from_user(pv4l2_control, (void __user *)arg, \
 -                                      sizeof(struct v4l2_control))) {
 -              kfree(pv4l2_control);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +      case VIDIOC_G_CTRL: {
 +              struct v4l2_control *pv4l2_control;
 +
 +              JOM(8, "VIDIOC_G_CTRL\n");
 +              pv4l2_control = kzalloc(sizeof(struct v4l2_control), GFP_KERNEL);
 +              if (!pv4l2_control) {
 +                      SAM("ERROR: out of memory\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ENOMEM;
 +              }
 +              if (0 != copy_from_user(pv4l2_control, (void __user *)arg,
 +                              sizeof(struct v4l2_control))) {
 +                      kfree(pv4l2_control);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      switch (pv4l2_control->id) {
 -      case V4L2_CID_BRIGHTNESS: {
 -              pv4l2_control->value = peasycap->brightness;
 -              JOM(8, "user enquires brightness: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_CONTRAST: {
 -              pv4l2_control->value = peasycap->contrast;
 -              JOM(8, "user enquires contrast: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_SATURATION: {
 -              pv4l2_control->value = peasycap->saturation;
 -              JOM(8, "user enquires saturation: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_HUE: {
 -              pv4l2_control->value = peasycap->hue;
 -              JOM(8, "user enquires hue: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_AUDIO_VOLUME: {
 -              pv4l2_control->value = peasycap->volume;
 -              JOM(8, "user enquires volume: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_AUDIO_MUTE: {
 -              if (1 == peasycap->mute)
 -                      pv4l2_control->value = true;
 -              else
 -                      pv4l2_control->value = false;
 -              JOM(8, "user enquires mute: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      default: {
 -              SAM("ERROR: unknown V4L2 control: 0x%08X=id\n", \
 -                                                      pv4l2_control->id);
 -              kfree(pv4l2_control);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      }
 -      if (0 != copy_to_user((void __user *)arg, pv4l2_control, \
 -                                      sizeof(struct v4l2_control))) {
 +              switch (pv4l2_control->id) {
 +              case V4L2_CID_BRIGHTNESS: {
 +                      pv4l2_control->value = peasycap->brightness;
 +                      JOM(8, "user enquires brightness: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_CONTRAST: {
 +                      pv4l2_control->value = peasycap->contrast;
 +                      JOM(8, "user enquires contrast: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_SATURATION: {
 +                      pv4l2_control->value = peasycap->saturation;
 +                      JOM(8, "user enquires saturation: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_HUE: {
 +                      pv4l2_control->value = peasycap->hue;
 +                      JOM(8, "user enquires hue: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_AUDIO_VOLUME: {
 +                      pv4l2_control->value = peasycap->volume;
 +                      JOM(8, "user enquires volume: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_AUDIO_MUTE: {
 +                      if (1 == peasycap->mute)
 +                              pv4l2_control->value = true;
 +                      else
 +                              pv4l2_control->value = false;
 +                      JOM(8, "user enquires mute: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              default: {
 +                      SAM("ERROR: unknown V4L2 control: 0x%08X=id\n",
 +                          pv4l2_control->id);
 +                      kfree(pv4l2_control);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              }
 +              if (copy_to_user((void __user *)arg, pv4l2_control,
 +                              sizeof(struct v4l2_control))) {
 +                      kfree(pv4l2_control);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
                kfree(pv4l2_control);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -      kfree(pv4l2_control);
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_CTRL:
 -      {
 -      struct v4l2_control v4l2_control;
 -
 -      JOM(8, "VIDIOC_S_CTRL\n");
 -
 -      if (0 != copy_from_user(&v4l2_control, (void __user *)arg, \
 -                                      sizeof(struct v4l2_control))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -
 -      switch (v4l2_control.id) {
 -      case V4L2_CID_BRIGHTNESS: {
 -              JOM(8, "user requests brightness %i\n", v4l2_control.value);
 -              if (0 != adjust_brightness(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_CONTRAST: {
 -              JOM(8, "user requests contrast %i\n", v4l2_control.value);
 -              if (0 != adjust_contrast(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_SATURATION: {
 -              JOM(8, "user requests saturation %i\n", v4l2_control.value);
 -              if (0 != adjust_saturation(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_HUE: {
 -              JOM(8, "user requests hue %i\n", v4l2_control.value);
 -              if (0 != adjust_hue(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_AUDIO_VOLUME: {
 -              JOM(8, "user requests volume %i\n", v4l2_control.value);
 -              if (0 != adjust_volume(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_AUDIO_MUTE: {
 -              int mute;
 -
 -              JOM(8, "user requests mute %i\n", v4l2_control.value);
 -              if (true == v4l2_control.value)
 -                      mute = 1;
 -              else
 -                      mute = 0;
 -
 -              if (0 != adjust_mute(peasycap, mute))
 -                      SAM("WARNING: failed to adjust mute to %i\n", mute);
                break;
        }
 -      default: {
 -              SAM("ERROR: unknown V4L2 control: 0x%08X=id\n", \
 -                                                      v4l2_control.id);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      }
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_EXT_CTRLS: {
 -      JOM(8, "VIDIOC_S_EXT_CTRLS unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-       case VIDIOC_S_CTRL:
-       {
 -case VIDIOC_ENUM_FMT: {
 -      __u32 index;
 -      struct v4l2_fmtdesc v4l2_fmtdesc;
++      case VIDIOC_S_CTRL: {
 +              struct v4l2_control v4l2_control;
  
 -      JOM(8, "VIDIOC_ENUM_FMT\n");
 +              JOM(8, "VIDIOC_S_CTRL\n");
  
 -      if (0 != copy_from_user(&v4l2_fmtdesc, (void __user *)arg, \
 -                                      sizeof(struct v4l2_fmtdesc))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (0 != copy_from_user(&v4l2_control, (void __user *)arg,
 +                              sizeof(struct v4l2_control))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      index = v4l2_fmtdesc.index;
 -      memset(&v4l2_fmtdesc, 0, sizeof(struct v4l2_fmtdesc));
 +              switch (v4l2_control.id) {
 +              case V4L2_CID_BRIGHTNESS: {
 +                      JOM(8, "user requests brightness %i\n", v4l2_control.value);
 +                      if (0 != adjust_brightness(peasycap, v4l2_control.value))
 +                              ;
 +                      break;
 +              }
 +              case V4L2_CID_CONTRAST: {
 +                      JOM(8, "user requests contrast %i\n", v4l2_control.value);
 +                      if (0 != adjust_contrast(peasycap, v4l2_control.value))
 +                              ;
 +                      break;
 +              }
 +              case V4L2_CID_SATURATION: {
 +                      JOM(8, "user requests saturation %i\n", v4l2_control.value);
 +                      if (0 != adjust_saturation(peasycap, v4l2_control.value))
 +                              ;
 +                      break;
 +              }
 +              case V4L2_CID_HUE: {
 +                      JOM(8, "user requests hue %i\n", v4l2_control.value);
 +                      if (0 != adjust_hue(peasycap, v4l2_control.value))
 +                              ;
 +                      break;
 +              }
 +              case V4L2_CID_AUDIO_VOLUME: {
 +                      JOM(8, "user requests volume %i\n", v4l2_control.value);
 +                      if (0 != adjust_volume(peasycap, v4l2_control.value))
 +                              ;
 +                      break;
 +              }
 +              case V4L2_CID_AUDIO_MUTE: {
 +                      int mute;
  
 -      v4l2_fmtdesc.index = index;
 -      v4l2_fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 +                      JOM(8, "user requests mute %i\n", v4l2_control.value);
 +                      if (v4l2_control.value)
 +                              mute = 1;
 +                      else
 +                              mute = 0;
  
 -      switch (index) {
 -      case 0: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "uyvy");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_UYVY;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 1: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "yuy2");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_YUYV;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 2: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "rgb24");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_RGB24;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 3: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "rgb32");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_RGB32;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 4: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "bgr24");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_BGR24;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 5: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "bgr32");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_BGR32;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 +                      if (0 != adjust_mute(peasycap, mute))
 +                              SAM("WARNING: failed to adjust mute to %i\n", mute);
 +                      break;
 +              }
 +              default: {
 +                      SAM("ERROR: unknown V4L2 control: 0x%08X=id\n",
 +                          v4l2_control.id);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              }
                break;
        }
 -      default: {
 -              JOM(8, "%i=index: exhausts formats\n", index);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_S_EXT_CTRLS: {
 +              JOM(8, "VIDIOC_S_EXT_CTRLS unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
                return -EINVAL;
        }
 -      }
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_fmtdesc, \
 -                                      sizeof(struct v4l2_fmtdesc))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -/*
 - *  THE RESPONSE TO VIDIOC_ENUM_FRAMESIZES MUST BE CONDITIONED ON THE
 - *  THE CURRENT STANDARD, BECAUSE THAT IS WHAT gstreamer EXPECTS.  BEWARE.
 -*/
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_ENUM_FRAMESIZES: {
 -      __u32 index;
 -      struct v4l2_frmsizeenum v4l2_frmsizeenum;
 +      case VIDIOC_ENUM_FMT: {
 +              u32 index;
 +              struct v4l2_fmtdesc v4l2_fmtdesc;
  
 -      JOM(8, "VIDIOC_ENUM_FRAMESIZES\n");
 +              JOM(8, "VIDIOC_ENUM_FMT\n");
  
 -      if (0 != copy_from_user(&v4l2_frmsizeenum, (void __user *)arg, \
 -                                      sizeof(struct v4l2_frmsizeenum))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (0 != copy_from_user(&v4l2_fmtdesc, (void __user *)arg,
 +                              sizeof(struct v4l2_fmtdesc))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      index = v4l2_frmsizeenum.index;
 +              index = v4l2_fmtdesc.index;
 +              memset(&v4l2_fmtdesc, 0, sizeof(struct v4l2_fmtdesc));
  
 -      v4l2_frmsizeenum.type = (__u32) V4L2_FRMSIZE_TYPE_DISCRETE;
 +              v4l2_fmtdesc.index = index;
 +              v4l2_fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  
 -      if (true == peasycap->ntsc) {
                switch (index) {
                case 0: {
 -                      v4l2_frmsizeenum.discrete.width = 640;
 -                      v4l2_frmsizeenum.discrete.height = 480;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                               discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +                      v4l2_fmtdesc.flags = 0;
 +                      strcpy(&v4l2_fmtdesc.description[0], "uyvy");
 +                      v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_UYVY;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
                        break;
                }
                case 1: {
 -                      v4l2_frmsizeenum.discrete.width = 320;
 -                      v4l2_frmsizeenum.discrete.height = 240;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +                      v4l2_fmtdesc.flags = 0;
 +                      strcpy(&v4l2_fmtdesc.description[0], "yuy2");
 +                      v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_YUYV;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
                        break;
                }
                case 2: {
 -                      v4l2_frmsizeenum.discrete.width = 720;
 -                      v4l2_frmsizeenum.discrete.height = 480;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +                      v4l2_fmtdesc.flags = 0;
 +                      strcpy(&v4l2_fmtdesc.description[0], "rgb24");
 +                      v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_RGB24;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
                        break;
                }
                case 3: {
 -                      v4l2_frmsizeenum.discrete.width = 360;
 -                      v4l2_frmsizeenum.discrete.height = 240;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 -                      break;
 -              }
 -              default: {
 -                      JOM(8, "%i=index: exhausts framesizes\n", index);
 -                      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -                      return -EINVAL;
 -              }
 -              }
 -      } else {
 -              switch (index) {
 -              case 0: {
 -                      v4l2_frmsizeenum.discrete.width = 640;
 -                      v4l2_frmsizeenum.discrete.height = 480;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 -                      break;
 -              }
 -              case 1: {
 -                      v4l2_frmsizeenum.discrete.width = 320;
 -                      v4l2_frmsizeenum.discrete.height = 240;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +                      v4l2_fmtdesc.flags = 0;
 +                      strcpy(&v4l2_fmtdesc.description[0], "rgb32");
 +                      v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_RGB32;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
                        break;
                }
 -              case 2: {
 -                      v4l2_frmsizeenum.discrete.width = 704;
 -                      v4l2_frmsizeenum.discrete.height = 576;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 -                      break;
 -              }
 -              case 3: {
 -                      v4l2_frmsizeenum.discrete.width = 720;
 -                      v4l2_frmsizeenum.discrete.height = 576;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +              case 4: {
 +                      v4l2_fmtdesc.flags = 0;
 +                      strcpy(&v4l2_fmtdesc.description[0], "bgr24");
 +                      v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_BGR24;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
                        break;
                }
 -              case 4: {
 -                      v4l2_frmsizeenum.discrete.width = 360;
 -                      v4l2_frmsizeenum.discrete.height = 288;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +              case 5: {
 +                      v4l2_fmtdesc.flags = 0;
 +                      strcpy(&v4l2_fmtdesc.description[0], "bgr32");
 +                      v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_BGR32;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
                        break;
                }
                default: {
 -                      JOM(8, "%i=index: exhausts framesizes\n", index);
 -                      mutex_unlock(&easycap_dongle[kd].mutex_video);
 +                      JOM(8, "%i=index: exhausts formats\n", index);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
                        return -EINVAL;
                }
                }
 +              if (copy_to_user((void __user *)arg, &v4l2_fmtdesc,
 +                              sizeof(struct v4l2_fmtdesc))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_frmsizeenum, \
 -                                      sizeof(struct v4l2_frmsizeenum))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  /*
 - *  THE RESPONSE TO VIDIOC_ENUM_FRAMEINTERVALS MUST BE CONDITIONED ON THE
 - *  THE CURRENT STANDARD, BECAUSE THAT IS WHAT gstreamer EXPECTS.  BEWARE.
 -*/
 +       *  THE RESPONSE TO VIDIOC_ENUM_FRAMESIZES MUST BE CONDITIONED ON THE
 +       *  THE CURRENT STANDARD, BECAUSE THAT IS WHAT gstreamer EXPECTS.  BEWARE.
 +      */
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_ENUM_FRAMEINTERVALS: {
 -      __u32 index;
 -      int denominator;
 -      struct v4l2_frmivalenum v4l2_frmivalenum;
 +      case VIDIOC_ENUM_FRAMESIZES: {
 +              u32 index;
 +              struct v4l2_frmsizeenum v4l2_frmsizeenum;
  
 -      JOM(8, "VIDIOC_ENUM_FRAMEINTERVALS\n");
 +              JOM(8, "VIDIOC_ENUM_FRAMESIZES\n");
  
 -      if (peasycap->fps)
 -              denominator = peasycap->fps;
 -      else {
 -              if (true == peasycap->ntsc)
 -                      denominator = 30;
 -              else
 -                      denominator = 25;
 -      }
 +              if (0 != copy_from_user(&v4l2_frmsizeenum, (void __user *)arg,
 +                              sizeof(struct v4l2_frmsizeenum))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (0 != copy_from_user(&v4l2_frmivalenum, (void __user *)arg, \
 -                                      sizeof(struct v4l2_frmivalenum))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              index = v4l2_frmsizeenum.index;
 +
 +              v4l2_frmsizeenum.type = (u32) V4L2_FRMSIZE_TYPE_DISCRETE;
 +
 +              if (peasycap->ntsc) {
 +                      switch (index) {
 +                      case 0: {
 +                              v4l2_frmsizeenum.discrete.width = 640;
 +                              v4l2_frmsizeenum.discrete.height = 480;
 +                              JOM(8, "%i=index: %ix%i\n", index,
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.width),
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.height));
 +                              break;
 +                      }
 +                      case 1: {
 +                              v4l2_frmsizeenum.discrete.width = 320;
 +                              v4l2_frmsizeenum.discrete.height = 240;
 +                              JOM(8, "%i=index: %ix%i\n", index,
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.width),
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.height));
 +                              break;
 +                      }
 +                      case 2: {
 +                              v4l2_frmsizeenum.discrete.width = 720;
 +                              v4l2_frmsizeenum.discrete.height = 480;
 +                              JOM(8, "%i=index: %ix%i\n", index,
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.width),
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.height));
 +                              break;
 +                      }
 +                      case 3: {
 +                              v4l2_frmsizeenum.discrete.width = 360;
 +                              v4l2_frmsizeenum.discrete.height = 240;
 +                              JOM(8, "%i=index: %ix%i\n", index,
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.width),
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.height));
 +                              break;
 +                      }
 +                      default: {
 +                              JOM(8, "%i=index: exhausts framesizes\n", index);
 +                              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                              return -EINVAL;
 +                      }
 +                      }
 +              } else {
 +                      switch (index) {
 +                      case 0: {
 +                              v4l2_frmsizeenum.discrete.width = 640;
 +                              v4l2_frmsizeenum.discrete.height = 480;
 +                              JOM(8, "%i=index: %ix%i\n", index,
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.width),
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.height));
 +                              break;
 +                      }
 +                      case 1: {
 +                              v4l2_frmsizeenum.discrete.width = 320;
 +                              v4l2_frmsizeenum.discrete.height = 240;
 +                              JOM(8, "%i=index: %ix%i\n", index,
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.width),
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.height));
 +                              break;
 +                      }
 +                      case 2: {
 +                              v4l2_frmsizeenum.discrete.width = 704;
 +                              v4l2_frmsizeenum.discrete.height = 576;
 +                              JOM(8, "%i=index: %ix%i\n", index,
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.width),
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.height));
 +                              break;
 +                      }
 +                      case 3: {
 +                              v4l2_frmsizeenum.discrete.width = 720;
 +                              v4l2_frmsizeenum.discrete.height = 576;
 +                              JOM(8, "%i=index: %ix%i\n", index,
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.width),
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.height));
 +                              break;
 +                      }
 +                      case 4: {
 +                              v4l2_frmsizeenum.discrete.width = 360;
 +                              v4l2_frmsizeenum.discrete.height = 288;
 +                              JOM(8, "%i=index: %ix%i\n", index,
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.width),
 +                                  (int)(v4l2_frmsizeenum.
 +                                        discrete.height));
 +                              break;
 +                      }
 +                      default: {
 +                              JOM(8, "%i=index: exhausts framesizes\n", index);
 +                              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                              return -EINVAL;
 +                      }
 +                      }
 +              }
 +              if (copy_to_user((void __user *)arg, &v4l2_frmsizeenum,
 +                              sizeof(struct v4l2_frmsizeenum))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +/*
 +       *  THE RESPONSE TO VIDIOC_ENUM_FRAMEINTERVALS MUST BE CONDITIONED ON THE
 +       *  THE CURRENT STANDARD, BECAUSE THAT IS WHAT gstreamer EXPECTS.  BEWARE.
 +      */
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_ENUM_FRAMEINTERVALS: {
 +              u32 index;
 +              int denominator;
 +              struct v4l2_frmivalenum v4l2_frmivalenum;
 +
 +              JOM(8, "VIDIOC_ENUM_FRAMEINTERVALS\n");
 +
 +              if (peasycap->fps)
 +                      denominator = peasycap->fps;
 +              else {
 +                      if (peasycap->ntsc)
 +                              denominator = 30;
 +                      else
 +                              denominator = 25;
 +              }
  
 -      index = v4l2_frmivalenum.index;
 +              if (0 != copy_from_user(&v4l2_frmivalenum, (void __user *)arg,
 +                              sizeof(struct v4l2_frmivalenum))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      v4l2_frmivalenum.type = (__u32) V4L2_FRMIVAL_TYPE_DISCRETE;
 +              index = v4l2_frmivalenum.index;
  
 -      switch (index) {
 -      case 0: {
 -              v4l2_frmivalenum.discrete.numerator = 1;
 -              v4l2_frmivalenum.discrete.denominator = denominator;
 -              JOM(8, "%i=index: %i/%i\n", index, \
 -                      (int)(v4l2_frmivalenum.discrete.numerator), \
 -                      (int)(v4l2_frmivalenum.discrete.denominator));
 -              break;
 -      }
 -      case 1: {
 -              v4l2_frmivalenum.discrete.numerator = 1;
 -              v4l2_frmivalenum.discrete.denominator = denominator/5;
 -              JOM(8, "%i=index: %i/%i\n", index, \
 -                      (int)(v4l2_frmivalenum.discrete.numerator), \
 -                      (int)(v4l2_frmivalenum.discrete.denominator));
 -              break;
 -      }
 -      default: {
 -              JOM(8, "%i=index: exhausts frameintervals\n", index);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      }
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_frmivalenum, \
 +              v4l2_frmivalenum.type = (u32) V4L2_FRMIVAL_TYPE_DISCRETE;
 +
 +              switch (index) {
 +              case 0: {
 +                      v4l2_frmivalenum.discrete.numerator = 1;
 +                      v4l2_frmivalenum.discrete.denominator = denominator;
 +                      JOM(8, "%i=index: %i/%i\n", index,
 +                          (int)(v4l2_frmivalenum.discrete.numerator),
 +                          (int)(v4l2_frmivalenum.discrete.denominator));
 +                      break;
 +              }
 +              case 1: {
 +                      v4l2_frmivalenum.discrete.numerator = 1;
 +                      v4l2_frmivalenum.discrete.denominator = denominator/5;
 +                      JOM(8, "%i=index: %i/%i\n", index,
 +                          (int)(v4l2_frmivalenum.discrete.numerator),
 +                          (int)(v4l2_frmivalenum.discrete.denominator));
 +                      break;
 +              }
 +              default: {
 +                      JOM(8, "%i=index: exhausts frameintervals\n", index);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              }
 +              if (copy_to_user((void __user *)arg, &v4l2_frmivalenum,
                                        sizeof(struct v4l2_frmivalenum))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_FMT: {
 -      struct v4l2_format *pv4l2_format;
 -      struct v4l2_pix_format *pv4l2_pix_format;
 -
 -      JOM(8, "VIDIOC_G_FMT\n");
 -      pv4l2_format = kzalloc(sizeof(struct v4l2_format), GFP_KERNEL);
 -      if (!pv4l2_format) {
 -              SAM("ERROR: out of memory\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -ENOMEM;
 -      }
 -      pv4l2_pix_format = kzalloc(sizeof(struct v4l2_pix_format), GFP_KERNEL);
 -      if (!pv4l2_pix_format) {
 -              SAM("ERROR: out of memory\n");
 -              kfree(pv4l2_format);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -ENOMEM;
 -      }
 -      if (0 != copy_from_user(pv4l2_format, (void __user *)arg, \
 +      case VIDIOC_G_FMT: {
 +              struct v4l2_format *pv4l2_format;
 +              struct v4l2_pix_format *pv4l2_pix_format;
 +
 +              JOM(8, "VIDIOC_G_FMT\n");
 +              pv4l2_format = kzalloc(sizeof(struct v4l2_format), GFP_KERNEL);
 +              if (!pv4l2_format) {
 +                      SAM("ERROR: out of memory\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ENOMEM;
 +              }
 +              pv4l2_pix_format = kzalloc(sizeof(struct v4l2_pix_format), GFP_KERNEL);
 +              if (!pv4l2_pix_format) {
 +                      SAM("ERROR: out of memory\n");
 +                      kfree(pv4l2_format);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ENOMEM;
 +              }
 +              if (0 != copy_from_user(pv4l2_format, (void __user *)arg,
                                        sizeof(struct v4l2_format))) {
 -              kfree(pv4l2_format);
 -              kfree(pv4l2_pix_format);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +                      kfree(pv4l2_format);
 +                      kfree(pv4l2_pix_format);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (pv4l2_format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 -              kfree(pv4l2_format);
 -              kfree(pv4l2_pix_format);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 +              if (pv4l2_format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 +                      kfree(pv4l2_format);
 +                      kfree(pv4l2_pix_format);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
  
 -      memset(pv4l2_pix_format, 0, sizeof(struct v4l2_pix_format));
 -      pv4l2_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 -      memcpy(&pv4l2_format->fmt.pix, \
 -                       &easycap_format[peasycap->format_offset]\
 -                      .v4l2_format.fmt.pix, sizeof(struct v4l2_pix_format));
 -      JOM(8, "user is told: %s\n", \
 -                      &easycap_format[peasycap->format_offset].name[0]);
 +              memset(pv4l2_pix_format, 0, sizeof(struct v4l2_pix_format));
 +              pv4l2_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 +              memcpy(&pv4l2_format->fmt.pix,
 +                     &easycap_format[peasycap->format_offset]
 +                     .v4l2_format.fmt.pix, sizeof(struct v4l2_pix_format));
 +              JOM(8, "user is told: %s\n",
 +                  &easycap_format[peasycap->format_offset].name[0]);
  
 -      if (0 != copy_to_user((void __user *)arg, pv4l2_format, \
 +              if (copy_to_user((void __user *)arg, pv4l2_format,
                                        sizeof(struct v4l2_format))) {
 +                      kfree(pv4l2_format);
 +                      kfree(pv4l2_pix_format);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
                kfree(pv4l2_format);
                kfree(pv4l2_pix_format);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              break;
        }
 -      kfree(pv4l2_format);
 -      kfree(pv4l2_pix_format);
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_TRY_FMT:
 -case VIDIOC_S_FMT: {
 -      struct v4l2_format v4l2_format;
 -      struct v4l2_pix_format v4l2_pix_format;
 -      bool try;
 -      int best_format;
 -
 -      if (VIDIOC_TRY_FMT == cmd) {
 -              JOM(8, "VIDIOC_TRY_FMT\n");
 -              try = true;
 -      } else {
 -              JOM(8, "VIDIOC_S_FMT\n");
 -              try = false;
 -      }
 +      case VIDIOC_TRY_FMT:
 +      case VIDIOC_S_FMT: {
 +              struct v4l2_format v4l2_format;
 +              struct v4l2_pix_format v4l2_pix_format;
 +              bool try;
 +              int best_format;
 +
 +              if (VIDIOC_TRY_FMT == cmd) {
 +                      JOM(8, "VIDIOC_TRY_FMT\n");
 +                      try = true;
 +              } else {
 +                      JOM(8, "VIDIOC_S_FMT\n");
 +                      try = false;
 +              }
  
 -      if (0 != copy_from_user(&v4l2_format, (void __user *)arg, \
 +              if (0 != copy_from_user(&v4l2_format, (void __user *)arg,
                                        sizeof(struct v4l2_format))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      best_format = adjust_format(peasycap, \
 -                                      v4l2_format.fmt.pix.width, \
 -                                      v4l2_format.fmt.pix.height, \
 -                                      v4l2_format.fmt.pix.pixelformat, \
 -                                      v4l2_format.fmt.pix.field, \
 +              best_format = adjust_format(peasycap,
 +                                      v4l2_format.fmt.pix.width,
 +                                      v4l2_format.fmt.pix.height,
 +                                      v4l2_format.fmt.pix.pixelformat,
 +                                      v4l2_format.fmt.pix.field,
                                        try);
 -      if (0 > best_format) {
 -              if (-EBUSY == best_format) {
 -                      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -                      return -EBUSY;
 +              if (0 > best_format) {
 +                      if (-EBUSY == best_format) {
 +                              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                              return -EBUSY;
 +                      }
 +                      JOM(8, "WARNING: adjust_format() returned %i\n", best_format);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ENOENT;
                }
 -              JOM(8, "WARNING: adjust_format() returned %i\n", best_format);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -ENOENT;
 -      }
  /*...........................................................................*/
 -      memset(&v4l2_pix_format, 0, sizeof(struct v4l2_pix_format));
 -      v4l2_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 +              memset(&v4l2_pix_format, 0, sizeof(struct v4l2_pix_format));
 +              v4l2_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  
 -      memcpy(&(v4l2_format.fmt.pix), &(easycap_format[best_format]\
 -                      .v4l2_format.fmt.pix), sizeof(v4l2_pix_format));
 -      JOM(8, "user is told: %s\n", &easycap_format[best_format].name[0]);
 +              memcpy(&(v4l2_format.fmt.pix),
 +                      &(easycap_format[best_format].v4l2_format.fmt.pix),
 +                      sizeof(v4l2_pix_format));
 +              JOM(8, "user is told: %s\n", &easycap_format[best_format].name[0]);
  
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_format, \
 +              if (copy_to_user((void __user *)arg, &v4l2_format,
                                        sizeof(struct v4l2_format))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_CROPCAP: {
 -      struct v4l2_cropcap v4l2_cropcap;
 +      case VIDIOC_CROPCAP: {
 +              struct v4l2_cropcap v4l2_cropcap;
  
 -      JOM(8, "VIDIOC_CROPCAP\n");
 +              JOM(8, "VIDIOC_CROPCAP\n");
  
 -      if (0 != copy_from_user(&v4l2_cropcap, (void __user *)arg, \
 +              if (0 != copy_from_user(&v4l2_cropcap, (void __user *)arg,
                                        sizeof(struct v4l2_cropcap))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -
 -      if (v4l2_cropcap.type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
 -              JOM(8, "v4l2_cropcap.type != V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
 -
 -      memset(&v4l2_cropcap, 0, sizeof(struct v4l2_cropcap));
 -      v4l2_cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 -      v4l2_cropcap.bounds.left      = 0;
 -      v4l2_cropcap.bounds.top       = 0;
 -      v4l2_cropcap.bounds.width     = peasycap->width;
 -      v4l2_cropcap.bounds.height    = peasycap->height;
 -      v4l2_cropcap.defrect.left     = 0;
 -      v4l2_cropcap.defrect.top      = 0;
 -      v4l2_cropcap.defrect.width    = peasycap->width;
 -      v4l2_cropcap.defrect.height   = peasycap->height;
 -      v4l2_cropcap.pixelaspect.numerator = 1;
 -      v4l2_cropcap.pixelaspect.denominator = 1;
 -
 -      JOM(8, "user is told: %ix%i\n", peasycap->width, peasycap->height);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_cropcap, \
 +              if (v4l2_cropcap.type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
 +                      JOM(8, "v4l2_cropcap.type != V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
 +
 +              memset(&v4l2_cropcap, 0, sizeof(struct v4l2_cropcap));
 +              v4l2_cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 +              v4l2_cropcap.bounds.left      = 0;
 +              v4l2_cropcap.bounds.top       = 0;
 +              v4l2_cropcap.bounds.width     = peasycap->width;
 +              v4l2_cropcap.bounds.height    = peasycap->height;
 +              v4l2_cropcap.defrect.left     = 0;
 +              v4l2_cropcap.defrect.top      = 0;
 +              v4l2_cropcap.defrect.width    = peasycap->width;
 +              v4l2_cropcap.defrect.height   = peasycap->height;
 +              v4l2_cropcap.pixelaspect.numerator = 1;
 +              v4l2_cropcap.pixelaspect.denominator = 1;
 +
 +              JOM(8, "user is told: %ix%i\n", peasycap->width, peasycap->height);
 +
 +              if (copy_to_user((void __user *)arg, &v4l2_cropcap,
                                        sizeof(struct v4l2_cropcap))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_CROP:
 -case VIDIOC_S_CROP: {
 -      JOM(8, "VIDIOC_G_CROP|VIDIOC_S_CROP  unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_QUERYSTD: {
 -      JOM(8, "VIDIOC_QUERYSTD: " \
 -                      "EasyCAP is incapable of detecting standard\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -/*---------------------------------------------------------------------------*/
 -/*
 - *  THE MANIPULATIONS INVOLVING last0,last1,last2,last3 CONSTITUTE A WORKAROUND
 - *  FOR WHAT APPEARS TO BE A BUG IN 64-BIT mplayer.
 - *  NOT NEEDED, BUT HOPEFULLY HARMLESS, FOR 32-BIT mplayer.
 - */
 -/*---------------------------------------------------------------------------*/
 -case VIDIOC_ENUMSTD: {
 -      int last0 = -1, last1 = -1, last2 = -1, last3 = -1;
 -      struct v4l2_standard v4l2_standard;
 -      __u32 index;
 -      struct easycap_standard const *peasycap_standard;
 -
 -      JOM(8, "VIDIOC_ENUMSTD\n");
 -
 -      if (0 != copy_from_user(&v4l2_standard, (void __user *)arg, \
 -                                      sizeof(struct v4l2_standard))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +      case VIDIOC_G_CROP:
 +      case VIDIOC_S_CROP: {
 +              JOM(8, "VIDIOC_G_CROP|VIDIOC_S_CROP  unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
        }
 -      index = v4l2_standard.index;
 -
 -      last3 = last2; last2 = last1; last1 = last0; last0 = index;
 -      if ((index == last3) && (index == last2) && \
 -                      (index == last1) && (index == last0)) {
 -              index++;
 -              last3 = last2; last2 = last1; last1 = last0; last0 = index;
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_QUERYSTD: {
 +              JOM(8, "VIDIOC_QUERYSTD: "
 +                  "EasyCAP is incapable of detecting standard\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
 +              break;
        }
 +      /*-------------------------------------------------------------------*/
 +      /*
 +       *  THE MANIPULATIONS INVOLVING last0,last1,last2,last3
 +       *  CONSTITUTE A WORKAROUND *  FOR WHAT APPEARS TO BE
 +       *  A BUG IN 64-BIT mplayer.
 +       *  NOT NEEDED, BUT HOPEFULLY HARMLESS, FOR 32-BIT mplayer.
 +       */
 +      /*------------------------------------------------------------------*/
 +      case VIDIOC_ENUMSTD: {
 +              int last0 = -1, last1 = -1, last2 = -1, last3 = -1;
 +              struct v4l2_standard v4l2_standard;
 +              u32 index;
 +              struct easycap_standard const *peasycap_standard;
 +
 +              JOM(8, "VIDIOC_ENUMSTD\n");
 +
 +              if (0 != copy_from_user(&v4l2_standard, (void __user *)arg,
 +                                      sizeof(struct v4l2_standard))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              index = v4l2_standard.index;
 +
 +              last3 = last2;
 +              last2 = last1;
 +              last1 = last0;
 +              last0 = index;
 +              if ((index == last3) && (index == last2) &&
 +                  (index == last1) && (index == last0)) {
 +                      index++;
 +                      last3 = last2;
 +                      last2 = last1;
 +                      last1 = last0;
 +                      last0 = index;
 +              }
  
 -      memset(&v4l2_standard, 0, sizeof(struct v4l2_standard));
 +              memset(&v4l2_standard, 0, sizeof(struct v4l2_standard));
  
 -      peasycap_standard = &easycap_standard[0];
 -      while (0xFFFF != peasycap_standard->mask) {
 -              if ((int)(peasycap_standard - &easycap_standard[0]) == index)
 -                      break;
 -              peasycap_standard++;
 -      }
 -      if (0xFFFF == peasycap_standard->mask) {
 -              JOM(8, "%i=index: exhausts standards\n", index);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      JOM(8, "%i=index: %s\n", index, \
 -                              &(peasycap_standard->v4l2_standard.name[0]));
 -      memcpy(&v4l2_standard, &(peasycap_standard->v4l2_standard), \
 -                                      sizeof(struct v4l2_standard));
 +              peasycap_standard = &easycap_standard[0];
 +              while (0xFFFF != peasycap_standard->mask) {
 +                      if ((int)(peasycap_standard - &easycap_standard[0]) == index)
 +                              break;
 +                      peasycap_standard++;
 +              }
 +              if (0xFFFF == peasycap_standard->mask) {
 +                      JOM(8, "%i=index: exhausts standards\n", index);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              JOM(8, "%i=index: %s\n", index,
 +                  &(peasycap_standard->v4l2_standard.name[0]));
 +              memcpy(&v4l2_standard, &(peasycap_standard->v4l2_standard),
 +                     sizeof(struct v4l2_standard));
  
 -      v4l2_standard.index = index;
 +              v4l2_standard.index = index;
  
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_standard, \
 -                                      sizeof(struct v4l2_standard))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              if (copy_to_user((void __user *)arg, &v4l2_standard,
 +                              sizeof(struct v4l2_standard))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_STD: {
 -      v4l2_std_id std_id;
 -      struct easycap_standard const *peasycap_standard;
 +      case VIDIOC_G_STD: {
 +              v4l2_std_id std_id;
 +              struct easycap_standard const *peasycap_standard;
  
 -      JOM(8, "VIDIOC_G_STD\n");
 +              JOM(8, "VIDIOC_G_STD\n");
  
 -      if (0 > peasycap->standard_offset) {
 -              JOM(8, "%i=peasycap->standard_offset\n", \
 -                                      peasycap->standard_offset);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EBUSY;
 -      }
 +              if (0 > peasycap->standard_offset) {
 +                      JOM(8, "%i=peasycap->standard_offset\n",
 +                          peasycap->standard_offset);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EBUSY;
 +              }
  
 -      if (0 != copy_from_user(&std_id, (void __user *)arg, \
 -                                              sizeof(v4l2_std_id))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (0 != copy_from_user(&std_id, (void __user *)arg,
 +                                      sizeof(v4l2_std_id))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      peasycap_standard = &easycap_standard[peasycap->standard_offset];
 -      std_id = peasycap_standard->v4l2_standard.id;
 +              peasycap_standard = &easycap_standard[peasycap->standard_offset];
 +              std_id = peasycap_standard->v4l2_standard.id;
  
 -      JOM(8, "user is told: %s\n", \
 -                              &peasycap_standard->v4l2_standard.name[0]);
 +              JOM(8, "user is told: %s\n",
 +                  &peasycap_standard->v4l2_standard.name[0]);
  
 -      if (0 != copy_to_user((void __user *)arg, &std_id, \
 -                                              sizeof(v4l2_std_id))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              if (copy_to_user((void __user *)arg, &std_id,
 +                                      sizeof(v4l2_std_id))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_STD: {
 -      v4l2_std_id std_id;
 -      int rc;
 +      case VIDIOC_S_STD: {
 +              v4l2_std_id std_id;
 +              int rc;
  
 -      JOM(8, "VIDIOC_S_STD\n");
 +              JOM(8, "VIDIOC_S_STD\n");
  
 -      if (0 != copy_from_user(&std_id, (void __user *)arg, \
 -                                              sizeof(v4l2_std_id))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (0 != copy_from_user(&std_id, (void __user *)arg,
 +                                      sizeof(v4l2_std_id))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      JOM(8, "User requests standard: 0x%08X%08X\n", \
 -              (int)((std_id & (((v4l2_std_id)0xFFFFFFFF) << 32)) >> 32), \
 -              (int)(std_id & ((v4l2_std_id)0xFFFFFFFF)));
 +              JOM(8, "User requests standard: 0x%08X%08X\n",
 +                  (int)((std_id & (((v4l2_std_id)0xFFFFFFFF) << 32)) >> 32),
 +                  (int)(std_id & ((v4l2_std_id)0xFFFFFFFF)));
  
 -      rc = adjust_standard(peasycap, std_id);
 -      if (0 > rc) {
 -              JOM(8, "WARNING: adjust_standard() returned %i\n", rc);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -ENOENT;
 +              rc = adjust_standard(peasycap, std_id);
 +              if (0 > rc) {
 +                      JOM(8, "WARNING: adjust_standard() returned %i\n", rc);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ENOENT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_REQBUFS: {
 -      int nbuffers;
 -      struct v4l2_requestbuffers v4l2_requestbuffers;
 +      case VIDIOC_REQBUFS: {
 +              int nbuffers;
 +              struct v4l2_requestbuffers v4l2_requestbuffers;
  
 -      JOM(8, "VIDIOC_REQBUFS\n");
 +              JOM(8, "VIDIOC_REQBUFS\n");
  
 -      if (0 != copy_from_user(&v4l2_requestbuffers, (void __user *)arg, \
 -                              sizeof(struct v4l2_requestbuffers))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (0 != copy_from_user(&v4l2_requestbuffers,
 +                                      (void __user *)arg,
 +                                      sizeof(struct v4l2_requestbuffers))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (v4l2_requestbuffers.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      if (v4l2_requestbuffers.memory != V4L2_MEMORY_MMAP) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      nbuffers = v4l2_requestbuffers.count;
 -      JOM(8, "                   User requests %i buffers ...\n", nbuffers);
 -      if (nbuffers < 2)
 -              nbuffers = 2;
 -      if (nbuffers > FRAME_BUFFER_MANY)
 -              nbuffers = FRAME_BUFFER_MANY;
 -      if (v4l2_requestbuffers.count == nbuffers) {
 -              JOM(8, "                   ... agree to  %i buffers\n", \
 -                                                              nbuffers);
 -      } else {
 -              JOM(8, "                  ... insist on  %i buffers\n", \
 -                                                              nbuffers);
 -              v4l2_requestbuffers.count = nbuffers;
 -      }
 -      peasycap->frame_buffer_many = nbuffers;
 +              if (v4l2_requestbuffers.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              if (v4l2_requestbuffers.memory != V4L2_MEMORY_MMAP) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              nbuffers = v4l2_requestbuffers.count;
 +              JOM(8, "                   User requests %i buffers ...\n", nbuffers);
 +              if (nbuffers < 2)
 +                      nbuffers = 2;
 +              if (nbuffers > FRAME_BUFFER_MANY)
 +                      nbuffers = FRAME_BUFFER_MANY;
 +              if (v4l2_requestbuffers.count == nbuffers) {
 +                      JOM(8, "                   ... agree to  %i buffers\n",
 +                          nbuffers);
 +              } else {
 +                      JOM(8, "                  ... insist on  %i buffers\n",
 +                          nbuffers);
 +                      v4l2_requestbuffers.count = nbuffers;
 +              }
 +              peasycap->frame_buffer_many = nbuffers;
  
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_requestbuffers, \
 -                              sizeof(struct v4l2_requestbuffers))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              if (copy_to_user((void __user *)arg, &v4l2_requestbuffers,
 +                                      sizeof(struct v4l2_requestbuffers))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_QUERYBUF: {
 -      __u32 index;
 -      struct v4l2_buffer v4l2_buffer;
 +      case VIDIOC_QUERYBUF: {
 +              u32 index;
 +              struct v4l2_buffer v4l2_buffer;
  
 -      JOM(8, "VIDIOC_QUERYBUF\n");
 +              JOM(8, "VIDIOC_QUERYBUF\n");
  
 -      if (peasycap->video_eof) {
 -              JOM(8, "returning -EIO because  %i=video_eof\n", \
 -                                                      peasycap->video_eof);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EIO;
 -      }
 +              if (peasycap->video_eof) {
 +                      JOM(8, "returning -EIO because  %i=video_eof\n",
 +                          peasycap->video_eof);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EIO;
 +              }
  
 -      if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg, \
 +              if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg,
                                        sizeof(struct v4l2_buffer))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (v4l2_buffer.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      index = v4l2_buffer.index;
 -      if (index < 0 || index >= peasycap->frame_buffer_many)
 -              return -EINVAL;
 -      memset(&v4l2_buffer, 0, sizeof(struct v4l2_buffer));
 -      v4l2_buffer.index = index;
 -      v4l2_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 -      v4l2_buffer.bytesused = peasycap->frame_buffer_used;
 -      v4l2_buffer.flags = V4L2_BUF_FLAG_MAPPED | \
 -                                              peasycap->done[index] | \
 -                                              peasycap->queued[index];
 -      v4l2_buffer.field = V4L2_FIELD_NONE;
 -      v4l2_buffer.memory = V4L2_MEMORY_MMAP;
 -      v4l2_buffer.m.offset = index * FRAME_BUFFER_SIZE;
 -      v4l2_buffer.length = FRAME_BUFFER_SIZE;
 -
 -      JOM(16, "  %10i=index\n", v4l2_buffer.index);
 -      JOM(16, "  0x%08X=type\n", v4l2_buffer.type);
 -      JOM(16, "  %10i=bytesused\n", v4l2_buffer.bytesused);
 -      JOM(16, "  0x%08X=flags\n", v4l2_buffer.flags);
 -      JOM(16, "  %10i=field\n", v4l2_buffer.field);
 -      JOM(16, "  %10li=timestamp.tv_usec\n", \
 -                                       (long)v4l2_buffer.timestamp.tv_usec);
 -      JOM(16, "  %10i=sequence\n", v4l2_buffer.sequence);
 -      JOM(16, "  0x%08X=memory\n", v4l2_buffer.memory);
 -      JOM(16, "  %10i=m.offset\n", v4l2_buffer.m.offset);
 -      JOM(16, "  %10i=length\n", v4l2_buffer.length);
 -
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_buffer, \
 +              if (v4l2_buffer.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              index = v4l2_buffer.index;
 +              if (index < 0 || index >= peasycap->frame_buffer_many)
 +                      return -EINVAL;
 +              memset(&v4l2_buffer, 0, sizeof(struct v4l2_buffer));
 +              v4l2_buffer.index = index;
 +              v4l2_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 +              v4l2_buffer.bytesused = peasycap->frame_buffer_used;
 +              v4l2_buffer.flags = V4L2_BUF_FLAG_MAPPED |
 +                                      peasycap->done[index] |
 +                                      peasycap->queued[index];
 +              v4l2_buffer.field = V4L2_FIELD_NONE;
 +              v4l2_buffer.memory = V4L2_MEMORY_MMAP;
 +              v4l2_buffer.m.offset = index * FRAME_BUFFER_SIZE;
 +              v4l2_buffer.length = FRAME_BUFFER_SIZE;
 +
 +              JOM(16, "  %10i=index\n", v4l2_buffer.index);
 +              JOM(16, "  0x%08X=type\n", v4l2_buffer.type);
 +              JOM(16, "  %10i=bytesused\n", v4l2_buffer.bytesused);
 +              JOM(16, "  0x%08X=flags\n", v4l2_buffer.flags);
 +              JOM(16, "  %10i=field\n", v4l2_buffer.field);
 +              JOM(16, "  %10li=timestamp.tv_usec\n",
 +                  (long)v4l2_buffer.timestamp.tv_usec);
 +              JOM(16, "  %10i=sequence\n", v4l2_buffer.sequence);
 +              JOM(16, "  0x%08X=memory\n", v4l2_buffer.memory);
 +              JOM(16, "  %10i=m.offset\n", v4l2_buffer.m.offset);
 +              JOM(16, "  %10i=length\n", v4l2_buffer.length);
 +
 +              if (copy_to_user((void __user *)arg, &v4l2_buffer,
                                        sizeof(struct v4l2_buffer))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_QBUF: {
 -      struct v4l2_buffer v4l2_buffer;
 +      case VIDIOC_QBUF: {
 +              struct v4l2_buffer v4l2_buffer;
  
 -      JOM(8, "VIDIOC_QBUF\n");
 +              JOM(8, "VIDIOC_QBUF\n");
  
 -      if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg, \
 +              if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg,
                                        sizeof(struct v4l2_buffer))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (v4l2_buffer.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      if (v4l2_buffer.memory != V4L2_MEMORY_MMAP) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      if (v4l2_buffer.index < 0 || \
 -               (v4l2_buffer.index >= peasycap->frame_buffer_many)) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      v4l2_buffer.flags = V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_QUEUED;
 +              if (v4l2_buffer.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              if (v4l2_buffer.memory != V4L2_MEMORY_MMAP) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              if (v4l2_buffer.index < 0 ||
 +                  v4l2_buffer.index >= peasycap->frame_buffer_many) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              v4l2_buffer.flags = V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_QUEUED;
  
 -      peasycap->done[v4l2_buffer.index]   = 0;
 -      peasycap->queued[v4l2_buffer.index] = V4L2_BUF_FLAG_QUEUED;
 +              peasycap->done[v4l2_buffer.index]   = 0;
 +              peasycap->queued[v4l2_buffer.index] = V4L2_BUF_FLAG_QUEUED;
  
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_buffer, \
 +              if (copy_to_user((void __user *)arg, &v4l2_buffer,
                                        sizeof(struct v4l2_buffer))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      JOM(8, ".....   user queueing frame buffer %i\n", \
 -                                              (int)v4l2_buffer.index);
 +              JOM(8, ".....   user queueing frame buffer %i\n",
 +                  (int)v4l2_buffer.index);
  
 -      peasycap->frame_lock = 0;
 +              peasycap->frame_lock = 0;
  
 -      break;
 -}
 +              break;
 +      }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_DQBUF:
 +      case VIDIOC_DQBUF:
        {
 -#if defined(AUDIOTIME)
 -      struct signed_div_result sdr;
 -      long long int above, below, dnbydt, fudge, sll;
 -      unsigned long long int ull;
 -      struct timeval timeval8;
 -      struct timeval timeval1;
 -#endif /*AUDIOTIME*/
 -      struct timeval timeval, timeval2;
 -      int i, j;
 -      struct v4l2_buffer v4l2_buffer;
 -      int rcdq;
 -      __u16 input;
 -
 -      JOM(8, "VIDIOC_DQBUF\n");
 -
 -      if ((peasycap->video_idle) || (peasycap->video_eof)) {
 -              JOM(8, "returning -EIO because  " \
 -                              "%i=video_idle  %i=video_eof\n", \
 -                              peasycap->video_idle, peasycap->video_eof);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EIO;
 -      }
 -
 -      if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg, \
 -                                      sizeof(struct v4l2_buffer))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              struct timeval timeval, timeval2;
 +              int i, j;
 +              struct v4l2_buffer v4l2_buffer;
 +              int rcdq;
 +              u16 input;
 +
 +              JOM(8, "VIDIOC_DQBUF\n");
 +
 +              if ((peasycap->video_idle) || (peasycap->video_eof)) {
 +                      JOM(8, "returning -EIO because  "
 +                          "%i=video_idle  %i=video_eof\n",
 +                          peasycap->video_idle, peasycap->video_eof);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EIO;
 +              }
  
 -      if (v4l2_buffer.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 +              if (copy_from_user(&v4l2_buffer, (void __user *)arg,
 +                                sizeof(struct v4l2_buffer))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (true == peasycap->offerfields) {
 -              /*-----------------------------------------------------------*/
 -              /*
 -               *  IN ITS 50 "fps" MODE tvtime SEEMS ALWAYS TO REQUEST
 -               *  V4L2_FIELD_BOTTOM
 -              */
 -              /*-----------------------------------------------------------*/
 -              if (V4L2_FIELD_TOP == v4l2_buffer.field)
 -                      JOM(8, "user wants V4L2_FIELD_TOP\n");
 -              else if (V4L2_FIELD_BOTTOM == v4l2_buffer.field)
 -                      JOM(8, "user wants V4L2_FIELD_BOTTOM\n");
 -              else if (V4L2_FIELD_ANY == v4l2_buffer.field)
 -                      JOM(8, "user wants V4L2_FIELD_ANY\n");
 -              else
 -                      JOM(8, "user wants V4L2_FIELD_...UNKNOWN: %i\n", \
 -                                                      v4l2_buffer.field);
 -      }
 +              if (v4l2_buffer.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
  
 -      if (!peasycap->video_isoc_streaming) {
 -              JOM(16, "returning -EIO because video urbs not streaming\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EIO;
 -      }
 -/*---------------------------------------------------------------------------*/
 -/*
 - *  IF THE USER HAS PREVIOUSLY CALLED easycap_poll(), AS DETERMINED BY FINDING
 - *  THE FLAG peasycap->polled SET, THERE MUST BE NO FURTHER WAIT HERE.  IN THIS
 - *  CASE, JUST CHOOSE THE FRAME INDICATED BY peasycap->frame_read
 - */
 -/*---------------------------------------------------------------------------*/
 +              if (peasycap->offerfields) {
 +                      /*---------------------------------------------------*/
 +                      /*
 +                       *  IN ITS 50 "fps" MODE tvtime SEEMS ALWAYS TO REQUEST
 +                       *  V4L2_FIELD_BOTTOM
 +                       */
 +                      /*---------------------------------------------------*/
 +                      if (V4L2_FIELD_TOP == v4l2_buffer.field)
 +                              JOM(8, "user wants V4L2_FIELD_TOP\n");
 +                      else if (V4L2_FIELD_BOTTOM == v4l2_buffer.field)
 +                              JOM(8, "user wants V4L2_FIELD_BOTTOM\n");
 +                      else if (V4L2_FIELD_ANY == v4l2_buffer.field)
 +                              JOM(8, "user wants V4L2_FIELD_ANY\n");
 +                      else
 +                              JOM(8, "user wants V4L2_FIELD_...UNKNOWN: %i\n",
 +                                  v4l2_buffer.field);
 +              }
  
 -      if (!peasycap->polled) {
 -              do {
 -                      rcdq = easycap_dqbuf(peasycap, 0);
 -                      if (-EIO == rcdq) {
 -                              JOM(8, "returning -EIO because " \
 -                                              "dqbuf() returned -EIO\n");
 -                              mutex_unlock(&easycap_dongle[kd].mutex_video);
 +              if (!peasycap->video_isoc_streaming) {
 +                      JOM(16, "returning -EIO because video urbs not streaming\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EIO;
 +              }
 +      /*-------------------------------------------------------------------*/
 +      /*
 +       *  IF THE USER HAS PREVIOUSLY CALLED easycap_poll(),
 +       *  AS DETERMINED BY FINDING
 +       *  THE FLAG peasycap->polled SET, THERE MUST BE
 +       *  NO FURTHER WAIT HERE.  IN THIS
 +       *  CASE, JUST CHOOSE THE FRAME INDICATED BY peasycap->frame_read
 +       */
 +      /*-------------------------------------------------------------------*/
 +
 +              if (!peasycap->polled) {
 +                      do {
 +                              rcdq = easycap_dqbuf(peasycap, 0);
 +                              if (-EIO == rcdq) {
 +                                      JOM(8, "returning -EIO because "
 +                                          "dqbuf() returned -EIO\n");
 +                                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                                      return -EIO;
 +                              }
 +                      } while (0 != rcdq);
 +              } else {
 +                      if (peasycap->video_eof) {
 +                              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
                                return -EIO;
                        }
 -              } while (0 != rcdq);
 -      } else {
 -              if (peasycap->video_eof) {
 -                      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -                      return -EIO;
                }
 -      }
 -      if (V4L2_BUF_FLAG_DONE != peasycap->done[peasycap->frame_read]) {
 -              SAM("ERROR: V4L2_BUF_FLAG_DONE != 0x%08X\n", \
 -                                      peasycap->done[peasycap->frame_read]);
 -      }
 -      peasycap->polled = 0;
 -
 -      if (!(peasycap->isequence % 10)) {
 -              for (i = 0; i < 179; i++)
 -                      peasycap->merit[i] = peasycap->merit[i+1];
 -              peasycap->merit[179] = merit_saa(peasycap->pusb_device);
 -              j = 0;
 -              for (i = 0; i < 180; i++)
 -                      j += peasycap->merit[i];
 -              if (90 < j) {
 -                      SAM("easycap driver shutting down " \
 -                                                      "on condition blue\n");
 -                      peasycap->video_eof = 1; peasycap->audio_eof = 1;
 +              if (V4L2_BUF_FLAG_DONE != peasycap->done[peasycap->frame_read]) {
 +                      JOM(8, "V4L2_BUF_FLAG_DONE != 0x%08X\n",
 +                          peasycap->done[peasycap->frame_read]);
 +              }
 +              peasycap->polled = 0;
 +
 +              if (!(peasycap->isequence % 10)) {
 +                      for (i = 0; i < 179; i++)
 +                              peasycap->merit[i] = peasycap->merit[i+1];
 +                      peasycap->merit[179] = merit_saa(peasycap->pusb_device);
 +                      j = 0;
 +                      for (i = 0; i < 180; i++)
 +                              j += peasycap->merit[i];
 +                      if (90 < j) {
 +                              SAM("easycap driver shutting down "
 +                                  "on condition blue\n");
 +                              peasycap->video_eof = 1;
 +                              peasycap->audio_eof = 1;
 +                      }
                }
 -      }
 -
 -      v4l2_buffer.index = peasycap->frame_read;
 -      v4l2_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 -      v4l2_buffer.bytesused = peasycap->frame_buffer_used;
 -      v4l2_buffer.flags = V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_DONE;
 -      if (true == peasycap->offerfields)
 -              v4l2_buffer.field = V4L2_FIELD_BOTTOM;
 -      else
 -              v4l2_buffer.field = V4L2_FIELD_NONE;
 -      do_gettimeofday(&timeval);
 -      timeval2 = timeval;
  
 -#if defined(AUDIOTIME)
 -      if (!peasycap->timeval0.tv_sec) {
 -              timeval8 = timeval;
 -              timeval1 = timeval;
 +              v4l2_buffer.index = peasycap->frame_read;
 +              v4l2_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 +              v4l2_buffer.bytesused = peasycap->frame_buffer_used;
 +              v4l2_buffer.flags = V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_DONE;
 +              if (peasycap->offerfields)
 +                      v4l2_buffer.field = V4L2_FIELD_BOTTOM;
 +              else
 +                      v4l2_buffer.field = V4L2_FIELD_NONE;
 +              do_gettimeofday(&timeval);
                timeval2 = timeval;
 -              dnbydt = 192000;
 -              peasycap->timeval0 = timeval8;
 -      } else {
 -              dnbydt = peasycap->dnbydt;
 -              timeval1 = peasycap->timeval1;
 -              above = dnbydt * MICROSECONDS(timeval, timeval1);
 -              below = 192000;
 -              sdr = signed_div(above, below);
 -
 -              above = sdr.quotient + timeval1.tv_usec - 350000;
 -
 -              below = 1000000;
 -              sdr = signed_div(above, below);
 -              timeval2.tv_usec = sdr.remainder;
 -              timeval2.tv_sec = timeval1.tv_sec + sdr.quotient;
 -      }
 -      if (!(peasycap->isequence % 500)) {
 -              fudge = ((long long int)(1000000)) * \
 -                              ((long long int)(timeval.tv_sec - \
 -                                              timeval2.tv_sec)) + \
 -                              (long long int)(timeval.tv_usec - \
 -                                              timeval2.tv_usec);
 -              sdr = signed_div(fudge, 1000);
 -              sll = sdr.quotient;
 -              ull = sdr.remainder;
 -
 -              SAM("%5lli.%-3lli=ms timestamp fudge\n", sll, ull);
 -      }
 -#endif /*AUDIOTIME*/
 -
 -      v4l2_buffer.timestamp = timeval2;
 -      v4l2_buffer.sequence = peasycap->isequence++;
 -      v4l2_buffer.memory = V4L2_MEMORY_MMAP;
 -      v4l2_buffer.m.offset = v4l2_buffer.index * FRAME_BUFFER_SIZE;
 -      v4l2_buffer.length = FRAME_BUFFER_SIZE;
 -
 -      JOM(16, "  %10i=index\n", v4l2_buffer.index);
 -      JOM(16, "  0x%08X=type\n", v4l2_buffer.type);
 -      JOM(16, "  %10i=bytesused\n", v4l2_buffer.bytesused);
 -      JOM(16, "  0x%08X=flags\n", v4l2_buffer.flags);
 -      JOM(16, "  %10i=field\n", v4l2_buffer.field);
 -      JOM(16, "  %10li=timestamp.tv_sec\n", \
 -                                      (long)v4l2_buffer.timestamp.tv_sec);
 -      JOM(16, "  %10li=timestamp.tv_usec\n", \
 -                                      (long)v4l2_buffer.timestamp.tv_usec);
 -      JOM(16, "  %10i=sequence\n", v4l2_buffer.sequence);
 -      JOM(16, "  0x%08X=memory\n", v4l2_buffer.memory);
 -      JOM(16, "  %10i=m.offset\n", v4l2_buffer.m.offset);
 -      JOM(16, "  %10i=length\n", v4l2_buffer.length);
 -
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_buffer, \
 -                                              sizeof(struct v4l2_buffer))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
  
 -      input = peasycap->frame_buffer[peasycap->frame_read][0].input;
 -      if (0x08 & input) {
 -              JOM(8, "user is offered frame buffer %i, input %i\n", \
 -                                      peasycap->frame_read, (0x07 & input));
 -      } else {
 -              JOM(8, "user is offered frame buffer %i\n", \
 -                                                      peasycap->frame_read);
 -      }
 -      peasycap->frame_lock = 1;
 -      JOM(8, "%i=peasycap->frame_fill\n", peasycap->frame_fill);
 -      if (peasycap->frame_read == peasycap->frame_fill) {
 -              if (peasycap->frame_lock) {
 -                      JOM(8, "WORRY:  filling frame buffer " \
 -                                              "while offered to user\n");
 +              v4l2_buffer.timestamp = timeval2;
 +              v4l2_buffer.sequence = peasycap->isequence++;
 +              v4l2_buffer.memory = V4L2_MEMORY_MMAP;
 +              v4l2_buffer.m.offset = v4l2_buffer.index * FRAME_BUFFER_SIZE;
 +              v4l2_buffer.length = FRAME_BUFFER_SIZE;
 +
 +              JOM(16, "  %10i=index\n", v4l2_buffer.index);
 +              JOM(16, "  0x%08X=type\n", v4l2_buffer.type);
 +              JOM(16, "  %10i=bytesused\n", v4l2_buffer.bytesused);
 +              JOM(16, "  0x%08X=flags\n", v4l2_buffer.flags);
 +              JOM(16, "  %10i=field\n", v4l2_buffer.field);
 +              JOM(16, "  %10li=timestamp.tv_sec\n",
 +                  (long)v4l2_buffer.timestamp.tv_sec);
 +              JOM(16, "  %10li=timestamp.tv_usec\n",
 +                  (long)v4l2_buffer.timestamp.tv_usec);
 +              JOM(16, "  %10i=sequence\n", v4l2_buffer.sequence);
 +              JOM(16, "  0x%08X=memory\n", v4l2_buffer.memory);
 +              JOM(16, "  %10i=m.offset\n", v4l2_buffer.m.offset);
 +              JOM(16, "  %10i=length\n", v4l2_buffer.length);
 +
 +              if (copy_to_user((void __user *)arg, &v4l2_buffer,
 +                                      sizeof(struct v4l2_buffer))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +
 +              input = peasycap->frame_buffer[peasycap->frame_read][0].input;
 +              if (0x08 & input) {
 +                      JOM(8, "user is offered frame buffer %i, input %i\n",
 +                          peasycap->frame_read, (0x07 & input));
 +              } else {
 +                      JOM(8, "user is offered frame buffer %i\n",
 +                          peasycap->frame_read);
 +              }
 +              peasycap->frame_lock = 1;
 +              JOM(8, "%i=peasycap->frame_fill\n", peasycap->frame_fill);
 +              if (peasycap->frame_read == peasycap->frame_fill) {
 +                      if (peasycap->frame_lock) {
 +                              JOM(8, "WORRY:  filling frame buffer "
 +                                  "while offered to user\n");
 +                      }
                }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_STREAMON: {
 -      int i;
 +      case VIDIOC_STREAMON: {
 +              int i;
  
 -      JOM(8, "VIDIOC_STREAMON\n");
 +              JOM(8, "VIDIOC_STREAMON\n");
  
 -      peasycap->isequence = 0;
 -      for (i = 0; i < 180; i++)
 -              peasycap->merit[i] = 0;
 -      if ((struct usb_device *)NULL == peasycap->pusb_device) {
 -              SAM("ERROR: peasycap->pusb_device is NULL\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              peasycap->isequence = 0;
 +              for (i = 0; i < 180; i++)
 +                      peasycap->merit[i] = 0;
 +              if (!peasycap->pusb_device) {
 +                      SAM("ERROR: peasycap->pusb_device is NULL\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              submit_video_urbs(peasycap);
 +              peasycap->video_idle = 0;
 +              peasycap->audio_idle = 0;
 +              peasycap->video_eof = 0;
 +              peasycap->audio_eof = 0;
 +              break;
        }
 -      submit_video_urbs(peasycap);
 -      peasycap->video_idle = 0;
 -      peasycap->audio_idle = 0;
 -      peasycap->video_eof = 0;
 -      peasycap->audio_eof = 0;
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_STREAMOFF: {
 -      JOM(8, "VIDIOC_STREAMOFF\n");
 +      case VIDIOC_STREAMOFF: {
 +              JOM(8, "VIDIOC_STREAMOFF\n");
  
 -      if ((struct usb_device *)NULL == peasycap->pusb_device) {
 -              SAM("ERROR: peasycap->pusb_device is NULL\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (!peasycap->pusb_device) {
 +                      SAM("ERROR: peasycap->pusb_device is NULL\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      peasycap->video_idle = 1;
 -      peasycap->audio_idle = 1;  peasycap->timeval0.tv_sec = 0;
 +              peasycap->video_idle = 1;
 +              peasycap->audio_idle = 1;
 +              peasycap->timeval0.tv_sec = 0;
  /*---------------------------------------------------------------------------*/
  /*
   *  IF THE WAIT QUEUES ARE NOT CLEARED IN RESPONSE TO THE STREAMOFF COMMAND
   *  THE USERSPACE PROGRAM, E.G. mplayer, MAY HANG ON EXIT.   BEWARE.
   */
  /*---------------------------------------------------------------------------*/
 -      JOM(8, "calling wake_up on wq_video and wq_audio\n");
 -      wake_up_interruptible(&(peasycap->wq_video));
 -      wake_up_interruptible(&(peasycap->wq_audio));
 +              JOM(8, "calling wake_up on wq_video and wq_audio\n");
 +              wake_up_interruptible(&(peasycap->wq_video));
 +#ifdef CONFIG_EASYCAP_OSS
 +              wake_up_interruptible(&(peasycap->wq_audio));
 +
 +#else
 +              if (peasycap->psubstream)
 +                      snd_pcm_period_elapsed(peasycap->psubstream);
 +#endif /* CONFIG_EASYCAP_OSS */
  /*---------------------------------------------------------------------------*/
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_PARM: {
 -      struct v4l2_streamparm *pv4l2_streamparm;
 -
 -      JOM(8, "VIDIOC_G_PARM\n");
 -      pv4l2_streamparm = kzalloc(sizeof(struct v4l2_streamparm), GFP_KERNEL);
 -      if (!pv4l2_streamparm) {
 -              SAM("ERROR: out of memory\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -ENOMEM;
 -      }
 -      if (0 != copy_from_user(pv4l2_streamparm, (void __user *)arg, \
 -                                      sizeof(struct v4l2_streamparm))) {
 -              kfree(pv4l2_streamparm);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              break;
        }
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_G_PARM: {
 +              struct v4l2_streamparm *pv4l2_streamparm;
 +
 +              JOM(8, "VIDIOC_G_PARM\n");
 +              pv4l2_streamparm = kzalloc(sizeof(struct v4l2_streamparm), GFP_KERNEL);
 +              if (!pv4l2_streamparm) {
 +                      SAM("ERROR: out of memory\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ENOMEM;
 +              }
 +              if (copy_from_user(pv4l2_streamparm,
 +                      (void __user *)arg, sizeof(struct v4l2_streamparm))) {
 +                      kfree(pv4l2_streamparm);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (pv4l2_streamparm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 -              kfree(pv4l2_streamparm);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      pv4l2_streamparm->parm.capture.capability = 0;
 -      pv4l2_streamparm->parm.capture.capturemode = 0;
 -      pv4l2_streamparm->parm.capture.timeperframe.numerator = 1;
 +              if (pv4l2_streamparm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 +                      kfree(pv4l2_streamparm);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              pv4l2_streamparm->parm.capture.capability = 0;
 +              pv4l2_streamparm->parm.capture.capturemode = 0;
 +              pv4l2_streamparm->parm.capture.timeperframe.numerator = 1;
  
 -      if (peasycap->fps) {
 -              pv4l2_streamparm->parm.capture.timeperframe.\
 -                                              denominator = peasycap->fps;
 -      } else {
 -              if (true == peasycap->ntsc) {
 -                      pv4l2_streamparm->parm.capture.timeperframe.\
 -                                              denominator = 30;
 +              if (peasycap->fps) {
 +                      pv4l2_streamparm->parm.capture.timeperframe.
 +                      denominator = peasycap->fps;
                } else {
 -                      pv4l2_streamparm->parm.capture.timeperframe.\
 -                                              denominator = 25;
 +                      if (peasycap->ntsc) {
 +                              pv4l2_streamparm->parm.capture.timeperframe.
 +                              denominator = 30;
 +                      } else {
 +                              pv4l2_streamparm->parm.capture.timeperframe.
 +                              denominator = 25;
 +                      }
                }
 -      }
 -
 -      pv4l2_streamparm->parm.capture.readbuffers = \
 -                                              peasycap->frame_buffer_many;
 -      pv4l2_streamparm->parm.capture.extendedmode = 0;
 -      if (0 != copy_to_user((void __user *)arg, pv4l2_streamparm, \
 -                                      sizeof(struct v4l2_streamparm))) {
 -              kfree(pv4l2_streamparm);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -      kfree(pv4l2_streamparm);
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_PARM: {
 -      JOM(8, "VIDIOC_S_PARM unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_AUDIO: {
 -      JOM(8, "VIDIOC_G_AUDIO unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_AUDIO: {
 -      JOM(8, "VIDIOC_S_AUDIO unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_TUNER: {
 -      JOM(8, "VIDIOC_S_TUNER unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_FBUF:
 -case VIDIOC_S_FBUF:
 -case VIDIOC_OVERLAY: {
 -      JOM(8, "VIDIOC_G_FBUF|VIDIOC_S_FBUF|VIDIOC_OVERLAY unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_TUNER: {
 -      JOM(8, "VIDIOC_G_TUNER unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 -case VIDIOC_G_FREQUENCY:
 -case VIDIOC_S_FREQUENCY: {
 -      JOM(8, "VIDIOC_G_FREQUENCY|VIDIOC_S_FREQUENCY unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -default: {
 -      JOM(8, "ERROR: unrecognized V4L2 IOCTL command: 0x%08X\n", cmd);
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -ENOIOCTLCMD;
 -}
 -}
 -mutex_unlock(&easycap_dongle[kd].mutex_video);
 -JOM(4, "unlocked easycap_dongle[%i].mutex_video\n", kd);
 -return 0;
 -}
 -/*****************************************************************************/
 -/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
 -#if ((defined(EASYCAP_IS_VIDEODEV_CLIENT)) || \
 -      (defined(EASYCAP_NEEDS_UNLOCKED_IOCTL)))
 -long
 -easysnd_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg) {
 -      return (long)easysnd_ioctl((struct inode *)NULL, file, cmd, arg);
 -}
 -#endif /*EASYCAP_IS_VIDEODEV_CLIENT||EASYCAP_NEEDS_UNLOCKED_IOCTL*/
 -/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 -/*---------------------------------------------------------------------------*/
 -int
 -easysnd_ioctl(struct inode *inode, struct file *file,
 -                                      unsigned int cmd, unsigned long arg)
 -{
 -struct easycap *peasycap;
 -struct usb_device *p;
 -int kd;
 -
 -if (NULL == file) {
 -      SAY("ERROR:  file is NULL\n");
 -      return -ERESTARTSYS;
 -}
 -peasycap = file->private_data;
 -if (NULL == peasycap) {
 -      SAY("ERROR:  peasycap is NULL.\n");
 -      return -EFAULT;
 -}
 -if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
 -      SAY("ERROR: bad peasycap\n");
 -      return -EFAULT;
 -}
 -p = peasycap->pusb_device;
 -if (NULL == p) {
 -      SAM("ERROR: peasycap->pusb_device is NULL\n");
 -      return -EFAULT;
 -}
 -kd = isdongle(peasycap);
 -if (0 <= kd && DONGLE_MANY > kd) {
 -      if (mutex_lock_interruptible(&easycap_dongle[kd].mutex_audio)) {
 -              SAY("ERROR: cannot lock easycap_dongle[%i].mutex_audio\n", kd);
 -              return -ERESTARTSYS;
 -      }
 -      JOM(4, "locked easycap_dongle[%i].mutex_audio\n", kd);
 -/*---------------------------------------------------------------------------*/
 -/*
 - *  MEANWHILE, easycap_usb_disconnect() MAY HAVE FREED POINTER peasycap,
 - *  IN WHICH CASE A REPEAT CALL TO isdongle() WILL FAIL.
 - *  IF NECESSARY, BAIL OUT.
 -*/
 -/*---------------------------------------------------------------------------*/
 -      if (kd != isdongle(peasycap))
 -              return -ERESTARTSYS;
 -      if (NULL == file) {
 -              SAY("ERROR:  file is NULL\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -ERESTARTSYS;
 -      }
 -      peasycap = file->private_data;
 -      if (NULL == peasycap) {
 -              SAY("ERROR:  peasycap is NULL\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -ERESTARTSYS;
 -      }
 -      if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
 -              SAY("ERROR: bad peasycap\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 -      }
 -      p = peasycap->pusb_device;
 -      if (NULL == peasycap->pusb_device) {
 -              SAM("ERROR: peasycap->pusb_device is NULL\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -ERESTARTSYS;
 -      }
 -} else {
 -/*---------------------------------------------------------------------------*/
 -/*
 - *  IF easycap_usb_disconnect() HAS ALREADY FREED POINTER peasycap BEFORE THE
 - *  ATTEMPT TO ACQUIRE THE SEMAPHORE, isdongle() WILL HAVE FAILED.  BAIL OUT.
 -*/
 -/*---------------------------------------------------------------------------*/
 -      return -ERESTARTSYS;
 -}
 -/*---------------------------------------------------------------------------*/
 -switch (cmd) {
 -case SNDCTL_DSP_GETCAPS: {
 -      int caps;
 -      JOM(8, "SNDCTL_DSP_GETCAPS\n");
 -
 -#if defined(UPSAMPLE)
 -      if (true == peasycap->microphone)
 -              caps = 0x04400000;
 -      else
 -              caps = 0x04400000;
 -#else
 -      if (true == peasycap->microphone)
 -              caps = 0x02400000;
 -      else
 -              caps = 0x04400000;
 -#endif /*UPSAMPLE*/
  
 -      if (0 != copy_to_user((void __user *)arg, &caps, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 -      }
 -      break;
 -}
 -case SNDCTL_DSP_GETFMTS: {
 -      int incoming;
 -      JOM(8, "SNDCTL_DSP_GETFMTS\n");
 -
 -#if defined(UPSAMPLE)
 -      if (true == peasycap->microphone)
 -              incoming = AFMT_S16_LE;
 -      else
 -              incoming = AFMT_S16_LE;
 -#else
 -      if (true == peasycap->microphone)
 -              incoming = AFMT_S16_LE;
 -      else
 -              incoming = AFMT_S16_LE;
 -#endif /*UPSAMPLE*/
 -
 -      if (0 != copy_to_user((void __user *)arg, &incoming, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 -      }
 -      break;
 -}
 -case SNDCTL_DSP_SETFMT: {
 -      int incoming, outgoing;
 -      JOM(8, "SNDCTL_DSP_SETFMT\n");
 -      if (0 != copy_from_user(&incoming, (void __user *)arg, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 -      }
 -      JOM(8, "........... %i=incoming\n", incoming);
 -
 -#if defined(UPSAMPLE)
 -      if (true == peasycap->microphone)
 -              outgoing = AFMT_S16_LE;
 -      else
 -              outgoing = AFMT_S16_LE;
 -#else
 -      if (true == peasycap->microphone)
 -              outgoing = AFMT_S16_LE;
 -      else
 -              outgoing = AFMT_S16_LE;
 -#endif /*UPSAMPLE*/
 -
 -      if (incoming != outgoing) {
 -              JOM(8, "........... %i=outgoing\n", outgoing);
 -              JOM(8, "        cf. %i=AFMT_S16_LE\n", AFMT_S16_LE);
 -              JOM(8, "        cf. %i=AFMT_U8\n", AFMT_U8);
 -              if (0 != copy_to_user((void __user *)arg, &outgoing, \
 -                                                              sizeof(int))) {
 -                      mutex_unlock(&easycap_dongle[kd].mutex_audio);
 +              pv4l2_streamparm->parm.capture.readbuffers =
 +                      peasycap->frame_buffer_many;
 +              pv4l2_streamparm->parm.capture.extendedmode = 0;
 +              if (copy_to_user((void __user *)arg,
 +                              pv4l2_streamparm,
 +                              sizeof(struct v4l2_streamparm))) {
 +                      kfree(pv4l2_streamparm);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
                        return -EFAULT;
                }
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EINVAL ;
 -      }
 -      break;
 -}
 -case SNDCTL_DSP_STEREO: {
 -      int incoming;
 -      JOM(8, "SNDCTL_DSP_STEREO\n");
 -      if (0 != copy_from_user(&incoming, (void __user *)arg, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 +              kfree(pv4l2_streamparm);
 +              break;
        }
 -      JOM(8, "........... %i=incoming\n", incoming);
 -
 -#if defined(UPSAMPLE)
 -      if (true == peasycap->microphone)
 -              incoming = 1;
 -      else
 -              incoming = 1;
 -#else
 -      if (true == peasycap->microphone)
 -              incoming = 0;
 -      else
 -              incoming = 1;
 -#endif /*UPSAMPLE*/
 -
 -      if (0 != copy_to_user((void __user *)arg, &incoming, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_S_PARM: {
 +              JOM(8, "VIDIOC_S_PARM unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
        }
 -      break;
 -}
 -case SNDCTL_DSP_SPEED: {
 -      int incoming;
 -      JOM(8, "SNDCTL_DSP_SPEED\n");
 -      if (0 != copy_from_user(&incoming, (void __user *)arg, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_G_AUDIO: {
 +              JOM(8, "VIDIOC_G_AUDIO unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
        }
 -      JOM(8, "........... %i=incoming\n", incoming);
 -
 -#if defined(UPSAMPLE)
 -      if (true == peasycap->microphone)
 -              incoming = 32000;
 -      else
 -              incoming = 48000;
 -#else
 -      if (true == peasycap->microphone)
 -              incoming = 8000;
 -      else
 -              incoming = 48000;
 -#endif /*UPSAMPLE*/
 -
 -      if (0 != copy_to_user((void __user *)arg, &incoming, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_S_AUDIO: {
 +              JOM(8, "VIDIOC_S_AUDIO unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
        }
 -      break;
 -}
 -case SNDCTL_DSP_GETTRIGGER: {
 -      int incoming;
 -      JOM(8, "SNDCTL_DSP_GETTRIGGER\n");
 -      if (0 != copy_from_user(&incoming, (void __user *)arg, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_S_TUNER: {
 +              JOM(8, "VIDIOC_S_TUNER unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
        }
 -      JOM(8, "........... %i=incoming\n", incoming);
 -
 -      incoming = PCM_ENABLE_INPUT;
 -      if (0 != copy_to_user((void __user *)arg, &incoming, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_G_FBUF:
 +      case VIDIOC_S_FBUF:
 +      case VIDIOC_OVERLAY: {
 +              JOM(8, "VIDIOC_G_FBUF|VIDIOC_S_FBUF|VIDIOC_OVERLAY unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
        }
 -      break;
 -}
 -case SNDCTL_DSP_SETTRIGGER: {
 -      int incoming;
 -      JOM(8, "SNDCTL_DSP_SETTRIGGER\n");
 -      if (0 != copy_from_user(&incoming, (void __user *)arg, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_G_TUNER: {
 +              JOM(8, "VIDIOC_G_TUNER unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
        }
 -      JOM(8, "........... %i=incoming\n", incoming);
 -      JOM(8, "........... cf 0x%x=PCM_ENABLE_INPUT " \
 -                              "0x%x=PCM_ENABLE_OUTPUT\n", \
 -                                      PCM_ENABLE_INPUT, PCM_ENABLE_OUTPUT);
 -      ;
 -      ;
 -      ;
 -      ;
 -      break;
 -}
 -case SNDCTL_DSP_GETBLKSIZE: {
 -      int incoming;
 -      JOM(8, "SNDCTL_DSP_GETBLKSIZE\n");
 -      if (0 != copy_from_user(&incoming, (void __user *)arg, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 +      case VIDIOC_G_FREQUENCY:
 +      case VIDIOC_S_FREQUENCY: {
 +              JOM(8, "VIDIOC_G_FREQUENCY|VIDIOC_S_FREQUENCY unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -EINVAL;
        }
 -      JOM(8, "........... %i=incoming\n", incoming);
 -      incoming = peasycap->audio_bytes_per_fragment;
 -      if (0 != copy_to_user((void __user *)arg, &incoming, sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      default: {
 +              JOM(8, "ERROR: unrecognized V4L2 IOCTL command: 0x%08X\n", cmd);
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +              return -ENOIOCTLCMD;
        }
 -      break;
 -}
 -case SNDCTL_DSP_GETISPACE: {
 -      struct audio_buf_info audio_buf_info;
 -
 -      JOM(8, "SNDCTL_DSP_GETISPACE\n");
 -
 -      audio_buf_info.bytes      = peasycap->audio_bytes_per_fragment;
 -      audio_buf_info.fragments  = 1;
 -      audio_buf_info.fragsize   = 0;
 -      audio_buf_info.fragstotal = 0;
 -
 -      if (0 != copy_to_user((void __user *)arg, &audio_buf_info, \
 -                                                              sizeof(int))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -              return -EFAULT;
        }
 -      break;
 -}
 -case 0x00005401:
 -case 0x00005402:
 -case 0x00005403:
 -case 0x00005404:
 -case 0x00005405:
 -case 0x00005406: {
 -      JOM(8, "SNDCTL_TMR_...: 0x%08X unsupported\n", cmd);
 -      mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -      return -ENOIOCTLCMD;
 -}
 -default: {
 -      JOM(8, "ERROR: unrecognized DSP IOCTL command: 0x%08X\n", cmd);
 -      mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -      return -ENOIOCTLCMD;
 -}
 -}
 -mutex_unlock(&easycap_dongle[kd].mutex_audio);
 -return 0;
 +      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +      JOM(4, "unlocked easycapdc60_dongle[%i].mutex_video\n", kd);
 +      return 0;
  }
  /*****************************************************************************/
 -
 -
index a74439affce9c7a4b09c0783e226911ce3894a2c,8c9dbac9dc1b1f6fcc113674551ea2ee0e959661..5ce6fa6e59f0b98c362a99419eb65d253b8f7cf9
  
  #include <linux/version.h>
  
- #define __OLD_VIDIOC_
  #include "matroxfb_base.h"
  #include "matroxfb_misc.h"
  #include "matroxfb_accel.h"
@@@ -1152,7 -1150,6 +1150,6 @@@ static int matroxfb_ioctl(struct fb_inf
                                        return -EFAULT;
                                return err;
                        }
-               case VIDIOC_S_CTRL_OLD:
                case VIDIOC_S_CTRL:
                        {
                                struct v4l2_control ctrl;
@@@ -1461,6 -1458,13 +1458,6 @@@ static struct board 
                MGA_G100,
                &vbG100,
                "MGA-G100 (AGP)"},
 -      {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200EV_PCI,        0xFF,
 -              0,                      0,
 -              DEVF_G200,
 -              230000,
 -              MGA_G200,
 -              &vbG200,
 -              "MGA-G200eV (PCI)"},
        {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200_PCI,  0xFF,
                0,                      0,
                DEVF_G200,
@@@ -2112,6 -2116,8 +2109,6 @@@ static struct pci_device_id matroxfb_de
                PCI_ANY_ID,     PCI_ANY_ID,     0, 0, 0},
        {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G100_AGP,
                PCI_ANY_ID,     PCI_ANY_ID,     0, 0, 0},
 -      {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200EV_PCI,
 -              PCI_ANY_ID,     PCI_ANY_ID,     0, 0, 0},
        {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200_PCI,
                PCI_ANY_ID,     PCI_ANY_ID,     0, 0, 0},
        {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200_AGP,
diff --combined sound/soc/codecs/Kconfig
index d63c1754e05f82d75e5f2a8763bf4cf1540c763a,9726d6e5e927224b585152f3444338149b128890..6943e24a74a16b0adb4dd6f2ef7c0ef3a23293ee
@@@ -26,24 -26,17 +26,24 @@@ config SND_SOC_ALL_CODEC
        select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC
        select SND_SOC_CS42L51 if I2C
        select SND_SOC_CS4270 if I2C
 +      select SND_SOC_CS4271 if SND_SOC_I2C_AND_SPI
        select SND_SOC_CX20442
        select SND_SOC_DA7210 if I2C
 +      select SND_SOC_DFBMCS320
        select SND_SOC_JZ4740_CODEC if SOC_JZ4740
 +      select SND_SOC_LM4857 if I2C
        select SND_SOC_MAX98088 if I2C
 +      select SND_SOC_MAX9850 if I2C
        select SND_SOC_MAX9877 if I2C
        select SND_SOC_PCM3008
 +      select SND_SOC_SGTL5000 if I2C
 +      select SND_SOC_SN95031 if INTEL_SCU_IPC
        select SND_SOC_SPDIF
        select SND_SOC_SSM2602 if I2C
        select SND_SOC_STAC9766 if SND_SOC_AC97_BUS
        select SND_SOC_TLV320AIC23 if I2C
        select SND_SOC_TLV320AIC26 if SPI_MASTER
 +      select SND_SOC_TVL320AIC32X4 if I2C
        select SND_SOC_TLV320AIC3X if I2C
        select SND_SOC_TPA6130A2 if I2C
        select SND_SOC_TLV320DAC33 if I2C
@@@ -51,7 -44,7 +51,7 @@@
        select SND_SOC_TWL6040 if TWL4030_CORE
        select SND_SOC_UDA134X
        select SND_SOC_UDA1380 if I2C
-       select SND_SOC_WL1273 if RADIO_WL1273
+       select SND_SOC_WL1273 if MFD_WL1273_CORE
        select SND_SOC_WM2000 if I2C
        select SND_SOC_WM8350 if MFD_WM8350
        select SND_SOC_WM8400 if MFD_WM8400
@@@ -83,7 -76,6 +83,7 @@@
        select SND_SOC_WM8985 if SND_SOC_I2C_AND_SPI
        select SND_SOC_WM8988 if SND_SOC_I2C_AND_SPI
        select SND_SOC_WM8990 if I2C
 +      select SND_SOC_WM8991 if I2C
        select SND_SOC_WM8993 if I2C
        select SND_SOC_WM8994 if MFD_WM8994
        select SND_SOC_WM8995 if SND_SOC_I2C_AND_SPI
@@@ -163,9 -155,6 +163,9 @@@ config SND_SOC_CS4270_VD33_ERRAT
        bool
        depends on SND_SOC_CS4270
  
 +config SND_SOC_CS4271
 +      tristate
 +
  config SND_SOC_CX20442
        tristate
  
@@@ -178,28 -167,15 +178,28 @@@ config SND_SOC_L
  config SND_SOC_DA7210
          tristate
  
 +config SND_SOC_DFBMCS320
 +      tristate
 +
  config SND_SOC_DMIC
        tristate
  
  config SND_SOC_MAX98088
         tristate
  
 +config SND_SOC_MAX9850
 +      tristate
 +
  config SND_SOC_PCM3008
         tristate
  
 +#Freescale sgtl5000 codec
 +config SND_SOC_SGTL5000
 +      tristate
 +
 +config SND_SOC_SN95031
 +      tristate
 +
  config SND_SOC_SPDIF
        tristate
  
@@@ -216,9 -192,6 +216,9 @@@ config SND_SOC_TLV320AIC2
        tristate "TI TLV320AIC26 Codec support" if SND_SOC_OF_SIMPLE
        depends on SPI
  
 +config SND_SOC_TVL320AIC32X4
 +      tristate
 +
  config SND_SOC_TLV320AIC3X
        tristate
  
@@@ -331,9 -304,6 +331,9 @@@ config SND_SOC_WM898
  config SND_SOC_WM8990
        tristate
  
 +config SND_SOC_WM8991
 +      tristate
 +
  config SND_SOC_WM8993
        tristate
  
@@@ -356,9 -326,6 +356,9 @@@ config SND_SOC_WM971
        tristate
  
  # Amp
 +config SND_SOC_LM4857
 +      tristate
 +
  config SND_SOC_MAX9877
        tristate
  
@@@ -370,3 -337,4 +370,3 @@@ config SND_SOC_WM200
  
  config SND_SOC_WM9090
        tristate
 -
index 1ad0d5aecece986f2ae5c9c8680bd7ef3b1d6696,5836201834d97dcc769347ab98827841fce013ca..c8a874d0d4cae5d9a0a66974ff3ac5b4887d492a
@@@ -3,7 -3,7 +3,7 @@@
   *
   * Author:      Matti Aaltonen, <[email protected]>
   *
-  * Copyright:   (C) 2010 Nokia Corporation
+  * Copyright:   (C) 2010, 2011 Nokia Corporation
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
@@@ -179,7 -179,12 +179,12 @@@ static int snd_wl1273_get_audio_route(s
        return 0;
  }
  
- static const char *wl1273_audio_route[] = { "Bt", "FmRx", "FmTx" };
+ /*
+  * TODO: Implement the audio routing in the driver. Now this control
+  * only indicates the setting that has been done elsewhere (in the user
+  * space).
+  */
+ static const char * const wl1273_audio_route[] = { "Bt", "FmRx", "FmTx" };
  
  static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_value *ucontrol)
@@@ -239,7 -244,7 +244,7 @@@ static int snd_wl1273_fm_audio_put(stru
        return 1;
  }
  
- static const char *wl1273_audio_strings[] = { "Digital", "Analog" };
+ static const char * const wl1273_audio_strings[] = { "Digital", "Analog" };
  
  static const struct soc_enum wl1273_audio_enum =
        SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wl1273_audio_strings),
@@@ -436,8 -441,7 +441,8 @@@ EXPORT_SYMBOL_GPL(wl1273_get_format)
  
  static int wl1273_probe(struct snd_soc_codec *codec)
  {
 -      struct wl1273_core **core = codec->dev->platform_data;
 +      struct wl1273_core **core =
 +                      mfd_get_data(to_platform_device(codec->dev));
        struct wl1273_priv *wl1273;
        int r;
  
This page took 0.430592 seconds and 4 git commands to generate.