]> git.proxmox.com Git - mirror_ubuntu-kernels.git/log
mirror_ubuntu-kernels.git
7 years ago[media] cec-gpio: don't generate spurious HPD events
Hans Verkuil [Mon, 25 Sep 2017 08:02:57 +0000 (05:02 -0300)]
[media] cec-gpio: don't generate spurious HPD events

Only send HPD_LOW/HIGH event if the gpio actually changed value.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] cx231xx-cards: fix NULL-deref on missing association descriptor
Johan Hovold [Thu, 21 Sep 2017 08:40:18 +0000 (05:40 -0300)]
[media] cx231xx-cards: fix NULL-deref on missing association descriptor

Make sure to check that we actually have an Interface Association
Descriptor before dereferencing it during probe to avoid dereferencing a
NULL-pointer.

Fixes: e0d3bafd0258 ("V4L/DVB (10954): Add cx231xx USB driver")
Cc: stable <stable@vger.kernel.org> # 2.6.30
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media/i2c/tc358743: Initialize timer
Kees Cook [Wed, 20 Sep 2017 23:27:41 +0000 (20:27 -0300)]
[media] media/i2c/tc358743: Initialize timer

This converts to use setup_timer() to set callback and data, though it
doesn't look like this would have worked with timer checking enabled
since no init_timer() was ever called before.

Cc: Mats Randgaard <matrandg@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] vivid: add support for Y10 and Y12
Hans Verkuil [Fri, 15 Sep 2017 14:51:45 +0000 (11:51 -0300)]
[media] vivid: add support for Y10 and Y12

Add support for 10 and 12 bit luma formats.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] v4l2-tpg: add Y10 and Y12 support
Hans Verkuil [Fri, 15 Sep 2017 14:51:44 +0000 (11:51 -0300)]
[media] v4l2-tpg: add Y10 and Y12 support

Support the 10 and 12 bit luma formats.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] rcar_drif: fix potential uninitialized variable use
Arnd Bergmann [Thu, 14 Sep 2017 11:07:27 +0000 (08:07 -0300)]
[media] rcar_drif: fix potential uninitialized variable use

Older compilers like gcc-4.6 may run into a case that returns
an uninitialized variable from rcar_drif_enable_rx() if that
function was ever called with an empty cur_ch_mask:

drivers/media/platform/rcar_drif.c:658:2: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized]

Newer compilers don't have that problem as they optimize the
'ret' variable away and just return zero in that case.

This changes the function to return -EINVAL for this particular
failure, to make it consistent across all compiler versions.
In case gcc gets changed to report a warning for it in the
future, it's also a good idea to shut it up now.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82203
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] saa7146: make saa7146_use_ops const
Bhumika Goyal [Wed, 13 Sep 2017 19:37:50 +0000 (16:37 -0300)]
[media] saa7146: make saa7146_use_ops const

Make these const as they are not modified in the file referencing them.
They are only used when their function pointer fields invokes a
function and therefore none of the structure fields are getting modified.
Also, add a const to the declaration in the header.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] gspca: make arrays static, reduces object code size
Colin Ian King [Tue, 12 Sep 2017 11:08:13 +0000 (08:08 -0300)]
[media] gspca: make arrays static, reduces object code size

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

Before:
   text    data     bss     dec     hex filename
  58259    8880     128   67267   106c3 ov519.o

After:
   text    data     bss     dec     hex filename
  52155    9776     128   62059    f26b ov519.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: i2c: adv748x: Map v4l2_std_id to the internal reg value
Simon Yuan [Mon, 11 Sep 2017 22:26:53 +0000 (19:26 -0300)]
[media] media: i2c: adv748x: Map v4l2_std_id to the internal reg value

The video standard was not mapped to the corresponding value of the
internal video standard in adv748x_afe_querystd, causing the wrong
video standard to be selected.

Fixes: 3e89586a64df ("media: i2c: adv748x: add adv748x driver")
[Kieran: Obtain the std from the afe->curr_norm]

Signed-off-by: Simon Yuan <simon.yuan@navico.com>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: v4l2-pci-skeleton: Fix error handling path in 'skeleton_probe()'
Christophe JAILLET [Mon, 11 Sep 2017 16:53:07 +0000 (13:53 -0300)]
[media] media: v4l2-pci-skeleton: Fix error handling path in 'skeleton_probe()'

If this memory allocation fails, we must release some resources, as
already done in the code below and above.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] imon: Improve a size determination in two functions
Markus Elfring [Tue, 29 Aug 2017 10:45:59 +0000 (07:45 -0300)]
[media] imon: Improve a size determination in two functions

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: Delete duplicate debug message
Marc Gonzalez [Mon, 18 Sep 2017 14:31:41 +0000 (11:31 -0300)]
[media] media: rc: Delete duplicate debug message

ir_setkeytable() and ir_create_table() print the same debug message.
Delete the one in ir_setkeytable()

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: default for RC_CORE should be n
Stephen Hemminger [Fri, 8 Sep 2017 16:39:29 +0000 (13:39 -0300)]
[media] media: default for RC_CORE should be n

The Linus policy on Kconfig is that the default should be no
for all new devices. I.e the user rebuild a new kernel from an
old config should not by default get a larger kernel.

Fixes: b4c184e506a4 ("[media] media: reorganize the main Kconfig items")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: Use bsearch library function
Thomas Meyer [Fri, 8 Sep 2017 16:33:36 +0000 (13:33 -0300)]
[media] media: rc: Use bsearch library function

Replace self coded binary search, by existing library version.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: use gpiolib API
Ladislav Michl [Thu, 7 Sep 2017 23:41:32 +0000 (20:41 -0300)]
[media] media: rc: gpio-ir-recv: use gpiolib API

Gpiolib API is preferred way to access gpios.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: remove gpio_ir_recv_platform_data
Ladislav Michl [Thu, 7 Sep 2017 23:39:45 +0000 (20:39 -0300)]
[media] media: rc: gpio-ir-recv: remove gpio_ir_recv_platform_data

