History log of /linux-master/drivers/media/dvb-frontends/drx39xyj/drxj.c
Revision Date Author Comments
# e50f23b1 04-Aug-2023 Ruan Jinjie <ruanjinjie@huawei.com>

media: dvb-frontends: drx39xyj: Remove unnecessary ternary operators

There are a few ternary operators, the true or false judgement of which
is unnecessary in C language semantics.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>


# 86495af1 08-Sep-2023 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: dvb: symbol fixup for dvb_attach()

In commit 9011e49d54dc ("modules: only allow symbol_get of
EXPORT_SYMBOL_GPL modules") the use of symbol_get is properly restricted
to GPL-only marked symbols. This interacts oddly with the DVB logic
which only uses dvb_attach() to load the dvb driver which then uses
symbol_get().

Fix this up by properly marking all of the dvb_attach attach symbols as
EXPORT_SYMBOL_GPL().

Fixes: 9011e49d54dc ("modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules")
Cc: stable <stable@kernel.org>
Reported-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: linux-media@vger.kernel.org
Cc: linux-modules@vger.kernel.org
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Link: https://lore.kernel.org/r/20230908092035.3815268-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e78da4da 29-Jan-2023 Jonathan Neuschäfer <j.neuschaefer@gmx.net>

media: dvb-frontends: Fix a typo ("Unknow sleep mode")

Spell "unknown" correctly.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 55869f43 26-Jan-2023 Hans Verkuil <hverkuil-cisco@xs4all.nl>

media: dvb-frontends: drx39xyj: replace return with goto for proper unwind

In three places there was a return instead of a goto to the unwind
code.

This fixes three smatch warnings:

drxj.c:9542 ctrl_get_qam_sig_quality() warn: missing unwind goto?
drxj.c:10919 ctrl_set_standard() warn: missing unwind goto?
drxj.c:11466 drxj_open() warn: missing unwind goto?

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# dc8239bd 28-Nov-2022 Hans Verkuil <hverkuil-cisco@xs4all.nl>

media: dvb-frontends: drx39xyj: set missing error code

The rc return code was never set in hi_command().

This fixes this smatch warning:

drivers/media/dvb-frontends/drx39xyj/drxj.c:2351 hi_command() warn: missing error code 'rc'

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 225d0dbd 28-Jan-2021 Colin Ian King <colin.king@canonical.com>

media: drxj: remove redundant assignments to variable image_to_select

The variable image_to_select is being initialized with a value that
is never read and it is being updated later with a new value. The
initialization is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 7fd85371 19-Oct-2020 Tom Rix <trix@redhat.com>

media: remove unneeded break

A break is not needed if it is preceded by a return

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# df561f66 23-Aug-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

treewide: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>


# ef45b77b 07-Jan-2020 Colin Ian King <colin.king@canonical.com>

media: drxj: remove redundant assignments to variable rc

The variable rc is being initialized with a value that is never
read and it is being updated later with a new value. The initialization
is redundant and can be removed.

Addresses-Coverity: ("Unused value")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 767f22ac 01-Aug-2019 Colin Ian King <colin.king@canonical.com>

media: drxj: remove redundant assignment to variable rc

The variable rc is being initialized with a value that is never
read and it is being updated later with a new value. The
initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# f6af820e 03-Jul-2019 Fuqian Huang <huangfq.daxian@gmail.com>

media: media/dvb: Use kmemdup rather than duplicating its implementation

kmemdup is introduced to duplicate a region of memory in a neat way.
Rather than kmalloc/kzalloc + memcpy, which the programmer needs to
write the size twice (sometimes lead to mistakes), kmemdup improves
readability, leads to smaller code and also reduce the chances of mistakes.
Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 868c9a17 18-Feb-2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

media: dvb-frontends: fix several typos

Use codespell to fix lots of typos over frontends.

Manually verified to avoid false-positives.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 78cf8c84 03-Sep-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

media: drxj: fix spelling mistake in fall-through annotations

Replace "falltrough" with a proper "fall through" annotation.

This fix is part of the ongoing efforts to enabling
-Wimplicit-fallthrough

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# c4f04796 07-Aug-2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

media: drxj: get rid of uneeded casts

Instead of doing casts, use %zd to print sizes, in order to make
smatch happier:
drivers/media/dvb-frontends/drx39xyj/drxj.c:11814 drx_ctrl_u_code() warn: argument 4 to %u specifier is cast from pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:11845 drx_ctrl_u_code() warn: argument 3 to %u specifier is cast from pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:11869 drx_ctrl_u_code() warn: argument 3 to %u specifier is cast from pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:11878 drx_ctrl_u_code() warn: argument 3 to %u specifier is cast from pointer

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 40e43111 07-Aug-2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

media: cleanup fall-through comments

As Ian pointed out, adding a '-' to the fallthrough seems to meet
the regex requirements at level 3 of the warning, at least when
the comment fits into a single line.

So, replace by a single line the comments that were broken into
multiple lines just to make gcc -Wimplicit-fallthrough=3 happy.

Suggested-by: Ian Arkver <ian.arkver.dev@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# f1b1eabf 05-Jul-2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

media: dvb: represent min/max/step/tolerance freqs in Hz

Right now, satellite frontend drivers specify frequencies in kHz,
while terrestrial/cable ones specify in Hz. That's confusing
for developers.

However, the main problem is that universal frontends capable
of handling both satellite and non-satelite delivery systems
are appearing. We end by needing to hack the drivers in
order to support such hybrid frontends.

So, convert everything to specify frontend frequencies in Hz.

Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 4a3fad70 04-Jan-2018 Mauro Carvalho Chehab <mchehab@kernel.org>

media: fix usage of whitespaces and on indentation

On several places, whitespaces are being used for indentation,
or even at the end of the line.

Fix them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# fada1935 28-Dec-2017 Mauro Carvalho Chehab <mchehab@kernel.org>

media: move dvb kAPI headers to include/media

Except for DVB, all media kAPI headers are at include/media.

Move the headers to it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 7369bbf2 17-Dec-2017 Nick Desaulniers <ndesaulniers@google.com>

media: dvb-frontends: remove extraneous parens

Fixes 2 warnings from Clang about extra parentheses in a conditional,
that might have been meant as assignment.

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 452c6446 01-Nov-2017 Mauro Carvalho Chehab <mchehab@kernel.org>

media: drxj: better handle errors

as reported by smatch:
drivers/media/dvb-frontends/drx39xyj/drxj.c:2157 drxj_dap_atomic_read_write_block() error: uninitialized symbol 'word'.

The driver doesn't check if a read error occurred. Add such
check.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 34eb9751 27-Nov-2017 Mauro Carvalho Chehab <mchehab@kernel.org>

media: drxj and drxk: don't produce kernel-doc warnings

Those drivers use a different notation for comments. While
it is not worth converting to kernel-doc, removing it is also
not an option.

So, just replace /** by /* and be happy :-)

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 679cfbb1 13-Jul-2017 Colin Ian King <colin.king@canonical.com>

media: drxj: make several const arrays static

Don't populate const arrays on the stack but instead make them static.
Makes the object code smaller by over 1800 bytes:

Before:
text data bss dec hex filename
94100 9160 0 103260 1935c drxj.o

After:
text data bss dec hex filename
91044 10400 0 101444 18c44 drxj.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 06eeefe8 18-May-2017 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] media drivers: annotate fall-through

Avoid warnings like those:

drivers/media/pci/ddbridge/ddbridge-core.c: In function 'dvb_input_detach':
drivers/media/pci/ddbridge/ddbridge-core.c:787:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (input->fe) {
^
drivers/media/pci/ddbridge/ddbridge-core.c:792:2: note: here
case 4:
^~~~
...

On several cases, it is just that gcc 7.1 is not capable of
understanding the comment, but on other places, we need an
annotation.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 2c149601 27-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

scripts/spelling.txt: add "configuartion" pattern and fix typo instances

Fix typos and add the following to the scripts/spelling.txt:

configuartion||configuration

While we are here, fix the "ouput" as well in the touched hunk in
drivers/media/dvb-frontends/drx39xyj/drx_driver.h.

Link: http://lkml.kernel.org/r/1481573103-11329-23-git-send-email-yamada.masahiro@socionext.com
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# bd336e63 09-Aug-2016 Max Kellermann <max.kellermann@gmail.com>

[media] dvb: make DVB frontend *_ops instances "const"

These are immutable. Making them "const" allows the compiler to move
them to the "rodata" section.

Note that cxd2841er_t_c_ops cannot be made "const", because
cxd2841er_attach() modifies it. Ouch!

[mchehab@s-opensource.com: fix merge conflicts]
Signed-off-by: Max Kellermann <max.kellermann@gmail.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 01d7d436 24-Jun-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

drxj: comment out the unused nicam_presc_table_val table

Avoid this warning:

drivers/media/dvb-frontends/drx39xyj/drxj.c:1243:18: warning: 'nicam_presc_table_val' defined but not used [-Wunused-const-variable=]
static const u16 nicam_presc_table_val[43] = {
^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# b6554ea5 27-Feb-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drxj: don't do math if not needed

While there's no risk of divison by zero, the logic there is akward, as it
does the calculus for the numerator and denominator before checking
if this will be used.

Change the order to check first if the denominator is zero, and only
calculating the numerator/denominator if not.

This should also avoid those smatch errors:
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 54c8cdd4 22-Feb-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drxj: set_param_parameters array is too short

Fixes this smatch warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:4151 drxj_dap_scu_atomic_read_write_block() error: buffer overflow 'set_param_parameters' 15 <= 17

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 0df289a2 07-Jun-2015 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] dvb: Get rid of typedev usage for enums

The DVB API was originally defined using typedefs. This is against
Kernel CodingStyle, and there's no good usage here. While we can't
remove its usage on userspace, we can avoid its usage in Kernelspace.

So, let's do it.

This patch was generated by this shell script:

for j in $(grep typedef include/uapi/linux/dvb/frontend.h |cut -d' ' -f 3); do for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f); do sed "s,${j}_t,enum $j," <$i >a && mv a $i; done; done

While here, make CodingStyle fixes on the affected lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> # for drivers/media/firewire/*


# 5a13e40b 08-May-2015 Mauro Carvalho Chehab <mchehab@kernel.org>

media: replace bellow -> below

Bellow is yelling. Ok, sometimes the code is yells a lot, but
but this is not the case there ;)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 69bb7ab6 13-Apr-2015 Cheolhyun Park <pch851130@gmail.com>

[media] drx-j: Misspelled comment corrected

Fix several typos inside the driver's comments.

Signed-off-by: Cheolhyun Park <pch851130@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 9bc2dd7e 19-Nov-2014 Markus Elfring <elfring@users.sourceforge.net>

[media] DVB-frontends: Deletion of unnecessary checks before the function call "release_firmware"

GIT_AUTHOR_DATE=1416472432
The release_firmware() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 4182438e 20-Aug-2014 Hans Verkuil <hans.verkuil@cisco.com>

[media] drxj: fix sparse warnings

drivers/media/dvb-frontends/drx39xyj/drxj.c:11768:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11768:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11768:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11768:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11770:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11770:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11770:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11770:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11796:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11796:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11796:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11796:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11798:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11798:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11798:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11798:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11800:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11800:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11800:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11800:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11605:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11605:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11605:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11605:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11632:29: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11632:29: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11632:29: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11632:29: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11652:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11652:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11652:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11652:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11654:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11654:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11654:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11654:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11656:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11656:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11656:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11656:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11670:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11670:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11670:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11670:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 60ecb71a 26-Jul-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] remove some new warnings on drxj

changeset b601fe5688ae did some cleanup, but didn't remove some
now unused vars:
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_set_frontend':
drivers/media/dvb-frontends/drx39xyj/drxj.c:12072:21: warning: unused variable 'uio_data' [-Wunused-variable]
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_set_lna':
drivers/media/dvb-frontends/drx39xyj/drxj.c:12230:21: warning: unused variable 'uio_data' [-Wunused-variable]
drivers/media/dvb-frontends/drx39xyj/drxj.c:12229:20: warning: unused variable 'uio_cfg' [-Wunused-variable]
drivers/media/dvb-frontends/drx39xyj/drxj.c:12224:6: warning: unused variable 'result' [-Wunused-variable]

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b601fe56 24-Jul-2014 Shuah Khan <shuah@kernel.org>

[media] media: drx39xyj - use drxj_set_lna_state() and remove duplicate LNA code

drx39xxj_set_lna() and drx39xxj_set_frontend() set LNA. Instead of
duplicating LNA configure code, change to use drxj_set_lna_state()
which sets LNA to the caller requested state (on or off).

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 30741871 22-Jul-2014 Shuah Khan <shuah@kernel.org>

[media] media: drx39xyj - fix to return actual error codes instead of -EIO

Several functions ignore the return values in error legs and always
return -EIO. This makes it hard to debug and take proper action in
calling routines.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 998819d2 24-Jul-2014 Shuah Khan <shuah@kernel.org>

[media] media: drx39xyj - add resume support

drx39xyj driver lacks resume support. Add support by changing
its fe ops init interface to detect the resume status by checking
fe exit flag and do the necessary initialization. With this change,
driver resume correctly in both dvb adapter is not in use and in use
by an application cases.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 5b22b1a4 12-Jul-2014 Shuah Khan <shuah@kernel.org>

[media] media: drx39xyj driver change to check fe exit flag from release

Change drx39xyj_release() to check fe exit flag to detect the
device disconnect state and avoid accessing the device after
it has been removed.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 20f63150 25-May-2014 Benoit Taine <benoit.taine@lip6.fr>

[media] drx-j: Use kmemdup instead of kmalloc + memcpy

This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 90d9c3e1 11-Mar-2014 Gianluca Gennari <gennarone@gmail.com>

[media] drx39xyj: fix 64 bit division on 32 bit arch

Fix this linker warning:
WARNING: "__divdi3" [media_build/v4l/drx39xyj.ko] undefined!

[m.chehab@samsung.com: add include for asm/div64.h]
Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 0d49e776 11-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

drx-j: Fix post-BER calculus on QAM modulation

There are two troubles there:
1) the bit error measure were not accumulating;
2) it was missing the bit count.

Fix them.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# ee0f4a14 11-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

drx-j: use ber_count var

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'ctrl_get_qam_sig_quality':
drivers/media/dvb-frontends/drx39xyj/drxj.c:9468:6: warning: variable 'ber_cnt' set but not used [-Wunused-but-set-variable]
u32 ber_cnt = 0; /* BER count */
^

By reading the comment, it is said that BER should be calculated as:
qam_pre_rs_ber = frac_times1e6( ber_cnt, rs_bit_cnt );

Also, it makes sense to take the mantissa into account, so fix the
code to do what's commented.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# d591590e 10-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: enable DVBv5 stats

Now that everything is set, let's enable DVBv5 stats, for
applications that support it.

DVBv3 apps will still work.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 80846a5c 10-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Fix detection of no signal

When the signal is 7, it means that no signal was received.

Value experimentally measured.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 69832578 10-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: properly handle bit counts on stats

Instead of just assuming that the min resolution is 1E-6,
pass both bit error and bit counts for userspace to calculate
BER. The same applies for PER, for 8VSB. It is not clear how
to get the packet count for QAM. So, for now, don't expose PER
for QAM.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 03fdfbfd 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Prepare to use DVBv5 stats

Convert the stats internally to use DVBv5. For now, it will keep
showing everything via DVBv3 API only, as the .len value were
not initialized.

That allows testing if the new stats code didn't break anything.

A latter patch will add the final bits for the DVBv5 stats to
fully work.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 80e5ed14 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: re-add get_sig_strength()

We'll need to use this function. Restore it from the
git history.

This function will be used on the next patch.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 6f64c522 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Don't use "state" for DVB lock state

State is already used on other places for the state struct.
Don't use it here, to avoid troubles with latter patches.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 9c44a5d7 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of some unused vars

As reported when compiled with W=1:

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘ctrl_set_channel’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:10340:26: warning: variable ‘common_attr’ set but not used [-Wunused-but-set-variable]
struct drx_common_attr *common_attr = NULL;
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:10336:6: warning: variable ‘intermediate_freq’ set but not used [-Wunused-but-set-variable]
s32 intermediate_freq = 0;

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 691cbbe3 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: propagate returned error from request_firmware()

Fix a smatch warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:11711 drx_ctrl_u_code() info: why not propagate 'rc' from request_firmware() instead of (-2)?

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 1e5ec31a 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Fix usage of drxj_close()

This function is currently not used. However, it was meant to
be called at device release. So, add it there.

While here, remove the bad check, as reported by Dan, as
smatch warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:20041 drxj_close() warn: variable dereferenced before check 'demod' (see line 20036)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 01473146 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: remove external symbols

This driver doesn't export any external symbol, except for
the attach() method.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b6c4065e 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of dead code

There are large chunks of code at drx-j that aren't used. Most
of them are due to analog TV support. Well, just enabling them
won't make analog support work, as devices with DRX and analog
support requires an extra chip (avf4910).

We don't have drivers for it, nor the current device that uses
this frontend has support for analog TV.

So, let's just get rid of this code. If latter needed, this
patch can easily be reverted from git history.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 1d001c3f 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: don't use mc_info before checking if its not NULL

smatch warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:20803 drx_ctrl_u_code() warn: variable dereferenced before check 'mc_info' (see line 20800)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 87bf0e54 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Fix dubious usage of "&" instead of "&&"

Fixes the following warnings:
drivers/media/dvb-frontends/drx39xyj/drxj.c:16764:68: warning: dubious: x & !y
drivers/media/dvb-frontends/drx39xyj/drxj.c:16778:68: warning: dubious: x & !y
drivers/media/dvb-frontends/drx39xyj/drxj.c:16797:68: warning: dubious: x & !y

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# db5657c5 09-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Don't use 0 as NULL

Fixes the following warnings:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:65: warning: Using plain integer as NULL pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:71: warning: Using plain integer as NULL pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:52: warning: Using plain integer as NULL pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:58: warning: Using plain integer as NULL pointer

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# c4cfb293 09-Mar-2014 Fengguang Wu <fengguang.wu@intel.com>

[media] drx-j: drxj_default_aud_data_g can be static

Fix sparse warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1039:16: sparse: symbol 'drxj_default_aud_data_g' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# a5e7a67f 03-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: set it to serial mode by default

Currently, there's just one device using this frontend: PCTV 80e,
and it works on serial mode.

Change the default here to serial mode. If we add more devices,
then this option should be set via config structure.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 41b5cc0c 02-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Properly initialize mpeg struct before using it

The cfg_mpeg_output has more fields than what it is initialized
when the code is called. Be sure to initialize everything before
use, in order to avoid random behaviors.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# bf9b94ab 02-Mar-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: disable OOB

Just like the windows driver, disable OOB after setting the driver
version.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 1ad77b5c 28-Feb-2014 Shuah Khan <shuah@kernel.org>

[media] drx-j: fix boot failure due to null pointer dereference

DJH_DEBUG only code path in drxbsp_i2c_write_read() dereferences
w_dev_addr and subsequently w_dev_addr->user_data->i2c which results
in failure during boot. This patch fixes the null pointer derefence
bug as well as the following compile errors:

LD arch/x86/built-in.o
CC drivers/media/dvb-frontends/drx39xyj/drxj.o
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxbsp_i2c_write_read’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1558:25: error: redeclaration of ‘state’ with no linkage
struct drx39xxj_state *state = w_dev_addr->user_data;
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1512:25: note: previous declaration of ‘state’ was here
struct drx39xxj_state *state;
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1558:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct drx39xxj_state *state = w_dev_addr->user_data;
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1560:17: error: redeclaration of ‘msg’ with no linkage
struct i2c_msg msg[2] = {
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1513:17: note: previous declaration of ‘msg’ was here
struct i2c_msg msg[2];
^

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 546ef6bf 28-Feb-2014 Shuah Khan <shuah@kernel.org>

[media] drx-j: remove return that prevents DJH_DEBUG code to run

drxbsp_i2c_write_read() has return that prevents DJH_DEBUG code to run.
Remove it.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 6c955b8b 28-Feb-2014 Shuah Khan <shuah@kernel.org>

[media] drx-j: fix pr_dbg undefined compile errors when DJH_DEBUG is defined

drxj.c fails to compile with the following errors when DJH_DEBUG
is defined.

drivers/media/dvb-frontends/drx39xyj/drxj.c:1567:2: error: implicit declaration of function ‘pr_dbg’ [-Werror=implicit-function-declaration]
pr_dbg("drx3933 i2c operation addr=%x i2c=%p, wc=%x rc=%x\n",
^

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 8afff9a2 27-Feb-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: be sure to do a full software reset

Mimic what windows driver does here: it writes 0x07 to
SIO_CC_SOFT_RST__A, instead of just 0x03.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# d7a5478a 27-Feb-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: be sure to send the powerup command at device open

As drxj_close puts the device in powerdown, we need to power it up
properly at drxj_open.

This is the behavior noticed at the Windows driver.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# ea8f3c2c 15-Feb-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Allow userspace control of LNA

Instead of just disabling the LNA every time, allow to control it from
userspace.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 244c0e06 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of function wrappers

On several places, the I2C functions are just wrappers to others.

Get rid of it.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 80bff4b0 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of struct drx_dap_fasi_funct_g

This struct contains the first abstraction layer for the I2C
access routines. Get rid of it.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 73b3fc3d 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of drx_dap_fasi.c

This file contains an abstract layer for the I2C transfer
functions. Get rid of it, merging it at drxj. This will allow
to remove another abstraction layer there, making the code
easier to read, and removing the functions that just return
-EIO.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 97a8918a 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Get rid of I2C protocol version

This is not used anywere. Get rid of it.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 938f11fa 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Fix qam/256 mode

QAM/256 currently doesn't work, as the code is only called if
channel->mirror is DRX_MIRROR_AUTO, but a prevous if prevents
this condition to happen.

While here, returns -EINVAL to not supported QAM modes and
simplify the code, reducing the number of indents.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 096c8fac 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: remove some unused data

Those struct data aren't used anymore. Get rid of them.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# ceea5e2d 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: use the proper timeout code on scu_command

Checking if a time is after another one can have issues, as
times are generally u32 wide.

Use the proper macros for that at scu_command().

It should be noticed that other places also use jiffies
calculus on an improper way. This should be fixed too,
but the logic there is more complex. So, let's do it in
separate patches.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# c4dc6f92 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: call ctrl_set_standard even if a standard is powered

Modulation and other parameters might have changed. So, better
to call ctrl_set_standard() even if the device is already
powered.

That helps to put the device into a sane state, if something
got wrong on a previous set_frontend call.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# c76286ba 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: avoid calling power_down_foo twice

When switching from one video standard to another one,
power_down_vsb is called twice. Well, as the device is already
in power_down mode, the second call always fail. This causes that
any subsequent frontend set to fail as well:

[145074.501243] drx39xyj:power_down_vsb: called
[145089.195396] drx39xyj:power_down_vsb: error -5
[145089.195404] drx39xyj:ctrl_set_standard: error -5
[145089.195417] drx39xyj:drx39xxj_set_frontend: Failed to set standard! result=fffffffb
[145089.195470] drx39xyj:ctrl_sig_quality: error -5
[145089.195473] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145089.195475] drx39xyj:ctrl_sig_quality: error -5
[145089.195477] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145089.195479] drx39xyj:ctrl_sig_quality: error -5
[145089.195480] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145089.195482] drx39xyj:ctrl_sig_quality: error -5
[145089.195484] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!
[145089.195498] drx39xyj:ctrl_sig_quality: error -5
[145089.195500] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145089.195502] drx39xyj:ctrl_sig_quality: error -5
[145089.195503] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145089.195505] drx39xyj:ctrl_sig_quality: error -5
[145089.195506] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145089.195508] drx39xyj:ctrl_sig_quality: error -5
[145089.195510] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!
[145090.196291] drx39xyj:drx39xxj_read_status: drx39xxj: could not get lock status!
[145090.196508] drx39xyj:ctrl_sig_quality: error -5
[145090.196511] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145090.196514] drx39xyj:ctrl_sig_quality: error -5
[145090.196515] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145090.196518] drx39xyj:ctrl_sig_quality: error -5
[145090.196519] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145090.196522] drx39xyj:ctrl_sig_quality: error -5
[145090.196523] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!
[145090.196553] drx39xyj:ctrl_sig_quality: error -5
[145090.196554] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145090.196557] drx39xyj:ctrl_sig_quality: error -5
[145090.196558] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145090.196560] drx39xyj:ctrl_sig_quality: error -5
[145090.196562] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145090.196564] drx39xyj:ctrl_sig_quality: error -5
[145090.196565] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!
[145091.119265] drx39xyj:ctrl_sig_quality: error -5
[145091.119271] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145091.119274] drx39xyj:ctrl_sig_quality: error -5
[145091.119276] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145091.119278] drx39xyj:ctrl_sig_quality: error -5
[145091.119280] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145091.119282] drx39xyj:ctrl_sig_quality: error -5
[145091.119283] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 7abc7a54 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: be sure to use tuner's IF

