Clear the cx231xx_devused variable and free dev in the error handling code,
as done in the error handling code nearby.
The semantic match that finds this problem is as follows:
// <smpl>
@r@
identifier x;
@@
kfree(x)
@@
identifier r.x;
expression E1!=0,E2,E3,E4;
statement S;
@@
(
if (<+...x...+>) S
|
if (...) { ... when != kfree(x)
when != if (...) { ... kfree(x); ... }
when != x = E3
* return E1;
}
... when != x = E2
if (...) { ... when != x = E4
kfree(x); ... return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Free the recently allocated qcam in each case.
The semantic match that finds this problem is as follows:
// <smpl>
@r@
identifier x;
@@
kfree(x)
@@
identifier r.x;
expression E1!=0,E2,E3,E4;
statement S;
@@
(
if (<+...x...+>) S
|
if (...) { ... when != kfree(x)
when != if (...) { ... kfree(x); ... }
when != x = E3
* return E1;
}
... when != x = E2
if (...) { ... when != x = E4
kfree(x); ... return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
There were several coding style errors as reported by checkpatch.pl. This
patch should fix those errors with the single exception of the open square
bracket issue on line 45.
[mchehab@redhat.com: Fix a merge conflict]
Signed-off-by: Adam M. Dutko <dutko.adam@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
If the tvp->cmd == DTV_MAX_COMMAND then we read past the end of the
array.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This patch, based on code by Mirek Slugen, implements support for the
Leadtek WinFast PxDVR3200 H card with XC4000 tuner (107d:6f39).
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Make sure that the 'static' keywork is at the beginning of declaration
for drivers/media/video/omap/omap_vout.c
This gets rid of warnings like
when building with -Wold-style-declaration (and/or -Wextra which also
enables it).
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Delete a couple of leftover fields whose time has passed.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The Marvell camera core can support all three videobuf2 buffer modes, which
is slick, but it also requires that all three modes be built and present,
even though only one is likely to be used. This patch allows the supported
modes to be selected at configuration time, reducing the footprint of the
driver. Prior to this patch, the MMP camera driver looked like this:
mmp_camera 19092 0
videobuf2_core 15542 1 mmp_camera
videobuf2_dma_sg 3173 1 mmp_camera
videobuf2_dma_contig 2188 1 mmp_camera
videobuf2_vmalloc 1718 1 mmp_camera
videobuf2_memops 2100 3 videobuf2_dma_sg,videobuf2_dma_contig,videobuf2_vmalloc
Afterward, instead, with scatter/gather only configured:
mmp_camera 16021 0
videobuf2_core 15542 1 mmp_camera
videobuf2_dma_sg 3173 1 mmp_camera
videobuf2_memops 2100 1 videobuf2_dma_sg
The total goes from 43,813 bytes to 36,836.
The emphasis has been on simplicity and minimal #ifdef use rather than on
squeezing out every possible byte of code. For configuration, the driver
simply looks at which videobuf2 modes have been configured in and supports
them all; it's simplistic but should be good enough.
The cafe driver is set to support vmalloc and dma-contig; mmp supports only
dma-sg, since that's the only mode that really makes sense to use.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
If registration does not work, we don't want to leave the sensor powered on.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Somewhere along the way the code stopped actually paying any attention to
them, and I doubt anybody has ever made use of them.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This code shows signs of having been mucked with over the last five years
or so; things were kind of mixed up. This patch reorders functions into a
more rational organization which, with luck, will facilitate making the
buffer modes selectable at configuration time. Code movement only: no
functional changes here.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This structure got passed over in the videobuf2 conversion; it has no
reason to exist now.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The third parameter of module_param is supposed to represent sysfs
file permissions. A value of "1" leads to the following:
$ ls -l /sys/module/radio_tea5764/parameters/
total 0
I am changing it to "0" to align with the other module parameters in
this driver.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Fabio Belavenuto <belavenuto@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Based on the work of John Newbigin, Davor Emard and others who contributed
on the mailing lists.
The previous 'support' for this card was a partial merge of John's changes
that, as far as I can tell, never actually got the thing working (no DVB-T,
analog tuner not initialised).
Initialise the analog tuner properly and hook up the DVB tuner and demodulator.
DVB-T and analog now work (though I can't tune every DVB channel, but I think
there's an issue with the aerial and signal boosters here that is causing
me problems).
Signed-off-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
If those demods are unselected, but a bridge driver requires them,
produce a runtime message, instead of missing symbols.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Use a name convention for the firmware file that matches on the
current firmware namespacing. Also, add it to the firmware
download script.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The QAM standard is set using this scu_command:
SCU_RAM_COMMAND_STANDARD_QAM |
SCU_RAM_COMMAND_CMD_DEMOD_SET_PARAM
The driver implements a version that has 4 parameters, however,
Terratec H5 needs to break this into two separate commands, otherwise,
DVB-C doesn't work.
With this fix, scan is now properly working and getting the
channel list:
>>> tune to: 609000000:INVERSION_AUTO:5217000:FEC_3_4:QAM_256
>>> tuning status == 0x00
>>> tuning status == 0x07
>>> tuning status == 0x1f
0x0093 0x0026: pmt_pid 0x0758 (null) -- SporTV2 (running, scrambled)
0x0093 0x0027: pmt_pid 0x0748 (null) -- SporTV (running, scrambled)
0x0093 0x0036: pmt_pid 0x0768 (null) -- FX (running, scrambled)
0x0093 0x0052: pmt_pid 0x0788 (null) -- The History Channel (running, scrambled)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Now, it outputs:
[10927.639641] drxk: SCU_RESULT_INVPAR while sending cmd 0x0203 with params:
[10927.646283] drxk: 02 00 00 00 10 00 07 00 03 02 ..........
Better than ERROR -3. This happens with Terratec H5 firmware.
It adds 2 new error conditions, and something useful to track
what the heck is that.
I suspect that the scu_command is dependent on the firmware
revision.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The driver is too limited: it assumes that UIO is used only for
controlling the antenna, and that only UIO-1 is in usage. However,
from Terratec H7 driver [1], 3 UIO's can be used. In fact, it seems
that H7 needs to use all 3. So, make the code generic enough to handle
the most complex scenario. For now, only antena GPIO can be specified,
but is is easier now to add the other GPIO/UIO needs.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
DRX-K configuration is interesting when writing/testing
new devices. Add an info line showing the discovered info.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Terratec H5 doesn't require to switch mode, but generates
an error due to this logic. Also, GPIO's are board-dependent.
So, add it at the board config struct.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The set mode routines assume that state were changed to the
new mode, otherwise, they'll fail.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This driver is very big and complex. An error happening in the middle
of any initialization may cause the frontend to not work. So, it
needs to properly propagate error codes internally and to userspace.
Also, printing the error codes at the places it happened helps to
discover were's a bug at the code.
Before this change, a do { } while (0) loop and lots of breaks inside
were used to propagate errors. While this works, if there are
loops inside other loops, it could be easy to forget to add another
break, causing the error to not abort the function.
Also, as not all functions were reporting errors, it is hard to
discover why something failed.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
On em28xx, tda18271C2 is accessible when the i2c port
is not touched. Touching on it breaks the driver.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
All I2C logs we got for em28xx does that. With Terratec H5, at
400MHz speed, it seems that this is required, to avoid having
troubles at the I2C bus.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The microcode firmware provided on Terratec H5 seems to be
different. Add a parameter to allow specifying a different
firmware per-device.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Instead of using #ifdef I2C_LONG_ADR for some devices, convert
it into a parameter. Terratec H5 logs from the original driver
seems to need this mode.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Currently, the only parameter to be configured is the I2C
address. However, Terratec H5 logs shows that it needs a different
setting for some things, and it has its own firmware.
So, move the addr into a config structure, in order to allow adding
the required configuration bits.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The normal 16-bits read routine is called as "Read16_0". This is
due to a flags that could optionally be passed. Yet, on no places
at the code, a flag is passed there.
The same happens with 16-bits write and 32-read/write routines,
and with WriteBlock.
Also, using flags, is an exception: there's no place currently using
flags, except for an #ifdef at WriteBlock.
Rename the function as just "read16", and the one that requires flags,
as "read16_flags".
This helps to see where the flags are used, and also avoid using
CamelCase on Kernel.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This is a complex driver. Adding support for other devices with drxk
requires to be able to debug it and see where it is failing. So, add
optional printk messages to allow debugging it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
It is hard to identify the origin for those errors without a
prefix to indicate which driver produced them:
[ 1390.220984] i2c_write error
[ 1390.224133] I2C Write error
[ 1391.284202] i2c_read error
[ 1392.288685] i2c_read error
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
It is hard to identify the origin for those errors without a
prefix to indicate which driver produced them:
[ 1390.220984] i2c_write error
[ 1390.224133] I2C Write error
[ 1391.284202] i2c_read error
[ 1392.288685] i2c_read error
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/ddbridge/built-in.o: In function `my_dvb_dmx_ts_card_init':
/home/v4l/v4l/patchwork/drivers/media/dvb/ddbridge/ddbridge-core.c:718: multiple definition of `my_dvb_dmx_ts_card_init'
drivers/media/dvb/ngene/built-in.o:/home/v4l/v4l/patchwork/drivers/media/dvb/ngene/ngene-dvb.c:227: first defined here
drivers/media/dvb/ddbridge/built-in.o: In function `my_dvb_dmxdev_ts_card_init':
/home/v4l/v4l/patchwork/drivers/media/dvb/ddbridge/ddbridge-core.c:737: multiple definition of `my_dvb_dmxdev_ts_card_init'
drivers/media/dvb/ngene/built-in.o:/home/v4l/v4l/patchwork/drivers/media/dvb/ngene/ngene-dvb.c:246: first defined here
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Fix compilation of ngene/ddbridge for DVB_CXD2099=n.
Note: Bug was introduced by commit 'cxd2099: Update to latest version'.
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Driver support for Digital Devices ddbridge-based cards:
Octopus, Octopus mini, Octopus LE, cineS2(v6)
with DuoFlex S2 and/or DuoFlex CT tuners.
Driver was taken from ddbridge-0.6.1.tar.bz2.
Signed-off-by: Ralph Metzler <rmetzler@digitaldevices.de>
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The CHK_ERROR macro does a flow control, violating chapter 12
of the Documentation/CodingStyle. Doing flow controls inside
macros is a bad idea, as it hides what's happening. It also
hides the var "status" with is also a bad idea.
The changes were done by this small perl script:
my $blk=0;
while (<>) {
s/^\s+// if ($blk);
$f =~ s/\s+$// if ($blk && /^\(/);
$blk = 1 if (!m/\#/ && m/CHK_ERROR/);
$blk=0 if ($blk && m/\;/);
s/\n/ / if ($blk);
$f.=$_;
};
$f=~ s,\n(\t+)CHK_ERROR\((.*)\)\;([^\n]*),\n\1status = \2;\3\n\1if (status < 0)\n\1\tbreak;,g;
print $f;
And manually fixed.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
One of the problems of the old CHECK_ERROR is that it was hiding
the status parameter. Maybe due to that, on a few places, the return
code might lead to return incorrect status:
drivers/media/dvb/frontends/drxk_hard.c: In function ‘load_microcode.clone.0’:
drivers/media/dvb/frontends/drxk_hard.c:1281: warning: ‘status’ may be used uninitialized in this function
drivers/media/dvb/frontends/drxk_hard.c:1281: note: ‘status’ was declared here
drivers/media/dvb/frontends/drxk_hard.c: In function ‘GetLockStatus’:
drivers/media/dvb/frontends/drxk_hard.c:1792: warning: ‘status’ may be used uninitialized in this function
drivers/media/dvb/frontends/drxk_hard.c: In function ‘Start.clone.7’:
drivers/media/dvb/frontends/drxk_hard.c:1734: warning: ‘status’ may be used uninitialized in this function
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>