gpio_ir_recv_platform_data are not used anywhere in kernel tree,
so remove it.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: use KBUILD_MODNAME
Ladislav Michl [Thu, 7 Sep 2017 23:39:14 +0000 (20:39 -0300)]
[media] media: rc: gpio-ir-recv: use KBUILD_MODNAME

There already is standard macro providing driver name, use it.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: use devm_request_irq
Ladislav Michl [Thu, 7 Sep 2017 23:38:20 +0000 (20:38 -0300)]
[media] media: rc: gpio-ir-recv: use devm_request_irq

Use of devm_request_irq simplifies error unwinding and as
free_irq was the last user of driver remove function,
remove it too.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: do not allow threaded interrupt handler
Ladislav Michl [Thu, 7 Sep 2017 23:37:36 +0000 (20:37 -0300)]
[media] media: rc: gpio-ir-recv: do not allow threaded interrupt handler

Requesting any context irq is not actually great idea since threaded
interrupt handler is run at too unpredictable time which turns
timing information wrong. Fix it by requesting regular interrupt.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: use devm_rc_register_device
Ladislav Michl [Thu, 7 Sep 2017 23:37:07 +0000 (20:37 -0300)]
[media] media: rc: gpio-ir-recv: use devm_rc_register_device

Use of devm_rc_register_device simplifies error unwinding.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: use devm_gpio_request_one
Ladislav Michl [Thu, 7 Sep 2017 23:36:39 +0000 (20:36 -0300)]
[media] media: rc: gpio-ir-recv: use devm_gpio_request_one

Use of devm_gpio_request_one simplifies error unwinding.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: use devm_rc_allocate_device
Ladislav Michl [Thu, 7 Sep 2017 23:36:11 +0000 (20:36 -0300)]
[media] media: rc: gpio-ir-recv: use devm_rc_allocate_device

Use of devm_rc_allocate_device simplifies error unwinding.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: use devm_kzalloc
Ladislav Michl [Thu, 7 Sep 2017 23:35:22 +0000 (20:35 -0300)]
[media] media: rc: gpio-ir-recv: use devm_kzalloc

Use of devm_kzalloc simplifies error unwinding.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: gpio-ir-recv: use helper variable to access device info
Ladislav Michl [Thu, 7 Sep 2017 23:34:35 +0000 (20:34 -0300)]
[media] media: rc: gpio-ir-recv: use helper variable to access device info

Using explicit struct device variable makes code a bit more readable.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: imon: make two const arrays static, reduces object code size
Colin Ian King [Tue, 5 Sep 2017 12:07:50 +0000 (09:07 -0300)]
[media] media: imon: make two const arrays static, reduces object code size

Don't populate the const arrays vfd_packet6 and fp_packet on the
stack, instead make them static.  Makes the object code smaller
by over 600 bytes:

Before:
   text    data     bss     dec     hex filename
  43794   17920    1024   62738    f512 drivers/media/rc/imon.o

After:
   text    data     bss     dec     hex filename
  42994   18080    1024   62098    f292 drivers/media/rc/imon.o

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@osg.samsung.com>
7 years ago[media] media: vp7045: port TwinhanDTV Alpha to rc-core
Sean Young [Wed, 6 Sep 2017 11:19:06 +0000 (08:19 -0300)]
[media] media: vp7045: port TwinhanDTV Alpha to rc-core

Only the nec protocol is understood, but then it doesn't pass on
the full scancode and it ignores the nec repeats its own remote
sends, so holding buttons does not work.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: include device name in rc udev event
Sean Young [Fri, 1 Sep 2017 14:34:23 +0000 (11:34 -0300)]
[media] media: rc: include device name in rc udev event

This name is also stored in the input's device name, but that
is not available in TX only hardware (no input device).

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: if protocols can't be changed, don't be writable
Sean Young [Fri, 1 Sep 2017 14:30:50 +0000 (11:30 -0300)]
[media] media: rc: if protocols can't be changed, don't be writable

If the protocols of an rc device cannot be changed, ensure the sysfs
file is not writable.

This makes it possible to detect this from userspace, so ir-keytable
can deal with case without giving an error.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: dvb: use dvb device name for rc device
Sean Young [Fri, 1 Sep 2017 13:10:01 +0000 (10:10 -0300)]
[media] media: rc: dvb: use dvb device name for rc device

"IR-receiver inside an USB DVB receiver" is not descriptive and we have
a proper name available.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: ensure that protocols are enabled for scancode drivers
Sean Young [Fri, 1 Sep 2017 12:55:59 +0000 (09:55 -0300)]
[media] media: rc: ensure that protocols are enabled for scancode drivers

rc scancode drivers without change_protocol should have all
protocols enabled at all time. This was only true for cec and
ir-kbd-i2c.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: avermedia keymap for a800
Sean Young [Fri, 1 Sep 2017 11:34:50 +0000 (08:34 -0300)]
[media] media: rc: avermedia keymap for a800

The keymap is missing one key, and correct another.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: dvb: a800: port to rc-core
Sean Young [Fri, 1 Sep 2017 12:29:58 +0000 (09:29 -0300)]
[media] media: dvb: a800: port to rc-core

This receiver only accepts nec16 messages, I've tried many other protocols
and they're all dropped.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: img-ir: delete an error message for a failed memory allocation
Markus Elfring [Tue, 29 Aug 2017 19:04:20 +0000 (16:04 -0300)]
[media] media: img-ir: delete an error message for a failed memory allocation

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: imon: delete an error message for a failed memory allocation
Markus Elfring [Tue, 29 Aug 2017 10:40:07 +0000 (07:40 -0300)]
[media] media: imon: delete an error message for a failed memory allocation

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: make device_type const
Bhumika Goyal [Sat, 19 Aug 2017 08:22:15 +0000 (05:22 -0300)]
[media] media: rc: make device_type const

Make this const as it is only stored in the type field of a device
structure, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: rc: constify usb_device_id
Arvind Yadav [Sun, 13 Aug 2017 08:54:44 +0000 (05:54 -0300)]
[media] media: rc: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: merge struct irctl into struct lirc_dev
David Härdeman [Sun, 25 Jun 2017 12:32:36 +0000 (09:32 -0300)]
[media] media: lirc_dev: merge struct irctl into struct lirc_dev