Instead of just hardcoding an IF value of 5MHz, use the one
provided by the tuner, with can be different for QAM and
VSB.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# a6530ce5 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of tuner dummy get/set frequency

Those functions will never be used with Linux DVB binding.

Get rid of them.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# d7b0631e 26-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: remove some ugly bindings from drx39xxj_dummy.c

This file does an ugly binding between drxj and DVB frontend.

Remove most of the functions there. We still need to get rid of
get_frequency and set_frequency, but such patch is a little more
complex, as it should also remove some previous tuner bindings.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 74c8794a 24-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: comment or remove unused code

In order to avoid warnings and to remove dead code, remove
the functions that don't make sense to happen, while commenting
the others that might still be useful some day.

That reduced a lot the text size:

Before:

text data bss dec hex filename
58419 2916 4 61339 ef9b drivers/media/dvb-frontends/drx39xyj/drx39xyj.ko

After:
text data bss dec hex filename
78331 2916 4 81251 13d63 drivers/media/dvb-frontends/drx39xyj/drx39xyj.ko

Without any functional changes.

It could be make sense latter to remove those drivers or to
move them into an analog-specific part of the driver.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b0baeb49 24-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of drxj_ctrl()

With this change, we finally got rid of all abstraction
layers on this driver.

This patch also fixes the LNA GPIO settings, as the original
code were using a wrong control name for it.

