istvan_v@mailbox.hu [Mon, 6 Jun 2011 15:54:54 +0000 (12:54 -0300)]
[media] xc4000: code cleanup
Various coding style changes:
- removed unused / commented out code
- changed C++ style comments to C format
- renamed functions and variables that included upper case letters in the name
- removed tabs from module parameter descriptions
- replaced the use of XC_RESULT_* with standard error codes
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 15:25:19 +0000 (12:25 -0300)]
[media] xc4000: detect also xc4100
Added code to detect the XC4100 chip, which is presumably an analog-only
"value" version of the XC4000. It is not sure, however, if any devices
using this have actually been produced and sold, so the patch may be
unneeded.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 15:21:17 +0000 (12:21 -0300)]
[media] xc4000: removed redundant tuner reset
This patch causes the tuner reset command to be ignored in the firmware
code, since this only happens when the BASE/INIT1 firmware is loaded by
check_firmware(), and in that case check_firmware() already calls the
reset callback before starting to load the firmware.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 15:18:41 +0000 (12:18 -0300)]
[media] xc4000: xc_tune_channel() cleanup
Minor coding changes related to the xc_tune_channel() function.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 15:17:22 +0000 (12:17 -0300)]
[media] xc4000: implemented analog TV and radio
The following patch implements support for analog TV and FM radio.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 15:15:51 +0000 (12:15 -0300)]
[media] xc4000: added audio_std module parameter
The 'audio_std' module parameter makes it possible to fine tune
some audio related aspects of the driver, like setting the exact
audio standard (NICAM, A2, etc.) to be used for some video standards.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 15:12:42 +0000 (12:12 -0300)]
[media] xc4000: setting registers
This patch implements setting the registers in xc4000_set_params()
and xc4000_set_analog_params(). A new register is defined which enables
filtering of the composite video output (this is needed to avoid bad
picture quality with some boards).
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 15:08:29 +0000 (12:08 -0300)]
[media] xc4000: debug message improvements
The following patch makes a few minor changes to the printing
of debug messages, and reporting the tuner status. The 'debug'
module parameter can now be set from 0 to 2 to control the
verbosity of debug messages.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 15:04:51 +0000 (12:04 -0300)]
[media] xc4000: firmware initialization
This patch fixes/cleans up the loading of the firmware file when the
driver is loaded and initialized.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 15:03:03 +0000 (12:03 -0300)]
[media] xc4000: implemented power management
The following patch implements the xc4000_sleep() function.
The 'no_powerdown' module parameter is now interpreted differently:
- 0 uses a device-specific default
- 1 disables power management like before
- 2 enables power management
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Fri, 3 Jun 2011 12:38:04 +0000 (09:38 -0300)]
[media] xc4000: added card_type
This patch adds support for selecting a card type in struct
xc4000_config, to allow for implementing some card specific code
in the driver.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 14:59:54 +0000 (11:59 -0300)]
[media] xc4000: check_firmware() cleanup
This patch makes the following fixes in check_firmware():
- there is only one BASE and INIT1 firmware for XC4000
- loading SCODE is needed also for FM radio
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 14:56:18 +0000 (11:56 -0300)]
[media] xc4000: simplified load_scode
Removed unused code from load_scode() (all SCODE firmwares are
assumed to have the HAS_IF bit set).
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 14:52:34 +0000 (11:52 -0300)]
[media] xc4000: simplified seek_firmware()
This patch simplifies the code in seek_firmware().
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Sat, 4 Jun 2011 14:48:16 +0000 (11:48 -0300)]
[media] xc4000: added firmware_name parameter
The firmware_name module parameter makes it possible to set the firmware
file name. It defaults to "xc4000.fw" if not specified.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Fri, 3 Jun 2011 15:27:30 +0000 (12:27 -0300)]
[media] xc4000: fixed frequency error
The xc_get_frequency_error() function reported the frequency error
incorrectly. The data read from the hardware is a signed integer, in
15625 Hz units. The attached patch fixes the bug.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Fri, 3 Jun 2011 15:23:33 +0000 (12:23 -0300)]
[media] xc4000: added mutex
This patch adds a mutex to xc4000_priv, to protect the driver
from being accessed by multiple processes at the same time.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Fri, 3 Jun 2011 15:17:59 +0000 (12:17 -0300)]
[media] xc4000: added support for 7 MHz DVB-T
The following patch implements support for DVB-T with 7 MHz bandwidth.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Fri, 3 Jun 2011 13:55:24 +0000 (10:55 -0300)]
[media] xc4000: updated standards table
This patch makes the following changes to the standards table:
- added 'u16 int_freq' to struct XC_TV_STANDARD (needed for analog TV
and radio, 0 for DVB-T)
- added new standard for SECAM-D/K video with PAL-D/K audio
- the 'int_freq' values are now specified in the table
- changed VideoMode for NTSC and PAL-B/G standards
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Istvan Varga [Fri, 3 Jun 2011 13:11:48 +0000 (10:11 -0300)]
[media] xc4000: code cleanup
This is the first of a set of patches that update the original xc4000
sources to my modified version. It removes some unused code, and makes
a few minor formatting changes.
[mchehab@redhat.com: re-add XC_TUNE_ANALOG/XC_TUNE_DIGITAL constants, to avoid compilation breakage]
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Mauro Carvalho Chehab [Thu, 2 Jun 2011 14:36:56 +0000 (11:36 -0300)]
[media] xc4000: Fix a few bad whitespaces on it
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Sun, 27 Dec 2009 21:58:11 +0000 (18:58 -0300)]
[media] dib0700: remove notes from bringup of PCTV 340e
Remove some inline comments I had written from when I was computing the proper
dib7000p configuration to work with the xc4000.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Sun, 27 Dec 2009 21:15:14 +0000 (18:15 -0300)]
[media] xc4000: cleanup dmesg logging
Remove some printk() calls added during driver development, and demote some
other messages to debug only (to reduce dmesg chatter).
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Sun, 27 Dec 2009 20:55:13 +0000 (17:55 -0300)]
[media] xc4000: rename firmware image filename
Give the xc4000 firmware filename a filename that makes more sense for public
release.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Sun, 27 Dec 2009 20:50:43 +0000 (17:50 -0300)]
[media] xc4000: turn off debug logging by default
Don't dump debug into to dmesg by default (something I had enabled during
bringup of the xc4000 driver).
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Sun, 27 Dec 2009 20:44:31 +0000 (17:44 -0300)]
[media] dib0700: make PCTV 340e work!
Fixup the PLL and AGC configs so that the 340e works (correcting errors I made
when I did the original config blindly).
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Mon, 5 Oct 2009 04:27:14 +0000 (01:27 -0300)]
[media] xc4000: get rid of hard-coded 8MHz firmware config
Remove a hack I had put in to force the firmware to be 8MHz, now setting
the firmware properly based on the target standard.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Mon, 5 Oct 2009 03:34:04 +0000 (00:34 -0300)]
[media] dib0700: fixup PLL config for PCTV 340e
Based on a reference trace under Windows, reverse engineer the PLL config.
Note that the xtal is not yet setup, and the timf cannot be determined yet
because my reference trace doesn't actually achieve a signal lock.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Mon, 5 Oct 2009 02:09:18 +0000 (23:09 -0300)]
[media] xc4000: handle dib0700 broken i2c stretching
It was confirmed by DibCom that i2c stretching is broken in the i2c master
on the dib7700. So we need to put a hack into the xc4000 driver to not
complain in certain very specific cases where we know i2c stretching occurs.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Tue, 28 Jul 2009 04:16:05 +0000 (01:16 -0300)]
[media] xc4000: setup dib7000p AGC config for PCTV 340e
Setup a proper AGC config for the 340e, based on the Windows USB trace
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Tue, 28 Jul 2009 03:04:27 +0000 (00:04 -0300)]
[media] xc4000: use if_khz provided in xc4000_config
Remove hard-coded references to 5400, using the value passed in when the
xc4000 is attached.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Tue, 28 Jul 2009 02:51:54 +0000 (23:51 -0300)]
[media] xc4000: continued cleanup of the firmware loading routine
Properly setup the standard firmware loading and scode loading, as well as
getting rid of a ton of dead code. Note that I am getting a single i2c
error when the standard firmware sets the video standard, but everything else
seems to be loading properly now.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Sat, 25 Jul 2009 20:39:54 +0000 (17:39 -0300)]
[media] xc4000: add code to do standard and scode firmware loading
Add code to handle firmware blobs for the standard and scode. Note there
appears to be some issue with loading the DTV8 standard firmware, probably
related to direct/indirect mode.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Thu, 23 Jul 2009 00:56:37 +0000 (21:56 -0300)]
[media] xc4000: remove xc5000 firmware loading routine
Since we use the xc3028 version of the firmware file parsing routine (which
includes support for scodes and separate blobs), we can drop the xc5000
version of the code.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Thu, 23 Jul 2009 00:52:11 +0000 (21:52 -0300)]
[media] xc4000: remove XREG_BUSY code only supported in xc5000
The xc4000 driver is based on the original xc5000 driver, and while the
xc5000 supports the XREG_BUSY register, the xc4000 does not. So remove the
code in question.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Thu, 23 Jul 2009 00:49:28 +0000 (21:49 -0300)]
[media] xc4000: properly set type for init1 firmware
We need to set the firmware type properly in order to locate the init1
firmware.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Mon, 20 Jul 2009 05:15:31 +0000 (02:15 -0300)]
[media] xc4000: cut over to using xc5000 version for loading i2c sequences
The xc3028 version does i2c splitting in a different manner than xc4000 and
xc5000, so reuse the xc5000 version of the routine (the key here being that
xc4000 expects the first *two* bytes to be the same for splitting transactions.
Doing it the xc3028 way was resulting in i2c errors partially through the
firmware load. With this change, it would appear that the entire base firmware
is being loaded successfully (product id now properly shows 0x0FA0).
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Mon, 20 Jul 2009 03:54:57 +0000 (00:54 -0300)]
[media] xc4000: pull in firmware management code from xc3028
Switch over to using the firmware management routines from the tuner-xc2028,
since that has support for scodes, etc.
This code still requires signficant cleanup, and at this point the base
firmware does not load properly (i2c write errors about 300 bytes in).
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Mon, 20 Jul 2009 03:45:25 +0000 (00:45 -0300)]
[media] dib7000p: setup dev.parent for i2c master built into 7000p
We need to set the dev.parent member on the dib7000p on its i2c master, or
else calls to request_firmware() will hit an oops in 2.6.31.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Mon, 20 Jul 2009 03:42:33 +0000 (00:42 -0300)]
[media] dib0700: add a sleep before attempting to detect dib7000p
Add a sleep since in some cases the dib7000p wasn't online when being probed.
The optimal timing has not yet been determined.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Tue, 30 Jun 2009 00:11:02 +0000 (21:11 -0300)]
[media] dib0700: successfully connect to xc4000 over i2c for PCTV 340e
Use the correct i2c bus to communicate with the tuner, and properly setup the
reset GPIO and i2c address.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Wed, 24 Jun 2009 03:07:01 +0000 (00:07 -0300)]
[media] dib0700: properly setup GPIOs for PCTV 340e
Provide a frontend setup routine for the PCTV 340e which takes into account
the specific GPIO setup of the board.
Note that this patch does *not* take into account the xc4000 reset pin, which
is attached to the dib7000.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Devin Heitmueller [Wed, 24 Jun 2009 01:48:02 +0000 (22:48 -0300)]
[media] dib0700: add USB id for PCTV 340eSE
Add the board profile for the PCTV 340eSE, since that's what I have here
for development.
[mchehab@redhat.com: rebased on the top of the current tree]
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Davide Ferri [Wed, 24 Jun 2009 01:34:06 +0000 (22:34 -0300)]
[media] dib0700: add initial code for PCTV 340e by Davide Ferri
This is initial code written by Davide Ferri for the PCTV 340e, including
a new xc4000 driver. I am checking in all the code unmodified, and making
no assertions about its quality (other than confirming it compiles).
[mchehab@redhat.com: rebased on the top of the current tree]
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Davide Ferri <davidef1986@gmail.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Johannes Obermaier [Thu, 2 Jun 2011 16:03:41 +0000 (13:03 -0300)]
[media] mt9v011: Fixed gain calculation
The implementation of the gain calculation for this sensor is incorrect.
It is only working for the first 127 values.
The reason is, that the gain cannot be set directly by writing a value
into the gain registers of the sensor. The gain register work this way
(see datasheet page 24): bits 0 to 6 are called "initial gain". These
are linear. But bits 7 and 8 ("analog multiplicative factors") and bits
9 and 10 ("digital multiplicative factors") work completely different:
Each of these bits increase the gain by the factor 2. So if the bits
7-10 are 0011, 0110, 1100 or 0101 for example, the gain from bits 0-6 is
multiplied by 4. The order of the bits 7-10 is not important for the
resulting gain. (But there are some recommended values for low noise)
The current driver doesn't do this correctly: If the current gain is 000
0111 1111 (127) and the gain is increased by 1, you would expect the
image to become brighter. But the image is completly dark, because the
new gain is 000 1000 0000 (128). This means: Initial gain of 0,
multiplied by 2. The result is 0.
This patch adds a new function which does the gain calculation and also
fixes the same bug for red_balance and blue_balance. Additionally, the
driver follows the recommendation from the datasheet, which says, that
the gain should always be above 0x0020.
Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Johannes Obermaier <johannes.obermaier@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Johannes Obermaier [Thu, 2 Jun 2011 15:43:14 +0000 (12:43 -0300)]
[media] mt9v011: Added exposure for mt9v011
There are problems when you use this camera/sensor in a very bright room
or outside. The image is completely white, because it is overexposed.
The driver uses a default value which is not suitable for all
environments.
This patch makes it possible to adjust the exposure time by youself. I
found out by logging the i2c-data, that the windows driver for this
sensor is doing this, too. I tested the camera on a sunny day and after
adjusting the exposure time, I was able to see a very good image.
Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Johannes Obermaier <johannes.obermaier@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Johannes Obermaier [Thu, 2 Jun 2011 15:17:51 +0000 (12:17 -0300)]
[media] mt9v011: Fixed incorrect value for the first valid column
According to the datasheet (page 8), the first optical clear
pixel-column is not at position 14. The correct/recommended value is 20.
Without this patch there is a dark line on the left side of the image.
Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Johannes Obermaier <johannes.obermaier@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
David Härdeman [Wed, 30 Mar 2011 14:20:14 +0000 (11:20 -0300)]
[media] rc-core: fix winbond-cir issues
The conversion of winbond-cir to use rc-core seems to have missed a
a few bits and pieces which were in my local tree. Kudos to
Juan Jesús García de Soria Lucena <skandalfo@gmail.com> for noticing.
[mchehab@redhat.com: fix two UTF-8 violations]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Thu, 26 May 2011 08:55:08 +0000 (05:55 -0300)]
[media] rc/redrat3: dereferencing null pointer
In the original code, if the allocation failed we dereference "rr3"
when it was NULL.
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Thu, 26 May 2011 08:52:01 +0000 (05:52 -0300)]
[media] rc: double unlock in rc_register_device()
If change_protocol() fails and we goto out_raw, then it calls unlock
twice. I noticed that the other time we called change_protocol() we
held the &dev->lock, so I changed it to hold it here too.
Reviewed-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andreas Oberritter [Thu, 26 May 2011 10:54:14 +0000 (07:54 -0300)]
[media] DVB: dvb_frontend: fix dtv_property_dump for DTV_DVBT2_PLP_ID
- Add missing entry to array "dtv_cmds".
- Set array size to DTV_MAX_COMMAND + 1 to avoid future off-by-ones.
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Uwe Kleine-König [Wed, 1 Jun 2011 20:19:22 +0000 (17:19 -0300)]
[media] V4L/videobuf2-memops: use pr_debug for debug messages
Otherwise they clutter the dmesg buffer even on a production kernel.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Manoel Pinheiro [Sat, 7 May 2011 06:49:13 +0000 (03:49 -0300)]
[media] dvb-usb.h function rc5_scan
The function "rc5_scan" in "dvb_usb.h" is returning invalid value.
The value should be returned "u16" but is returning "u8".
See example below in "drivers/media/dvb/dvb-usb/opera1.c":
send_key = (send_key & 0xffff) | 0x0100;
for (i = 0; i < ARRAY_SIZE(rc_map_opera1_table); i++) {
if (rc5_scan(&rc_map_opera1_table[i]) == (send_key & 0xffff)) {
*state = REMOTE_KEY_PRESSED;
*event = rc_map_opera1_table[i].keycode;
opst->last_key_pressed =
rc_map_opera1_table[i].keycode;
break;
}
opst->last_key_pressed = 0;
}
Signed-off-by: Manoel Pinheiro <pinusdtv@hotmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Ondrej Zary [Wed, 1 Jun 2011 19:57:11 +0000 (16:57 -0300)]
[media] radio-sf16fmr2: convert to generic TEA575x interface
Convert radio-sf16fmr2 to use generic TEA575x implementation. Most of the
driver code goes away as SF16-FMR2 is basically just a TEA5757 tuner
connected to ISA bus.
The card can optionally be equipped with PT2254A volume control (equivalent
of TC9154AP) - the volume setting is completely reworked (with balance control
added) and tested.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Petter Selasky [Mon, 23 May 2011 11:42:40 +0000 (08:42 -0300)]
[media] cx24113: Don't reuse core macro names
The info and err macros are already defined by the USB stack. Rename
these macros to avoid macro redefinition warnings.
Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Petter Selasky [Mon, 23 May 2011 11:40:00 +0000 (08:40 -0300)]
[media] itd1000: Don't reuse core macro names
The dbg, warn and info macros are already defined by the USB stack.
Rename these macros to avoid macro redefinition warnings.
Refactor lineshift in printouts.
Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Alexey Khoroshilov [Tue, 31 May 2011 20:54:40 +0000 (17:54 -0300)]
[media] radio-si470x: fix memory leak in si470x_usb_driver_probe()
radio->int_in_urb is not deallocated on error paths in si470x_usb_driver_probe().
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Joe Perches [Sat, 28 May 2011 17:36:28 +0000 (14:36 -0300)]
[media] media: Convert vmalloc/memset to vzalloc
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Mauro Carvalho Chehab [Wed, 1 Jun 2011 16:03:12 +0000 (13:03 -0300)]
dvb_net: Simplify the code if DVB NET is not defined
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Petter Selasky [Mon, 23 May 2011 12:43:35 +0000 (09:43 -0300)]
[media] Make DVB NET configurable in the kernel
Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Ondrej Zary [Mon, 23 May 2011 12:17:19 +0000 (09:17 -0300)]
[media] tea575x: convert to control framework
Convert tea575x-tuner to use the new V4L2 control framework. Also add
ext_init() callback that can be used by a card driver for additional
initialization right before registering the video device (for SF16-FMR2).
Also embed struct video_device to struct snd_tea575x to simplify the code.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Petter Selasky [Mon, 23 May 2011 11:13:06 +0000 (08:13 -0300)]
[media] Fix compile warning: Dereferencing type-punned pointer will break strict-aliasing rules
Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Sakari Ailus [Sun, 15 May 2011 15:33:58 +0000 (12:33 -0300)]
[media] v4l: Document EACCES in VIDIOC_[GS]_CTRL and VIDIOC_{G, S, TRY}_EXT_CTRLS
VIDIOC_S_CTRL and VIDIOC_S_EXT_CTRLS return EACCES when setting a read-only
control VIDIOC_TRY_EXT_CTRLS when trying a read-only control and
VIDIOC_G_CTRL and VIDIOC_G_EXT_CTRLS when getting a write-only control.
Document this.
Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Newson Edouard [Tue, 19 Apr 2011 14:54:54 +0000 (11:54 -0300)]
[media] videobuf_pages_to_sg: sglist[0] length problem
On function videobuf_pages_to_sg the statement sg_set_page(&sglist[0],
pages[0], PAGE_SIZE - offset, offset) will fail if size is less than
PAGE_SIZE.
Signed-off-by: Newson Edouard <newsondev@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tejun Heo [Tue, 15 Feb 2011 09:20:12 +0000 (06:20 -0300)]
[media] cx23885: restore flushes of cx23885_dev work items
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Wed, 24 Nov 2010 05:36:57 +0000 (02:36 -0300)]
[media] saa7164: poll mask set incorrectly
list_first_entry() always returns non-null here. I think the intent was
to test whether there were any entries in the used list.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 25 May 2011 20:25:53 +0000 (17:25 -0300)]
[media] cxd2820r: correct missing error checks
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Mauro Carvalho Chehab [Wed, 1 Jun 2011 13:23:53 +0000 (10:23 -0300)]
[media] Update several cardlists
Several cardlist entries are missed. Fix them by running some
script magic (about the same scripts we used to have at -hg tree).
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Mauro Carvalho Chehab [Wed, 1 Jun 2011 13:16:25 +0000 (10:16 -0300)]
[media] em28xx: use the proper prefix for board names
All boards use EM28xxx_BOARD, to identify that the macro
refers to a card entry. So:
EM2874_LEADERSHIP_ISDBT -> EM2874_BOARD_LEADERSHIP_ISDBT
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 25 May 2011 20:03:50 +0000 (17:03 -0300)]
[media] em28xx: correct PCTV nanoStick T2 290e device name
PCTV Systems nanoStick T2 290e => PCTV nanoStick T2 290e
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 25 May 2011 20:00:35 +0000 (17:00 -0300)]
[media] em28xx: add remote for PCTV nanoStick T2 290e
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 25 May 2011 19:56:37 +0000 (16:56 -0300)]
[media] em28xx: EM28174 remote support
For some reason it repeats rather slowly, around 800ms intervals,
two RC5 remotes tested.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 25 May 2011 15:42:52 +0000 (12:42 -0300)]
[media] cxd2820r: fix bitfields
error: dubious one-bit signed bitfield
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 25 May 2011 15:32:44 +0000 (12:32 -0300)]
[media] cxd2820r: malloc buffers instead of stack
kmalloc I2C buffers
Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 25 May 2011 21:30:09 +0000 (18:30 -0300)]
[media] anysee: style issues, comments, etc
Change some info, comments, variables. No functionality changes.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 25 May 2011 21:21:43 +0000 (18:21 -0300)]
[media] anysee: add support for Anysee E7 PS2
Basically it is just same device as Anysee E7 S2 but made for
internal PCI(e) slot and motherboard USB connector.
Cc: info@anysee.com
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Tue, 24 May 2011 10:57:34 +0000 (07:57 -0300)]
[media] anysee: add support for Anysee E7 PTC
Basically it is just same device as Anysee E7 TC but made for
internal PCI(e) slot and motherboard USB connector.
Cc: info@anysee.com
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jean-François Moine [Mon, 23 May 2011 08:38:10 +0000 (05:38 -0300)]
[media] gspca - ov519: New sensor ov9600 with bridge ovfx2
This sensor was found in a webcam 8020:ef04 (SVC - SVU2-1.3MV PCCam).
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Mauro Carvalho Chehab [Tue, 31 May 2011 19:27:44 +0000 (16:27 -0300)]
[media] DocBook: Move all media docbook stuff into its own directory
This patch addresses several issues pointed by Randy Dunlap
<rdunlap@xenotime.net> at changeset ece722c:
- In the generated index.html file, "media" is listed first, but it
should be listed in alphabetical order, not first.
- The generated files are (hidden) in .tmpmedia/
- The link from the top-level index.html file to "media" is to
media/index.html, but the file is actually in .tmpmedia/media/index.html
- Please build docs with and without using "O=builddir" and test that.
- Would it be possible for media to have its own Makefile instead of
merging into this one?
Due to the way cleandocs target works, I had to rename the media DocBook
to media_api, otherwise cleandocs would remove the /media directory.
Thanks-to: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Mauro Carvalho Chehab [Wed, 25 May 2011 15:24:48 +0000 (12:24 -0300)]
[media] DocBook: Add rules to auto-generate some media docbook
Auto-generate the videodev2.h.xml,frontend.h.xml and the indexes.
Some logic at the Makefile helps us to identify when a symbol is missing,
like for example:
Error: no ID for constraint linkend: V4L2-PIX-FMT-JPGL.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Linus Torvalds [Fri, 22 Jul 2011 02:17:23 +0000 (19:17 -0700)]
Linux 3.0
Linus Torvalds [Fri, 22 Jul 2011 00:20:57 +0000 (17:20 -0700)]
Merge branch 'for_linus' of git://git./linux/kernel/git/jwessel/linux-2.6-kgdb
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb:
sparc,kgdbts: fix compile regression with kgdb test suite
Jason Wessel [Tue, 19 Jul 2011 20:43:16 +0000 (15:43 -0500)]
sparc,kgdbts: fix compile regression with kgdb test suite
Commit
63ab25ebbc (kgdbts: unify/generalize gdb breakpoint adjustment)
introduced a compile regression on sparc.
kgdbts.c: In function 'check_and_rewind_pc':
kgdbts.c:307: error: implicit declaration of function 'instruction_pointer_set'
Simply add the correct macro definition for instruction pointer on the
Sparc architecture.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: David S. Miller <davem@davemloft.net>
Linus Torvalds [Thu, 21 Jul 2011 21:28:01 +0000 (14:28 -0700)]
Merge git://git./linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
CIFS: Fix wrong length in cifs_iovec_read
Linus Torvalds [Thu, 21 Jul 2011 19:25:39 +0000 (12:25 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86: Make Dell Latitude E6420 use reboot=pci
x86: Make Dell Latitude E5420 use reboot=pci
H. Peter Anvin [Thu, 21 Jul 2011 18:22:21 +0000 (11:22 -0700)]
x86: Make Dell Latitude E6420 use reboot=pci
Yet another variant of the Dell Latitude series which requires
reboot=pci.
From the E5420 bug report by Daniel J Blueman:
> The E6420 is affected also (same platform, different casing and
> features), which provides an external confirmation of the issue; I can
> submit a patch for that later or include it if you prefer:
> http://linux.koolsolutions.com/2009/08/04/howto-fix-linux-hangfreeze-during-reboots-and-restarts/
Reported-by: Daniel J Blueman <daniel.blueman@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: <stable@kernel.org>
Daniel J Blueman [Fri, 13 May 2011 01:04:59 +0000 (09:04 +0800)]
x86: Make Dell Latitude E5420 use reboot=pci
Rebooting on the Dell E5420 often hangs with the keyboard or ACPI
methods, but is reliable via the PCI method.
[ hpa: this was deferred because we believed for a long time that the
recent reshuffling of the boot priorities in commit
660e34cebf0a11d54f2d5dd8838607452355f321 fixed this platform.
Unfortunately that turned out to be incorrect. ]
Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>
Link: http://lkml.kernel.org/r/1305248699-2347-1-git-send-email-daniel.blueman@gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: <stable@kernel.org>
Linus Torvalds [Thu, 21 Jul 2011 18:07:18 +0000 (11:07 -0700)]
Merge branch 'drm-intel-fixes' of git://git./linux/kernel/git/keithp/linux-2.6
* 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/keithp/linux-2.6:
drm/i915: Fix unfenced alignment on pre-G33 hardware
drm/i915: Add quirk to disable SSC on Lenovo U160 LVDS
Linus Torvalds [Thu, 21 Jul 2011 18:01:42 +0000 (11:01 -0700)]
vfs: drop conditional inode prefetch in __do_lookup_rcu
It seems to hurt performance in real life. Yes, the inode will be used
later, but the conditional doesn't seem to predict all that well
(negative dentries are not uncommon) and it looks like the cost of
prefetching is simply higher than depending on the cache doing the right
thing.
As usual.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jan Beulich [Thu, 21 Jul 2011 14:02:43 +0000 (15:02 +0100)]
FS-Cache: Fix __fscache_uncache_all_inode_pages()'s outer loop
The compiler, at least for ix86 and m68k, validly warns that the
comparison:
next <= (loff_t)-1
is always true (and it's always true also for x86-64 and probably all
other arches - as long as pgoff_t isn't wider than loff_t). The
intention appears to be to avoid wrapping of "next", so rather than
eliminating the pointless comparison, fix the loop to indeed get exited
when "next" would otherwise wrap.
On m68k the following warning is observed:
fs/fscache/page.c: In function '__fscache_uncache_all_inode_pages':
fs/fscache/page.c:979: warning: comparison is always false due to limited range of data type
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reported-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Suresh Jayaraman <sjayaraman@suse.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Pavel Shilovsky [Wed, 20 Jul 2011 14:24:09 +0000 (18:24 +0400)]
CIFS: Fix wrong length in cifs_iovec_read
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Linus Torvalds [Wed, 20 Jul 2011 22:56:25 +0000 (15:56 -0700)]
Merge branch 'core-urgent-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
signal: align __lock_task_sighand() irq disabling and RCU
softirq,rcu: Inform RCU of irq_exit() activity
sched: Add irq_{enter,exit}() to scheduler_ipi()
rcu: protect __rcu_read_unlock() against scheduler-using irq handlers
rcu: Streamline code produced by __rcu_read_unlock()
rcu: Fix RCU_BOOST race handling current->rcu_read_unlock_special
rcu: decrease rcu_report_exp_rnp coupling with scheduler
Linus Torvalds [Wed, 20 Jul 2011 22:55:48 +0000 (15:55 -0700)]
Merge branch 'sched-urgent-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
sched: Avoid creating superfluous NUMA domains on non-NUMA systems
sched: Allow for overlapping sched_domain spans
sched: Break out cpu_power from the sched_group structure
Linus Torvalds [Wed, 20 Jul 2011 22:33:59 +0000 (15:33 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86. reboot: Make Dell Latitude E6320 use reboot=pci
x86, doc only: Correct real-mode kernel header offset for init_size
x86: Disable AMD_NUMA for 32bit for now
Ingo Molnar [Wed, 20 Jul 2011 18:59:26 +0000 (20:59 +0200)]
Merge branch 'rcu/urgent' of git://git./linux/kernel/git/paulmck/linux-2.6-rcu into core/urgent
Paul E. McKenney [Tue, 19 Jul 2011 10:25:36 +0000 (03:25 -0700)]
signal: align __lock_task_sighand() irq disabling and RCU
The __lock_task_sighand() function calls rcu_read_lock() with interrupts
and preemption enabled, but later calls rcu_read_unlock() with interrupts
disabled. It is therefore possible that this RCU read-side critical
section will be preempted and later RCU priority boosted, which means that
rcu_read_unlock() will call rt_mutex_unlock() in order to deboost itself, but
with interrupts disabled. This results in lockdep splats, so this commit
nests the RCU read-side critical section within the interrupt-disabled
region of code. This prevents the RCU read-side critical section from
being preempted, and thus prevents the attempt to deboost with interrupts
disabled.
It is quite possible that a better long-term fix is to make rt_mutex_unlock()
disable irqs when acquiring the rt_mutex structure's ->wait_lock.
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Peter Zijlstra [Tue, 19 Jul 2011 22:32:00 +0000 (15:32 -0700)]
softirq,rcu: Inform RCU of irq_exit() activity
The rcu_read_unlock_special() function relies on in_irq() to exclude
scheduler activity from interrupt level. This fails because exit_irq()
can invoke the scheduler after clearing the preempt_count() bits that
in_irq() uses to determine that it is at interrupt level. This situation
can result in failures as follows:
$task IRQ SoftIRQ
rcu_read_lock()
/* do stuff */
<preempt> |= UNLOCK_BLOCKED
rcu_read_unlock()
--t->rcu_read_lock_nesting
irq_enter();
/* do stuff, don't use RCU */
irq_exit();
sub_preempt_count(IRQ_EXIT_OFFSET);
invoke_softirq()
ttwu();
spin_lock_irq(&pi->lock)
rcu_read_lock();
/* do stuff */
rcu_read_unlock();
rcu_read_unlock_special()
rcu_report_exp_rnp()
ttwu()
spin_lock_irq(&pi->lock) /* deadlock */
rcu_read_unlock_special(t);
Ed can simply trigger this 'easy' because invoke_softirq() immediately
does a ttwu() of ksoftirqd/# instead of doing the in-place softirq stuff
first, but even without that the above happens.
Cure this by also excluding softirqs from the
rcu_read_unlock_special() handler and ensuring the force_irqthreads
ksoftirqd/# wakeup is done from full softirq context.
[ Alternatively, delaying the ->rcu_read_lock_nesting decrement
until after the special handling would make the thing more robust
in the face of interrupts as well. And there is a separate patch
for that. ]
Cc: Thomas Gleixner <tglx@linutronix.de>
Reported-and-tested-by: Ed Tomlinson <edt@aei.ca>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Peter Zijlstra [Tue, 19 Jul 2011 22:07:25 +0000 (15:07 -0700)]
sched: Add irq_{enter,exit}() to scheduler_ipi()
Ensure scheduler_ipi() calls irq_{enter,exit} when it does some actual
work. Traditionally we never did any actual work from the resched IPI
and all magic happened in the return from interrupt path.
Now that we do do some work, we need to ensure irq_{enter,exit} are
called so that we don't confuse things.
This affects things like timekeeping, NO_HZ and RCU, basically
everything with a hook in irq_enter/exit.
Explicit examples of things going wrong are:
sched_clock_cpu() -- has a callback when leaving NO_HZ state to take
a new reading from GTOD and TSC. Without this
callback, time is stuck in the past.
RCU -- needs in_irq() to work in order to avoid some nasty deadlocks
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Paul E. McKenney [Mon, 18 Jul 2011 04:14:35 +0000 (21:14 -0700)]
rcu: protect __rcu_read_unlock() against scheduler-using irq handlers
The addition of RCU read-side critical sections within runqueue and
priority-inheritance lock critical sections introduced some deadlock
cycles, for example, involving interrupts from __rcu_read_unlock()
where the interrupt handlers call wake_up(). This situation can cause
the instance of __rcu_read_unlock() invoked from interrupt to do some
of the processing that would otherwise have been carried out by the
task-level instance of __rcu_read_unlock(). When the interrupt-level
instance of __rcu_read_unlock() is called with a scheduler lock held
from interrupt-entry/exit situations where in_irq() returns false,
deadlock can result.
This commit resolves these deadlocks by using negative values of
the per-task ->rcu_read_lock_nesting counter to indicate that an
instance of __rcu_read_unlock() is in flight, which in turn prevents
instances from interrupt handlers from doing any special processing.
This patch is inspired by Steven Rostedt's earlier patch that similarly
made __rcu_read_unlock() guard against interrupt-mediated recursion
(see https://lkml.org/lkml/2011/7/15/326), but this commit refines
Steven's approach to avoid the need for preemption disabling on the
__rcu_read_unlock() fastpath and to also avoid the need for manipulating
a separate per-CPU variable.
This patch avoids need for preempt_disable() by instead using negative
values of the per-task ->rcu_read_lock_nesting counter. Note that nested
rcu_read_lock()/rcu_read_unlock() pairs are still permitted, but they will
never see ->rcu_read_lock_nesting go to zero, and will therefore never
invoke rcu_read_unlock_special(), thus preventing them from seeing the
RCU_READ_UNLOCK_BLOCKED bit should it be set in ->rcu_read_unlock_special.
This patch also adds a check for ->rcu_read_unlock_special being negative
in rcu_check_callbacks(), thus preventing the RCU_READ_UNLOCK_NEED_QS
bit from being set should a scheduling-clock interrupt occur while
__rcu_read_unlock() is exiting from an outermost RCU read-side critical
section.
Of course, __rcu_read_unlock() can be preempted during the time that
->rcu_read_lock_nesting is negative. This could result in the setting
of the RCU_READ_UNLOCK_BLOCKED bit after __rcu_read_unlock() checks it,
and would also result it this task being queued on the corresponding
rcu_node structure's blkd_tasks list. Therefore, some later RCU read-side
critical section would enter rcu_read_unlock_special() to clean up --
which could result in deadlock if that critical section happened to be in
the scheduler where the runqueue or priority-inheritance locks were held.
This situation is dealt with by making rcu_preempt_note_context_switch()
check for negative ->rcu_read_lock_nesting, thus refraining from
queuing the task (and from setting RCU_READ_UNLOCK_BLOCKED) if we are
already exiting from the outermost RCU read-side critical section (in
other words, we really are no longer actually in that RCU read-side
critical section). In addition, rcu_preempt_note_context_switch()
invokes rcu_read_unlock_special() to carry out the cleanup in this case,
which clears out the ->rcu_read_unlock_special bits and dequeues the task
(if necessary), in turn avoiding needless delay of the current RCU grace
period and needless RCU priority boosting.
It is still illegal to call rcu_read_unlock() while holding a scheduler
lock if the prior RCU read-side critical section has ever had either
preemption or irqs enabled. However, the common use case is legal,
namely where then entire RCU read-side critical section executes with
irqs disabled, for example, when the scheduler lock is held across the
entire lifetime of the RCU read-side critical section.
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Peter Zijlstra [Wed, 20 Jul 2011 16:42:57 +0000 (18:42 +0200)]
sched: Avoid creating superfluous NUMA domains on non-NUMA systems
When creating sched_domains, stop when we've covered the entire
target span instead of continuing to create domains, only to
later find they're redundant and throw them away again.
This avoids single node systems from touching funny NUMA
sched_domain creation code and reduces the risks of the new
SD_OVERLAP code.
Requested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Anton Blanchard <anton@samba.org>
Cc: mahesh@linux.vnet.ibm.com
Cc: benh@kernel.crashing.org
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/1311180177.29152.57.camel@twins
Signed-off-by: Ingo Molnar <mingo@elte.hu>