The use of two separate structs (lirc_dev aka lirc_driver and irctl) makes
it much harder to follow the proper lifetime of the various structs and
necessitates hacks such as keeping a copy of struct lirc_dev inside
struct irctl.

Merging the two structs means that lirc_dev can properly manage the
lifetime of the resulting struct and simplifies the code at the same time.

[mchehab@s-opensource.com: fix merge conflict]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_zilog: use a dynamically allocated lirc_dev
David Härdeman [Sun, 25 Jun 2017 12:32:31 +0000 (09:32 -0300)]
[media] media: lirc_zilog: use a dynamically allocated lirc_dev

lirc_zilog currently embeds a struct lirc_dev in its own struct IR,
but subsequent patches will make the lifetime of struct lirc_dev
dynamic (i.e.  it will be free():d once lirc_dev is sure there are
no users of the struct).

Therefore, change lirc_zilog to use a pointer to a dynamically
allocated struct lirc_dev.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_zilog: add a pointer to the parent device to struct IR
David Härdeman [Sun, 25 Jun 2017 12:32:25 +0000 (09:32 -0300)]
[media] media: lirc_zilog: add a pointer to the parent device to struct IR

lirc_zilog stashes a pointer to the parent device in struct lirc_dev
and uses it for logging. It makes more sense to let lirc_zilog keep
track of that pointer in its own struct (this is in preparation for
subsequent patches which will remodel struct lirc_dev).

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: introduce lirc_allocate_device and lirc_free_device
David Härdeman [Sun, 25 Jun 2017 12:32:15 +0000 (09:32 -0300)]
[media] media: lirc_dev: introduce lirc_allocate_device and lirc_free_device

Introduce two new functions so that the API for lirc_dev matches that
of the rc-core and input subsystems.

This means that lirc_dev structs are managed using the usual four
functions:

lirc_allocate_device
lirc_free_device
lirc_register_device
lirc_unregister_device

The functions are pretty simplistic at this point, later patches will put
more flesh on the bones of both.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
7 years ago[media] media: rename struct lirc_driver to struct lirc_dev
David Härdeman [Thu, 21 Sep 2017 19:13:34 +0000 (16:13 -0300)]
[media] media: rename struct lirc_driver to struct lirc_dev

This is in preparation for the later patches which do away with
struct irctl entirely.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: use an IDA instead of an array to keep track of registered...
David Härdeman [Sun, 25 Jun 2017 12:32:05 +0000 (09:32 -0300)]
[media] media: lirc_dev: use an IDA instead of an array to keep track of registered devices

Using the kernel-provided IDA simplifies the code and makes it possible
to remove the lirc_dev_lock mutex.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: sanitize locking
David Härdeman [Fri, 30 Jun 2017 08:41:57 +0000 (05:41 -0300)]
[media] media: lirc_dev: sanitize locking

Use the irctl mutex for all device operations and only use lirc_dev_lock
to protect the irctls array. Also, make sure that the device is alive
early in each fops function before doing anything else.

Since this patch touches nearly every line where the irctl mutex is
taken/released, it also renames the mutex at the same time (the name
irctl_lock will be misleading once struct irctl goes away in later
patches).

[mchehab@s-opensource.com: fix a merge conflict]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: change irctl->attached to be a boolean
David Härdeman [Sun, 25 Jun 2017 12:31:55 +0000 (09:31 -0300)]
[media] media: lirc_dev: change irctl->attached to be a boolean

The "attached" member of struct irctl is a boolean value, so let the code
reflect that.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: make chunk_size and buffer_size mandatory
David Härdeman [Sun, 25 Jun 2017 12:31:45 +0000 (09:31 -0300)]
[media] media: lirc_dev: make chunk_size and buffer_size mandatory

Make setting chunk_size and buffer_size mandatory for drivers which
expect lirc_dev to allocate the lirc_buffer (i.e. ir-lirc-codec) and
don't set them in lirc-zilog (which creates its own buffer).

Also remove an unnecessary copy of chunk_size in struct irctl (the
same information is already available from struct lirc_buffer).

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: make better use of file->private_data
David Härdeman [Sun, 25 Jun 2017 12:31:40 +0000 (09:31 -0300)]
[media] media: lirc_dev: make better use of file->private_data

By making better use of file->private_data in lirc_dev we can avoid
digging around in the irctls[] array, thereby simplifying the code.

External drivers need to use lirc_get_pdata() instead of mucking around
in file->private_data.

The newly introduced lirc_init_pdata() function isn't very elegant, but
it's a stopgap measure which can be removed once lirc_zilog is converted
to rc-core.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: use cdev_device_add() helper function
David Härdeman [Sun, 25 Jun 2017 12:31:35 +0000 (09:31 -0300)]
[media] media: lirc_dev: use cdev_device_add() helper function

Replace calls to cdev_add() and device_add() with the cdev_device_add()
helper function.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: remove support for manually specifying minor number
David Härdeman [Sun, 25 Jun 2017 12:31:24 +0000 (09:31 -0300)]
[media] media: lirc_dev: remove support for manually specifying minor number

All users of lirc_register_driver() uses dynamic minor allocation,
therefore we can remove the ability to explicitly request a given number.

This changes the function prototype of lirc_unregister_driver() to also
take a struct lirc_driver pointer as the sole argument.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years ago[media] media: lirc_dev: clarify error handling
David Härdeman [Sun, 25 Jun 2017 12:31:19 +0000 (09:31 -0300)]
[media] media: lirc_dev: clarify error handling

If an error is generated, it is more logical to error out ASAP.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years agoMerge tag 'v4.14-rc2' into patchwork
Mauro Carvalho Chehab [Fri, 29 Sep 2017 09:24:10 +0000 (05:24 -0400)]
Merge tag 'v4.14-rc2' into patchwork

Linux 4.14-rc2