This patch exposes the several functions that aren't used.
Some of them are related to analog demod that might be
used some day, but others will likely never be needed, as
they don't fit on Linux media APIs.

Latter patches will clean up this mess.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 19013747 23-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: move drx39xxj into drxj.c

While drxj is already too big, moving the code there will
make easier to get rid of the drxj_ctrl function.

It will also help to detect and remove the unused functions,
helping to remove lots of dead code there.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b78359a6 23-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of the remaining drx generic functions

Get rid of drx_open and drx_close, as those are just wrapper
functions to drxj_open/drxj_close.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# dc5a91d4 24-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of drx_ctrl

This function is used only as an abstraction layer to call the
two firmware functions. Remove it.

As a bonus, the drx_ctrl_function is now unused and can be
removed.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 30de0bfc 24-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Remove duplicated firmware upload code

Remove the duplicated firmware upload code that was commented
inside drxj.c.

This code is not used, and will not work anyway, as it doesn't
download the firmware from userspace.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 5b60053c 24-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Avoid any regressions by preserving old behavior

The version is initialized with zero at drx_driver.c. Keep it,
in order to avoid the risk of causing any regression.

While here, remove the drx_driver.h from drxj, as this is not
required there.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b240eacd 24-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of drx_driver.c

This file contains just the firmware load code, that it is also
somewhat duplicated at drxj.c.