* tag 'v4.14-rc2': (12066 commits)
  Linux 4.14-rc2
  tpm: ibmvtpm: simplify crq initialization and document crq format
  tpm: replace msleep() with  usleep_range() in TPM 1.2/2.0 generic drivers
  Documentation: tpm: add powered-while-suspended binding documentation
  tpm: tpm_crb: constify acpi_device_id.
  tpm: vtpm: constify vio_device_id
  security: fix description of values returned by cap_inode_need_killpriv
  x86/asm: Fix inline asm call constraints for Clang
  objtool: Handle another GCC stack pointer adjustment bug
  inet: fix improper empty comparison
  net: use inet6_rcv_saddr to compare sockets
  net: set tb->fast_sk_family
  net: orphan frags on stand-alone ptype in dev_queue_xmit_nit
  MAINTAINERS: update git tree locations for ieee802154 subsystem
  SMB3: Don't ignore O_SYNC/O_DSYNC and O_DIRECT flags
  SMB3: handle new statx fields
  arch: remove unused *_segments() macros/functions
  parisc: Unbreak bootloader due to gcc-7 optimizations
  parisc: Reintroduce option to gzip-compress the kernel
  apparmor: fix apparmorfs DAC access permissions
  ...

7 years agoLinux 4.14-rc2
Linus Torvalds [Sun, 24 Sep 2017 23:38:56 +0000 (16:38 -0700)]
Linux 4.14-rc2

7 years agoMerge tag 'devicetree-fixes-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 24 Sep 2017 23:04:12 +0000 (16:04 -0700)]
Merge tag 'devicetree-fixes-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull DeviceTree fixes from Rob Herring:

 - fix build for !OF providing empty of_find_device_by_node

 - fix Abracon vendor prefix

 - sync dtx_diff include paths (again)

 - a stm32h7 clock binding doc fix

* tag 'devicetree-fixes-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  dt-bindings: clk: stm32h7: fix clock-cell size
  scripts/dtc: dtx_diff - 2nd update of include dts paths to match build
  dt-bindings: fix vendor prefix for Abracon
  of: provide inline helper for of_find_device_by_node

7 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 24 Sep 2017 19:33:58 +0000 (12:33 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Another round of CR3/PCID related fixes (I think this addresses all
  but one of the known problems with PCID support), an objtool fix plus
  a Clang fix that (finally) solves all Clang quirks to build a bootable
  x86 kernel as-is"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/asm: Fix inline asm call constraints for Clang
  objtool: Handle another GCC stack pointer adjustment bug
  x86/mm/32: Load a sane CR3 before cpu_init() on secondary CPUs
  x86/mm/32: Move setup_clear_cpu_cap(X86_FEATURE_PCID) earlier
  x86/mm/64: Stop using CR3.PCID == 0 in ASID-aware code
  x86/mm: Factor out CR3-building code

7 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 24 Sep 2017 19:28:55 +0000 (12:28 -0700)]
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Ingo Molnar:
 "A clocksource driver section mismatch fix"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  clocksource/integrator: Fix section mismatch warning

7 years agoMerge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 24 Sep 2017 18:57:07 +0000 (11:57 -0700)]
Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fixes from Ingo Molnar:
 "Three irqchip driver fixes, and an affinity mask helper function bug
  fix affecting x86"

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  Revert "genirq: Restrict effective affinity to interrupts actually using it"
  irqchip.mips-gic: Fix shared interrupt mask writes
  irqchip/gic-v4: Fix building with ancient gcc
  irqchip/gic-v3: Iterate over possible CPUs by for_each_possible_cpu()

7 years agoMerge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 24 Sep 2017 18:53:13 +0000 (11:53 -0700)]
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull address-limit checking fixes from Ingo Molnar:
 "This fixes a number of bugs in the address-limit (USER_DS) checks that
  got introduced in the merge window, (mostly) affecting the ARM and
  ARM64 platforms"

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  arm64/syscalls: Move address limit check in loop
  arm/syscalls: Optimize address limit check
  Revert "arm/syscalls: Check address limit on user-mode return"
  syscalls: Use CHECK_DATA_CORRUPTION for addr_limit_user_check

7 years agoMerge branch 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
Linus Torvalds [Sun, 24 Sep 2017 18:40:41 +0000 (11:40 -0700)]
Merge branch 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security

Pull misc security layer update from James Morris:
 "This is the remaining 'general' change in the security tree for v4.14,
  following the direct merging of SELinux (+ TOMOYO), AppArmor, and
  seccomp.

  That's everything now for the security tree except IMA, which will
  follow shortly (I've been traveling for the past week with patchy
  internet)"

* 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
  security: fix description of values returned by cap_inode_need_killpriv

7 years agoMerge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
Linus Torvalds [Sun, 24 Sep 2017 18:34:28 +0000 (11:34 -0700)]
Merge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security

Pull TPM updates from James Morris:
 "Here are the TPM updates from Jarkko for v4.14, which I've placed in
  their own branch (next-tpm). I ended up cherry-picking them as other
  changes had been made in Jarkko's branch after he sent me his original
  pull request.

  I plan on maintaining a separate branch for TPM (and other security
  subsystems) from now on.

  From Jarkko: 'Not much this time except a few fixes'"

* 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
  tpm: ibmvtpm: simplify crq initialization and document crq format
  tpm: replace msleep() with  usleep_range() in TPM 1.2/2.0 generic drivers
  Documentation: tpm: add powered-while-suspended binding documentation
  tpm: tpm_crb: constify acpi_device_id.
  tpm: vtpm: constify vio_device_id

7 years agotpm: ibmvtpm: simplify crq initialization and document crq format
Michal Suchanek [Fri, 24 Feb 2017 19:35:16 +0000 (20:35 +0100)]
tpm: ibmvtpm: simplify crq initialization and document crq format

The crq is passed in registers and is the same on BE and LE hosts.
However, current implementation allocates a structure on-stack to
represent the crq, initializes the members swapping them to BE, and
loads the structure swapping it from BE. This is pointless and causes
GCC warnings about ununitialized members. Get rid of the structure and
the warnings.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
7 years agotpm: replace msleep() with usleep_range() in TPM 1.2/2.0 generic drivers
Hamza Attak [Mon, 14 Aug 2017 18:09:16 +0000 (19:09 +0100)]
tpm: replace msleep() with  usleep_range() in TPM 1.2/2.0 generic drivers

The patch simply replaces all msleep function calls with usleep_range calls
in the generic drivers.

Tested with an Infineon TPM 1.2, using the generic tpm-tis module, for a
thousand PCR extends, we see results going from 1m57s unpatched to 40s
with the new patch. We obtain similar results when using the original and
patched tpm_infineon driver, which is also part of the patch.
Similarly with a STM TPM 2.0, using the CRB driver, it takes about 20ms per
extend unpatched and around 7ms with the new patch.

Note that the PCR consistency is untouched with this patch, each TPM has
been tested with 10 million extends and the aggregated PCR value is
continuously verified to be correct.

As an extension of this work, this could potentially and easily be applied
to other vendor's drivers. Still, these changes are not included in the
proposed patch as they are untested.

Signed-off-by: Hamza Attak <hamza@hpe.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
7 years agoDocumentation: tpm: add powered-while-suspended binding documentation
Enric Balletbo i Serra [Tue, 27 Jun 2017 10:27:23 +0000 (12:27 +0200)]
Documentation: tpm: add powered-while-suspended binding documentation

Add a new powered-while-suspended property to control the behavior of the
TPM suspend/resume.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
7 years agotpm: tpm_crb: constify acpi_device_id.
Arvind Yadav [Thu, 6 Jul 2017 17:48:39 +0000 (23:18 +0530)]
tpm: tpm_crb: constify acpi_device_id.

acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   4198     608       0    4806    12c6 drivers/char/tpm/tpm_crb.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   4262     520       0    4782    12ae drivers/char/tpm/tpm_crb.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
7 years agotpm: vtpm: constify vio_device_id
Arvind Yadav [Thu, 17 Aug 2017 17:34:21 +0000 (23:04 +0530)]
tpm: vtpm: constify vio_device_id

vio_device_id are not supposed to change at runtime. All functions
working with vio_device_id provided by <asm/vio.h> work with
const vio_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
7 years agosecurity: fix description of values returned by cap_inode_need_killpriv
Stefan Berger [Thu, 27 Jul 2017 02:27:05 +0000 (22:27 -0400)]
security: fix description of values returned by cap_inode_need_killpriv

cap_inode_need_killpriv returns 1 if security.capability exists and
has a value and inode_killpriv() is required, 0 otherwise. Fix the
description of the return value to reflect this.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
7 years agomedia: staging: atomisp: use clock framework for camera clocks
Pierre-Louis Bossart [Wed, 20 Sep 2017 20:53:58 +0000 (16:53 -0400)]
media: staging: atomisp: use clock framework for camera clocks

The Atom ISP driver initializes and configures PMC clocks which are
already handled by the clock framework.

Remove all legacy vlv2_platform_clock stuff and move to the clk API to
avoid conflicts, e.g. with audio machine drivers enabling the MCLK for
external codecs

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Tested-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: Staging: media: atomisp: Use kcalloc instead of kzalloc
Srishti Sharma [Thu, 14 Sep 2017 10:18:40 +0000 (06:18 -0400)]
media: Staging: media: atomisp: Use kcalloc instead of kzalloc

Use kcalloc instead of kzalloc to check for an overflow before
multiplication. Done using the following semantic patch by
coccinelle.

http://coccinelle.lip6.fr/rules/kzalloc.cocci

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: atomisp:use ARRAY_SIZE() instead of open coding
Allen Pais [Wed, 13 Sep 2017 09:15:58 +0000 (05:15 -0400)]
media: atomisp:use ARRAY_SIZE() instead of open coding

The array_length() macro just duplicates ARRAY_SIZE(), so we can
delete it.

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: Staging: media: atomisp: Merge assignment with return
Srishti Sharma [Tue, 12 Sep 2017 14:12:29 +0000 (10:12 -0400)]
media: Staging: media: atomisp: Merge assignment with return

Merge the assignment and the return statements to return the value
directly. Done using the following semantic patch by coccinelle.

@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: Staging: atomisp: fix alloc_cast.cocci warnings
Branislav Radocaj [Thu, 7 Sep 2017 16:26:42 +0000 (12:26 -0400)]
media: Staging: atomisp: fix alloc_cast.cocci warnings

Remove casting the values returned by memory allocation functions
like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.

Semantic patch information:
This makes an effort to find cases of casting of values returned by
kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
the casting as it is not required. The result in the patch case may
need some reformatting.

Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci

Signed-off-by: Branislav Radocaj <branislav@radocaj.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging/atomisp: Use ARRAY_SIZE macro
Thomas Meyer [Sun, 3 Sep 2017 12:19:31 +0000 (08:19 -0400)]
media: staging/atomisp: Use ARRAY_SIZE macro

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging/atomisp: fix header guards
Nicolas Iooss [Sun, 3 Sep 2017 12:05:26 +0000 (08:05 -0400)]
media: staging/atomisp: fix header guards

Files input_formatter_subsystem_defs.h begin with:

    #ifndef _if_subsystem_defs_h
    #define _if_subsystem_defs_h__

and end with:

    #endif /* _if_subsystem_defs_h__ */

The intent seems to have been to use _if_subsystem_defs_h__ everywhere
but two underscores are missing in the initial #ifndef.

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: Remove unneeded intel-mid.h inclusion
Andy Shevchenko [Fri, 1 Sep 2017 13:36:40 +0000 (09:36 -0400)]
media: staging: atomisp: Remove unneeded intel-mid.h inclusion