Move the code into there. Latter patches will remove the
duplicated code.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# aafdbaa6 19-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: reset the DVB scan configuration at powerup

Without this fixup, the DRX-J will not be properly initialized,
loosing several PIDs.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b48293db 18-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: dynamically load the firmware

Instead of hardcoding the firmware files together with the driver,
use request_firmware() way, loading it from userspace.

The firmware files are placed at:
http://linuxtv.org/downloads/firmware/#8

And they'll be latter submitted to linux-firmware git tree.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 9cf5370e 17-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: remove the useless microcode_size

This var is not used. Remove it from the code, as we'll now be
converting the driver to load the firmware from an external
file.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# c361fda0 17-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: remove drxj_options.h

This file is empty (actually, all commented there). So, remove it.

We should latter remove those macros too, or convert them into
a struct to allow dynamically enable the options during device
probing time.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b8cbcd35 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of some ugly macros

There are several get/set macros that are bogus: they just
call another macro and do either:
x = FOO(d)
or
FOO(d) = x

As checkpatch complains about that, and replacing all of them
are as easy as running a small coccinelle script, get rid
of all of them.

Script used:

@@
expression d, x;
@@
-DRX_SET_MIRRORFREQSPECT(d, x);
+DRX_ATTR_MIRRORFREQSPECT(d) = x;