In many files in the driver the intel-mid.h header inclusion is redundant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: Remove dead code for MID (#4)
Andy Shevchenko [Fri, 1 Sep 2017 13:36:39 +0000 (09:36 -0400)]
media: staging: atomisp: Remove dead code for MID (#4)

Since we switched to upstream IOSF MBI API the custom code
become not in use anymore.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: Move to upstream IOSF MBI API
Andy Shevchenko [Fri, 1 Sep 2017 13:36:38 +0000 (09:36 -0400)]
media: staging: atomisp: Move to upstream IOSF MBI API

There is a common for x86 IOSF MBI API. Move atomisp code to use it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: Remove dead code for MID (#3)
Andy Shevchenko [Fri, 1 Sep 2017 13:36:37 +0000 (09:36 -0400)]
media: staging: atomisp: Remove dead code for MID (#3)

intel_mid_msgbus_*_raw*() are not used anywhere.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: Remove dead code for MID (#2)
Andy Shevchenko [Fri, 1 Sep 2017 13:36:36 +0000 (09:36 -0400)]
media: staging: atomisp: Remove dead code for MID (#2)

intel_mid_soc_stepping() is not used anywhere.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: Don't override D3 delay settings here
Andy Shevchenko [Fri, 1 Sep 2017 13:36:35 +0000 (09:36 -0400)]
media: staging: atomisp: Don't override D3 delay settings here

The d3_delay parameter is set by arch/x86/pci/intel_mid_pci.c and
drivers/pci/quirks.c.

No need to override that settings in unrelated driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: Remove dead code for MID (#1)
Andy Shevchenko [Fri, 1 Sep 2017 13:36:34 +0000 (09:36 -0400)]
media: staging: atomisp: Remove dead code for MID (#1)

Remove dead code. If someone needs it the P-Unit semaphore is handled by
I2C DesignWare driver (drivers/i2c/busses/i2c-designware-baytrail.c).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: media: atomisp: Use tabs in Kconfig
Sakari Ailus [Thu, 31 Aug 2017 08:11:00 +0000 (04:11 -0400)]
media: staging: media: atomisp: Use tabs in Kconfig

Use tabs in Kconfig for indentation rather than spaces.

The patch has been created using the following command:

find drivers/staging/media/atomisp/ -name Kconfig| \
xargs perl -i -pe 's/ {8}/\t/g'

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: atomisp: fix small Kconfig issues
Hans Verkuil [Wed, 30 Aug 2017 08:39:00 +0000 (04:39 -0400)]
media: atomisp: fix small Kconfig issues

The help text should be indented by at least two spaces after the
'help' separator. This is both good practice and the media_build system
for building media drivers makes this assumption.

Fix this for the atomisp/i2c/Kconfig and fix the atomisp/pci/Kconfig
that didn't align the help separator with the preceding keywords.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: Staging: atomisp: constify driver_attribute
Arvind Yadav [Thu, 31 Aug 2017 07:48:37 +0000 (03:48 -0400)]
media: Staging: atomisp: constify driver_attribute

driver_attribute are not supposed to change at runtime.
Functions driver_create_file/driver_remove_file are working with
const driver_attribute. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: atomisp2: Remove null check before kfree
Himanshu Jha [Sat, 26 Aug 2017 20:51:49 +0000 (16:51 -0400)]
media: atomisp2: Remove null check before kfree

Kfree on NULL pointer is a no-op and therefore checking is redundant.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec.h: initialize *parent and *port in cec_phys_addr_validate
Hans Verkuil [Thu, 31 Aug 2017 08:12:53 +0000 (04:12 -0400)]
media: cec.h: initialize *parent and *port in cec_phys_addr_validate

Make sure these values are set to avoid 'uninitialized variable'
warnings. Hasn't happened yet, but better safe than sorry.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: fix media Kconfig help syntax issues
Hans Verkuil [Wed, 30 Aug 2017 08:47:21 +0000 (04:47 -0400)]
media: fix media Kconfig help syntax issues

The help text should be indented by at least two spaces after the
'help' separator. This is both good practice and the media_build system
for building media drivers makes this assumption.

I went through all Kconfigs under drivers/media and fixed any bad help
sections. This makes it conform to the common practice and should fix
problems with 'make menuconfig' when using media_build. This is due to
a "WARNING" message that media_build can insert in the Kconfig and that
assumes the help text is indented by at least two spaces. If not, then the
Kconfig becomes invalid and 'make menuconfig' fails.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Thomas Kaiser <linux-dvb@kaiser-linux.li>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cobalt: do not register subdev nodes
Hans Verkuil [Mon, 28 Aug 2017 08:45:58 +0000 (04:45 -0400)]
media: cobalt: do not register subdev nodes

In the distant past the adv7604 driver used private controls. In order
to access them the v4l-subdevX nodes were needed. Later the is_private
tag was removed in the adv7604 driver and the need for v4l-subdevX
device nodes disappeared.

Remove the creation of those device nodes from this driver.

Note: the cobalt card is only used inside Cisco and we never actually
used the v4l-subdevX nodes for anything. So this API change can be done
safely without breaking anything.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l-ioctl: Fix typo on v4l_print_frmsizeenum
Ricardo Ribalda [Fri, 8 Sep 2017 15:47:10 +0000 (11:47 -0400)]
media: v4l-ioctl: Fix typo on v4l_print_frmsizeenum

max_width and max_height are swap with step_width and step_height.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: davinci: do a couple of checkpatch cleanups
Markus Elfring [Thu, 7 Sep 2017 20:37:16 +0000 (16:37 -0400)]
media: davinci: do a couple of checkpatch cleanups

- Delete an error message for a failed memory allocation
  in init_vpbe_layer();

- Replace the specification of data structures by pointer dereferences
  as the parameter for the operator "sizeof" to make the corresponding
  size determination a bit safer according to the Linux coding style
  convention;

- media: DaVinci-VPBE-Display: Improve a size determination in two
  functions

- Adjust 12 checks for null pointers

Those issues were pointed by checkpatch.pl and Coccinelle.

[mchehab@s-opensource.com: fold three cleanup patches into one]
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agoMerge branch 'parisc-4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Sat, 23 Sep 2017 16:14:06 +0000 (06:14 -1000)]
Merge branch 'parisc-4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc fixes from Helge Deller:

 - Unbreak parisc bootloader by avoiding a gcc-7 optimization to convert
   multiple byte-accesses into one word-access.

 - Add missing HWPOISON page fault handler code. I completely missed
   that when I added HWPOISON support during this merge window and it
   only showed up now with the madvise07 LTP test case.

 - Fix backtrace unwinding to stop when stack start has been reached.

 - Issue warning if initrd has been loaded into memory regions with
   broken RAM modules.

 - Fix HPMC handler (parisc hardware fault handler) to comply with
   architecture specification.

 - Avoid compiler warnings about too large frame sizes.

 - Minor init-section fixes.

* 'parisc-4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: Unbreak bootloader due to gcc-7 optimizations
  parisc: Reintroduce option to gzip-compress the kernel
  parisc: Add HWPOISON page fault handler code
  parisc: Move init_per_cpu() into init section
  parisc: Check if initrd was loaded into broken RAM
  parisc: Add PDCE_CHECK instruction to HPMC handler
  parisc: Add wrapper for pdc_instr() firmware function
  parisc: Move start_parisc() into init section
  parisc: Stop unwinding at start of stack
  parisc: Fix too large frame size warnings

7 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Linus Torvalds [Sat, 23 Sep 2017 15:47:04 +0000 (05:47 -1000)]
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma

Pull rdma fixes from Doug Ledford:

 - Smattering of miscellanous fixes

 - A five patch series for i40iw that had a patch (5/5) that was larger
   than I would like, but I took it because it's needed for large scale
   users

 - An 8 patch series for bnxt_re that landed right as I was leaving on
   PTO and so had to wait until now...they are all appropriate fixes for
   -rc IMO

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (22 commits)
  bnxt_re: Don't issue cmd to delete GID for QP1 GID entry before the QP is destroyed
  bnxt_re: Fix memory leak in FRMR path
  bnxt_re: Remove RTNL lock dependency in bnxt_re_query_port
  bnxt_re: Fix race between the netdev register and unregister events
  bnxt_re: Free up devices in module_exit path
  bnxt_re: Fix compare and swap atomic operands
  bnxt_re: Stop issuing further cmds to FW once a cmd times out
  bnxt_re: Fix update of qplib_qp.mtu when modified
  i40iw: Add support for port reuse on active side connections
  i40iw: Add missing VLAN priority
  i40iw: Call i40iw_cm_disconn on modify QP to disconnect
  i40iw: Prevent multiple netdev event notifier registrations
  i40iw: Fail open if there are no available MSI-X vectors
  RDMA/vmw_pvrdma: Fix reporting correct opcodes for completion
  IB/bnxt_re: Fix frame stack compilation warning
  IB/mlx5: fix debugfs cleanup
  IB/ocrdma: fix incorrect fall-through on switch statement
  IB/ipoib: Suppress the retry related completion errors
  iw_cxgb4: remove the stid on listen create failure
  iw_cxgb4: drop listen destroy replies if no ep found
  ...

7 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Sat, 23 Sep 2017 15:41:27 +0000 (05:41 -1000)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

 1) Fix NAPI poll list corruption in enic driver, from Christian
    Lamparter.

 2) Fix route use after free, from Eric Dumazet.

 3) Fix regression in reuseaddr handling, from Josef Bacik.

 4) Assert the size of control messages in compat handling since we copy
    it in from userspace twice. From Meng Xu.

 5) SMC layer bug fixes (missing RCU locking, bad refcounting, etc.)
    from Ursula Braun.

 6) Fix races in AF_PACKET fanout handling, from Willem de Bruijn.

 7) Don't use ARRAY_SIZE on spinlock array which might have zero
    entries, from Geert Uytterhoeven.

 8) Fix miscomputation of checksum in ipv6 udp code, from Subash Abhinov
    Kasiviswanathan.

 9) Push the ipv6 header properly in ipv6 GRE tunnel driver, from Xin
    Long.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (75 commits)
  inet: fix improper empty comparison
  net: use inet6_rcv_saddr to compare sockets
  net: set tb->fast_sk_family
  net: orphan frags on stand-alone ptype in dev_queue_xmit_nit
  MAINTAINERS: update git tree locations for ieee802154 subsystem
  net: prevent dst uses after free
  net: phy: Fix truncation of large IRQ numbers in phy_attached_print()
  net/smc: no close wait in case of process shut down
  net/smc: introduce a delay
  net/smc: terminate link group if out-of-sync is received
  net/smc: longer delay for client link group removal
  net/smc: adapt send request completion notification
  net/smc: adjust net_device refcount
  net/smc: take RCU read lock for routing cache lookup
  net/smc: add receive timeout check
  net/smc: add missing dev_put
  net: stmmac: Cocci spatch "of_table"
  lan78xx: Use default values loaded from EEPROM/OTP after reset
  lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE
  lan78xx: Fix for eeprom read/write when device auto suspend
  ...

7 years agoMerge tag 'apparmor-pr-2017-09-22' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 23 Sep 2017 15:33:29 +0000 (05:33 -1000)]
Merge tag 'apparmor-pr-2017-09-22' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor

Pull apparmor updates from John Johansen:
 "This is the apparmor pull request, similar to SELinux and seccomp.

  It's the same series that I was sent to James' security tree + one
  regression fix that was found after the series was sent to James and
  would have been sent for v4.14-rc2.

  Features:
  - in preparation for secid mapping add support for absolute root view
    based labels
  - add base infastructure for socket mediation
  - add mount mediation
  - add signal mediation

  minor cleanups and changes:
  - be defensive, ensure unconfined profiles have dfas initialized
  - add more debug asserts to apparmorfs
  - enable policy unpacking to audit different reasons for failure
  - cleanup conditional check for label in label_print
  - Redundant condition: prev_ns. in [label.c:1498]

  Bug Fixes:
  - fix regression in apparmorfs DAC access permissions
  - fix build failure on sparc caused by undeclared signals
  - fix sparse report of incorrect type assignment when freeing label proxies
  - fix race condition in null profile creation
  - Fix an error code in aafs_create()
  - Fix logical error in verify_header()
  - Fix shadowed local variable in unpack_trans_table()"

* tag 'apparmor-pr-2017-09-22' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor:
  apparmor: fix apparmorfs DAC access permissions
  apparmor: fix build failure on sparc caused by undeclared signals
  apparmor: fix incorrect type assignment when freeing proxies
  apparmor: ensure unconfined profiles have dfas initialized
  apparmor: fix race condition in null profile creation
  apparmor: move new_null_profile to after profile lookup fns()
  apparmor: add base infastructure for socket mediation
  apparmor: add more debug asserts to apparmorfs
  apparmor: make policy_unpack able to audit different info messages
  apparmor: add support for absolute root view based labels
  apparmor: cleanup conditional check for label in label_print
  apparmor: add mount mediation
  apparmor: add the ability to mediate signals
  apparmor: Redundant condition: prev_ns. in [label.c:1498]
  apparmor: Fix an error code in aafs_create()
  apparmor: Fix logical error in verify_header()
  apparmor: Fix shadowed local variable in unpack_trans_table()