@@
expression d, x;
@@
-DRX_GET_MIRRORFREQSPECT(d, x);
+x = DRX_ATTR_MIRRORFREQSPECT(d);

@@
expression d, x;
@@
-DRX_SET_CURRENTPOWERMODE(d, x);
+DRX_ATTR_CURRENTPOWERMODE(d) = x;

@@
expression d, x;
@@
-DRX_GET_CURRENTPOWERMODE(d, x);
+x = DRX_ATTR_CURRENTPOWERMODE(d);

@@
expression d, x;
@@
-DRX_SET_MICROCODE(d, x);
+DRX_ATTR_MICROCODE(d) = x;

@@
expression d, x;
@@
-DRX_GET_MICROCODE(d, x);
+x = DRX_ATTR_MICROCODE(d);

@@
expression d, x;
@@
-DRX_SET_MICROCODESIZE(d, x);
+DRX_ATTR_MICROCODESIZE(d) = x;

@@
expression d, x;
@@
-DRX_GET_MICROCODESIZE(d, x);
+x = DRX_ATTR_MICROCODESIZE(d);

@@
expression d, x;
@@
-DRX_SET_VERIFYMICROCODE(d, x);
+DRX_ATTR_VERIFYMICROCODE(d) = x;

@@
expression d, x;
@@
-DRX_GET_VERIFYMICROCODE(d, x);
+x = DRX_ATTR_VERIFYMICROCODE(d);

@@
expression d, x;
@@
-DRX_SET_MCVERTYPE(d, x);
+DRX_ATTR_MCRECORD(d).aux_type = x;

@@
expression d, x;
@@
-DRX_GET_MCVERTYPE(d, x);
+x = DRX_ATTR_MCRECORD(d).aux_type;

@@
expression d, x;
@@
-DRX_SET_MCDEV(d, x);
+DRX_ATTR_MCRECORD(d).mc_dev_type = x;

@@
expression d, x;
@@
-DRX_GET_MCDEV(d, x);
+x = DRX_ATTR_MCRECORD(d).mc_dev_type;

@@
expression d, x;
@@
-DRX_SET_MCVERSION(d, x);
+DRX_ATTR_MCRECORD(d).mc_version = x;

@@
expression d, x;
@@
-DRX_GET_MCVERSION(d, x);
+x = DRX_ATTR_MCRECORD(d).mc_version;

@@
expression d, x;
@@
-DRX_SET_MCPATCH(d, x);
+DRX_ATTR_MCRECORD(d).mc_base_version = x;

@@
expression d, x;
@@
-DRX_GET_MCPATCH(d, x);
+x = DRX_ATTR_MCRECORD(d).mc_base_version;

@@
expression d, x;
@@
-DRX_SET_I2CADDR(d, x);
+DRX_ATTR_I2CADDR(d) = x;

@@
expression d, x;
@@
-DRX_GET_I2CADDR(d, x);
+x = DRX_ATTR_I2CADDR(d);

@@
expression d, x;
@@
-DRX_SET_I2CDEVID(d, x);
+DRX_ATTR_I2CDEVID(d) = x;

@@
expression d, x;
@@
-DRX_GET_I2CDEVID(d, x);
+x = DRX_ATTR_I2CDEVID(d);

@@
expression d, x;
@@
-DRX_SET_USEBOOTLOADER(d, x);
+DRX_ATTR_USEBOOTLOADER(d) = x;

@@
expression d, x;
@@
-DRX_GET_USEBOOTLOADER(d, x);
+x = DRX_ATTR_USEBOOTLOADER(d);

@@
expression d, x;
@@
-DRX_SET_CURRENTSTANDARD(d, x);
+DRX_ATTR_CURRENTSTANDARD(d) = x;

@@
expression d, x;
@@
-DRX_GET_CURRENTSTANDARD(d, x);
+x = DRX_ATTR_CURRENTSTANDARD(d);

@@
expression d, x;
@@
-DRX_SET_PREVSTANDARD(d, x);
+DRX_ATTR_PREVSTANDARD(d) = x;

@@
expression d, x;
@@
-DRX_GET_PREVSTANDARD(d, x);
+x = DRX_ATTR_PREVSTANDARD(d);

@@
expression d, x;
@@
-DRX_SET_CACHESTANDARD(d, x);
+DRX_ATTR_CACHESTANDARD(d) = x;

@@
expression d, x;
@@
-DRX_GET_CACHESTANDARD(d, x);
+x = DRX_ATTR_CACHESTANDARD(d);

@@
expression d, x;
@@
-DRX_SET_CURRENTCHANNEL(d, x);
+DRX_ATTR_CURRENTCHANNEL(d) = x;

@@
expression d, x;
@@
-DRX_GET_CURRENTCHANNEL(d, x);
+x = DRX_ATTR_CURRENTCHANNEL(d);

@@
expression d, x;
@@
-DRX_SET_ISOPENED(d, x);
+DRX_ATTR_ISOPENED(d) = x;

@@
expression d, x;
@@
-DRX_GET_ISOPENED(d, x);
+x = DRX_ATTR_ISOPENED(d);

@@
expression d, x;
@@
-DRX_SET_TUNER(d, x);
+DRX_ATTR_TUNER(d) = x;

@@
expression d, x;
@@
-DRX_GET_TUNER(d, x);
+x = DRX_ATTR_TUNER(d);

@@
expression d, x;
@@
-DRX_SET_CAPABILITIES(d, x);
+DRX_ATTR_CAPABILITIES(d) = x;

@@
expression d, x;
@@
-DRX_GET_CAPABILITIES(d, x);
+x = DRX_ATTR_CAPABILITIES(d);

@@
expression d, x;
@@
-DRX_SET_PRODUCTID(d, x);
+DRX_ATTR_PRODUCTID(d) = x;

@@
expression d, x;
@@
-DRX_GET_PRODUCTID(d, x);
+x = DRX_ATTR_PRODUCTID(d);

@@
expression d, x;
@@
-DRX_SET_MFX(d, x);
+DRX_ATTR_PRODUCTID(d) = x;

@@
expression d, x;
@@
-DRX_GET_MFX(d, x);
+x = DRX_ATTR_PRODUCTID(d);

@@
expression d, x;
@@
-DRX_SET_INTERMEDIATEFREQ(d, x);
+DRX_ATTR_INTERMEDIATEFREQ(d) = x;

@@
expression d, x;
@@
-DRX_GET_INTERMEDIATEFREQ(d, x);
+x = DRX_ATTR_INTERMEDIATEFREQ(d);

@@
expression d, x;
@@
-DRX_SET_SYSCLOCKFREQ(d, x);
+DRX_ATTR_SYSCLOCKFREQ(d) = x;

@@
expression d, x;
@@
-DRX_GET_SYSCLOCKFREQ(d, x);
+x = DRX_ATTR_SYSCLOCKFREQ(d);

@@
expression d, x;
@@
-DRX_SET_TUNERRFAGCPOL(d, x);
+DRX_ATTR_TUNERRFAGCPOL(d) = x;

@@
expression d, x;
@@
-DRX_GET_TUNERRFAGCPOL(d, x);
+x = DRX_ATTR_TUNERRFAGCPOL(d);

@@
expression d, x;
@@
-DRX_SET_TUNERIFAGCPOL(d, x);
+DRX_ATTR_TUNERIFAGCPOL(d) = x;

@@
expression d, x;
@@
-DRX_GET_TUNERIFAGCPOL(d, x);
+x = DRX_ATTR_TUNERIFAGCPOL(d);

@@
expression d, x;
@@
-DRX_SET_TUNERSLOWMODE(d, x);
+DRX_ATTR_TUNERSLOWMODE(d) = x;

@@
expression d, x;
@@
-DRX_GET_TUNERSLOWMODE(d, x);
+x = DRX_ATTR_TUNERSLOWMODE(d);

@@
expression d, x;
@@
-DRX_SET_TUNERPORTNR(d, x);
+DRX_ATTR_TUNERSPORTNR(d) = x;

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 935c6654 17-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Replace printk's by pr_foo()

Instead of using printk's, use the pr_foo() macros.

That fixes some checkpatch warnings and provide a better error,
warning and debug support.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 9482354f 17-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Use the Linux error codes