7 years agox86/asm: Fix inline asm call constraints for Clang
Josh Poimboeuf [Wed, 20 Sep 2017 21:24:33 +0000 (16:24 -0500)]
x86/asm: Fix inline asm call constraints for Clang

For inline asm statements which have a CALL instruction, we list the
stack pointer as a constraint to convince GCC to ensure the frame
pointer is set up first:

  static inline void foo()
  {
register void *__sp asm(_ASM_SP);
asm("call bar" : "+r" (__sp))
  }

Unfortunately, that pattern causes Clang to corrupt the stack pointer.

The fix is easy: convert the stack pointer register variable to a global
variable.

It should be noted that the end result is different based on the GCC
version.  With GCC 6.4, this patch has exactly the same result as
before:

defconfig defconfig-nofp distro distro-nofp
 before 9820389 9491555 8816046 8516940
 after 9820389 9491555 8816046 8516940

With GCC 7.2, however, GCC's behavior has changed.  It now changes its
behavior based on the conversion of the register variable to a global.
That somehow convinces it to *always* set up the frame pointer before
inserting *any* inline asm.  (Therefore, listing the variable as an
output constraint is a no-op and is no longer necessary.)  It's a bit
overkill, but the performance impact should be negligible.  And in fact,
there's a nice improvement with frame pointers disabled:

defconfig defconfig-nofp distro distro-nofp
 before 9796316 9468236 9076191 8790305
 after 9796957 9464267 9076381 8785949

So in summary, while listing the stack pointer as an output constraint
is no longer necessary for newer versions of GCC, it's still needed for
older versions.

Suggested-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reported-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/3db862e970c432ae823cf515c52b54fec8270e0e.1505942196.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
7 years agoobjtool: Handle another GCC stack pointer adjustment bug
Josh Poimboeuf [Wed, 20 Sep 2017 21:24:32 +0000 (16:24 -0500)]
objtool: Handle another GCC stack pointer adjustment bug

The kbuild bot reported the following warning with GCC 4.4 and a
randconfig:

  net/socket.o: warning: objtool: compat_sock_ioctl()+0x1083: stack state mismatch: cfa1=7+160 cfa2=-1+0

This is caused by another GCC non-optimization, where it backs up and
restores the stack pointer for no apparent reason:

    2f91:       48 89 e0                mov    %rsp,%rax
    2f94:       4c 89 e7                mov    %r12,%rdi
    2f97:       4c 89 f6                mov    %r14,%rsi
    2f9a:       ba 20 00 00 00          mov    $0x20,%edx
    2f9f:       48 89 c4                mov    %rax,%rsp

This issue would have been happily ignored before the following commit:

  dd88a0a0c861 ("objtool: Handle GCC stack pointer adjustment bug")

But now that objtool is paying attention to such stack pointer writes
to/from a register, it needs to understand them properly.  In this case
that means recognizing that the "mov %rsp, %rax" instruction is
potentially a backup of the stack pointer.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthias Kaehlcke <mka@chromium.org>
Cc: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: dd88a0a0c861 ("objtool: Handle GCC stack pointer adjustment bug")
Link: http://lkml.kernel.org/r/8c7aa8e9a36fbbb6655d9d8e7cea58958c912da8.1505942196.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
7 years agomedia: Hexium Orion: Adjust one function call together with a variable assignment
Markus Elfring [Sun, 3 Sep 2017 18:12:36 +0000 (14:12 -0400)]
media: Hexium Orion: Adjust one function call together with a variable assignment

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: meye: Adjust two function calls together with a variable assignment
Markus Elfring [Sun, 3 Sep 2017 13:41:53 +0000 (09:41 -0400)]
media: meye: Adjust two function calls together with a variable assignment

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cx23885: make const array buf static, reduces object code size
Colin Ian King [Thu, 7 Sep 2017 09:50:23 +0000 (05:50 -0400)]
media: cx23885: make const array buf static, reduces object code size

Don't populate the array buf on the stack, instead make it static.
Makes the object code smaller by over 240 bytes:

Before:
   text    data     bss     dec     hex filename
  21689   22992     416   45097    b029 cx23885-cards.o

After:
   text    data     bss     dec     hex filename
  21348   23088     416   44852    af34 cx23885-cards.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ov9640: make const arrays res_x/y static const, reduces object code size
Colin Ian King [Wed, 6 Sep 2017 13:30:16 +0000 (09:30 -0400)]
media: ov9640: make const arrays res_x/y static const, reduces object code size

Don't populate the arrays res_x and resy_y on the stack, instead make them
static const.  Makes the object code smaller by over 160 bytes:

Before:
   text    data     bss     dec     hex filename
  10509    2800      64   13373    343d ov9640.o

After:
   text    data     bss     dec     hex filename
  10184    2960      64   13208    3398 ov9640.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cobalt: remove redundant zero check on retval
Colin Ian King [Tue, 5 Sep 2017 15:19:44 +0000 (11:19 -0400)]
media: cobalt: remove redundant zero check on retval

The error handling paths all end up with retval being non-zero,
so the check for retval being zero is always false and hence
is redundant. Remove it.

Detected by CoverityScan CID#1309479 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cx25840: make array stds static const, reduces object code size
Colin Ian King [Tue, 5 Sep 2017 11:03:32 +0000 (07:03 -0400)]
media: cx25840: make array stds static const, reduces object code size

Don't populate the array syds on the stack, instead make it static const.
Makes the object code smaller by over 280 bytes:

Before:
   text    data     bss     dec     hex filename
  81451   12784     704   94939   172db cx25840-core.o

   text    data     bss     dec     hex filename
  81070   12880     704   94654   171be cx25840-core.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: lgdt3306a: Use ARRAY_SIZE macro
Thomas Meyer [Sun, 3 Sep 2017 12:19:31 +0000 (08:19 -0400)]
media: lgdt3306a: Use ARRAY_SIZE macro

Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>