Instead of defining its own set of error codes, use the linux
native ones.

Please note that this patch made a "stupid" error code mapping, just
replacing the codes with the closest one. In special, -EIO is being
used on several places. I'm pretty sure this could be better assigned,
but a change like that would require lots o time and efforts, without
much benefit.

So lets do adjstments at the error codes latter, when we have more
time.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 63713517 17-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: CodingStyle fixups on drxj.c

Fix almost all checkpatch.pl warnings/errors on drxj.c, except for:
- 80 cols whitespacing;
- too many leading tabs;
- a false positive at DRXJ_16TO8() macro.
- static char array declaration should probably be static const char
as adding "const" would cause warnings.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 60d3603b 17-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Remove typedefs in drxj.c

Remove three typedefs from drxj.c, using the following script:

use File::Find;
use strict;

my $dir = shift or die "need a dir";
my $type = shift or die "need type";
my $var = shift or die "need var";

sub handle_file {
my $file = shift;

my $out;

open IN, $file or die "can't open $file";
$out .= $_ while (<IN>);
close IN;

$out =~ s/\btypedef\s+($type)\s+\{([\d\D]+?)\s*\}\s+\b($var)[^\;]+\;/$type $var \{\2\};/;

# This replaces the typedef declaration for a simple struct declaration - style 1

# This replaces the typedef declaration for a simple struct declaration - style 2

# Replace struct occurrences

$out =~ s,\b($var)_t\s+,$type \1 ,g;
$out =~ s,\bp_*($var)_t\s+,$type \1 *,g;
$out =~ s,\b($var)_t\b,$type \1,g;
$out =~ s,\bp_*($var)_t\b,$type \1 *,g;

open OUT, ">$file" or die "can't open $file";
print OUT $out;
close OUT;
}

sub parse_dir {
my $file = $File::Find::name;

return if (!($file =~ /.[ch]$/));

handle_file $file;
}

find({wanted => \&parse_dir, no_chdir => 1}, $dir);

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# e33f2193 17-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: More CamelCase fixups

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 259f380e 17-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Simplify logic expressions

Don't need to test boolean x == true or x == false.

That makes the code more compact.

patch generated with make coccicheck and manually reviewed.

While here, remove uneeded ';'.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 64e49cb9 17-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: don't use parenthesis on return

CodingStyle fix: don't use parenthesis on return, as it is not
a function.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 068e94ea 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: replace the ugly CHK_ERROR() macro

Using return and goto inside macros is ugly and makes harder to
understand the code and the labels. Remove those macros, and add
a proper error debug message, when something bad happens.

This was generated using the following coccinelle script:

@@
@@
-DUMMY_READ();
+do {
+ u16 dummy;
+ RR16(demod->my_i2c_dev_addr, SCU_RAM_VERSION_HI__A, &dummy);
+} while (0);

@@
expression dev, addr, val;
@@
-WR16(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.write_reg16func(dev, addr, val, 0))

@@
expression dev, addr, val;
@@
-RR16(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.read_reg16func(dev, addr, val, 0))

@@
expression dev, addr, val;
@@
-WR32(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.write_reg32func(dev, addr, val, 0))

@@
expression dev, addr, val;
@@
-RR32(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.read_reg32func(dev, addr, val, 0))

@@
expression dev, addr, val, block;
@@
-WRB(dev, addr, val, block)
+CHK_ERROR(DRXJ_DAP.write_block_func(dev, addr, val, block, 0))

@@
expression dev, addr, val, block;
@@
-RRB(dev, addr, val, block)
+CHK_ERROR(DRXJ_DAP.read_block_func(dev, addr, val, block, 0))

@@
expression dev, addr, val;
@@
-BCWR16(dev, addr, val)
+CHK_ERROR(DRXJ_DAP.write_reg16func(dev, addr, val, DRXDAP_FASI_BROADCAST))

@@
expression dev, addr, val;
@@
-ARR32(dev, addr, val)
+CHK_ERROR(drxj_dap_atomic_read_reg32(dev, addr, val, 0))

@@
expression dev, addr, val;
@@
-SARR16(dev, addr, val)
+CHK_ERROR(drxj_dap_scu_atomic_read_reg16(dev, addr, val, 0))

@@
expression x;
@@
-CHK_ERROR(x);
+rc = x;
+if (rc != DRX_STS_OK) {
+ pr_err("error %d\n", rc);
+ goto rw_error;
+}

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b1d0a596 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Don't use buffer if an error occurs

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxj_dap_scu_atomic_read_reg16’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:4170:9: warning: ‘*((void *)&buf+1)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
word = (u16) (buf[0] + (buf[1] << 8));
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:4170:9: warning: ‘buf’ may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxj_dap_atomic_read_reg32.isra.59’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:2186:7: warning: ‘*((void *)&buf+3)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
word = (u32) buf[3];
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:2188:10: warning: ‘*((void *)&buf+2)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
word |= (u32) buf[2];
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:2190:10: warning: ‘*((void *)&buf+1)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
word |= (u32) buf[1];
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:2192:10: warning: ‘buf’ may be used uninitialized in this function [-Wmaybe-uninitialized]
word |= (u32) buf[0];
^

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# adc0e258 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: a few more CodingStyle fixups

Some whitespace cleanups.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# b3ce3a83 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Get rid of typedefs on drxh.h

This were fixed with the help of this small perl script:

#!/usr/bin/perl
my $dir = shift or die "need a dir";
my $type = shift or die "need type";
my $var = shift or die "need var";
sub handle_file {
my $file = shift;
my $out;
open IN, $file or die "can't open $file";
$out .= $_ while (<IN>);
close IN;
$out =~ s/\btypedef\s+($type)\s+\{([\d\D]+?)\s*\}\s+\b($var)[^\;]+\;/$type $var \{\2\};/;
$out =~ s,\b($var)_t\s+,$type \1 ,g;
$out =~ s,\bp_*($var)_t\s+,$type \1 *,g;
$out =~ s,\b($var)_t\b,$type \1,g;
$out =~ s,\bp_*($var)_t\b,$type \1 *,g;
open OUT, ">$file" or die "can't open $file";
print OUT $out;
close OUT;
}
sub parse_dir {
my $file = $File::Find::name;
return if (!($file =~ /.[ch]$/));
handle_file $file;
}
find({wanted => \&parse_dir, no_chdir => 1}, $dir);

Some manual work were needed.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 1bfc9e15 15-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of typedefs in drx_driver.h

Most of the changes were done with scripts like:
for i in drivers/media/dvb-frontends/drx39xyj/*.[ch]; do perl -ne '$var = "drx_sig_quality"; s,\b($var)_t\s+,struct \1 ,g; s,\bp_*($var)_t\s+,struct \1 *,g; s,\b($var)_t\b,struct \1,g; s,\bp_*($var)_t\b,struct \1 *,g; print $_' <$i >a && mv a $i; done

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 4d7bb0eb 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Remove a bunch of unused but assigned vars

None of those vars are used on those functions. Just remove them.

After this patch, there's just one of such warnings:

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'ctrl_get_qam_sig_quality':
drivers/media/dvb-frontends/drx39xyj/drxj.c:7872:6: warning: variable 'ber_cnt' set but not used [-Wunused-but-set-variable]
u32 ber_cnt = 0; /* BER count */

We'll keep it, as BER count will be useful when converting the
frontend to report statistics via DVBv5 API

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# c677f760 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: remove the unused tuner_i2c_write_read() function

This function is not static. Also, it is not used anywhere.
So, drop it.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 22892268 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: do more CodingStyle fixes

This time, use checkpatch --strict --fix.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 57afe2f0 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Don't use CamelCase

There's no reason at all to use CamelCase here. Convert all of
them to normal case.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 7ef66759 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: Use checkpatch --fix to solve several issues

Instead of manually fixing the issues, use the --fix experimental
checkpatch. That solves a bunch of checkpatch issues.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# dbe82e06 16-Jan-2014 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: fix whitespacing on pointer parmameters

Patch generated with this script:

for i in drivers/media/dvb-frontends/drx39xyj/*.[ch]; do perl -ne 's,(enum|struct|void|int|u32|u64|u16|u8|s8|s16|s32|s64)\s+(\S+)\s+\*[ ]+,\1 \2 *,g; print $_' <$i >a && mv a $i; done

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 61263c75 19-Mar-2012 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of most of the typedefs

There are lots of typedefs there. Let's get rid of them.

Most of the work here is due to this small script:

if [ "$3" == "" ]; then
echo "usage: $0 type DRXName drx_name"
fi
t=$1; f=$2; g=$3
for i in *.[ch]; do
sed s,"p${f}_t","$t $g *",g <$i >a && mv a $i && \
sed s,"${f}_t","$t $g",g <$i >a && mv a $i
done

Just kept there the function typedefs, as those are still useful.

Yet, all those tuner_ops can likely be just removed on a latter
cleanup patch.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 73f7065b 19-Mar-2012 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of the other typedefs at bsp_types.h

Most of the work were done by those small scripts:

for i in *; do sed s,pDRXFrequency_t,"s32 *",g <$i >a && mv a $i; done
for i in *; do sed s,DRXFrequency_t,"s32",g <$i >a && mv a $i; done
for i in *; do sed s,pDRXSymbolrate_t,"u32 *",g <$i >a && mv a $i; done
for i in *; do sed s,DRXSymbolrate_t,"u32",g <$i >a && mv a $i; done
for i in *; do sed s,FALSE,false,g <$i >a && mv a $i; done
for i in *; do sed s,TRUE,true,g <$i >a && mv a $i; done
for i in *; do sed s,Bool_t,bool,g <$i >a && mv a $i; done
for i in *; do sed s,pbool,"bool *",g <$i >a && mv a $i; done

The only remaining things there are the return values.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 43a431e4 19-Mar-2012 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of the integer typedefs

Patch created using this small script:

for j in 8 16 32; do for i in *; do sed s,pu${j}_t,"u$j *",g <$i >a && mv a $i; done; done
for j in 8 16 32; do for i in *; do sed s,ps${j}_t,"s$j *",g <$i >a && mv a $i; done; done
for j in 8 16 32; do for i in *; do sed s,s${j}_t,"s$j",g <$i >a && mv a $i; done; done
for j in 8 16 32; do for i in *; do sed s,u${j}_t,"u$j",g <$i >a && mv a $i; done; done

and fixing the bsp_types.h header.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# bab3fcca 19-Mar-2012 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: remove the "const" annotate on HICommand()

After removing the typedef, it is now clear that HICommand() were
abusing of a var that was expecting to be constant:

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘HICommand’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:2272:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2272:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2273:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2273:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2274:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2274:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2275:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2275:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2278:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2278:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2279:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2279:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2291:2: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2291:2: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2311:4: warning: passing argument 1 of ‘drxDapDRXJFunct_g.readReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2311:4: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2315:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.readReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2315:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 5b223b39 19-Mar-2012 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: get rid of the typedefs on bsp_i2c.h

Most of the hard work here were done by this small script:

for i in *; do sed s,pI2CDeviceAddr_t,"struct i2c_device_addr *",g <$i >a && mv a $i; done
for i in *; do sed s,I2CDeviceAddr_t,"struct i2c_device_addr",g <$i >a && mv a $i; done

Only bsp_i2c.h were added by hand.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 443f18d0 19-Mar-2012 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] drx-j: CodingStyle fixes

Do the automatic CodingStyle fixes found at Lindent.

No functional changes.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# ca3355a9 04-Jul-2010 Devin Heitmueller <dheitmueller@kernellabs.com>

[media] drx-j: put under 3-clause BSD license

Relicense the drx-j driver under a standard 3-clause BSD license, which makes
it GPL compatible.

This was done explicitly with permission from Trident Microsystems.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 38b2df95 13-Aug-2012 Devin Heitmueller <dheitmueller@kernellabs.com>

[media] drx-j: add a driver for Trident drx-j frontend

Add support for the Trident DRX-J driver, including a card profile for the
PCTV 80e which uses the chip.

Thanks to Trident for allowing the release of this code under a BSD license,
and of course Hauppauge/PCTV for pushing for its release to the community.

[pdickeybeta@gmail.com: modified to fix compilation errors and also to move
the driver files from the drx39xy subdirectory to the frontends directory]

[m.chehab@samsung.com: fix merge conflicts, commented drx-j compilation and
added EM28XX_R06_I2C_CLK setup also to the board setup]

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>