1
0
Fork 0
Commit Graph

287 Commits (a7ddcea58ae22d85d94eabfdd3de75c3742e376b)

Author SHA1 Message Date
Harsha Sharma a050fe5ceb staging: vc04_services: Remove typedef struct
Remove typedef from struct as linux-kernel coding style tends to
avoid using typedefs

Done using following coccinelle semantic patch

@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t" or T[-2:] == "_T":
        coccinelle.T2 = T[:-2];
else:
        coccinelle.T2 = T;

print T, coccinelle.T2

@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

@r3@
type r1.T;
identifier c1.T2;
@@
-T
+struct T2

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-22 10:53:45 +02:00
Stefan Wahren 974d4d03fc staging: vchiq_2835_arm: Fix NULL ptr dereference in free_pagelist
This fixes a NULL pointer dereference on RPi 2 with multi_v7_defconfig.
The function page_address() could return NULL with enabled CONFIG_HIGHMEM.
So fix this by using kmap() instead.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: 71bad7f086 ("staging: add bcm2708 vchiq driver")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18 12:25:31 +02:00
Meghana Madhyastha 94b093fcba Staging: vc04_services: bcm2835-camera: Fix spelling mistake
Fixes a spelling mistake in the comments.
Problem found using checkpatch.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17 16:35:26 +02:00
Bhumika Goyal b9920ca3b5 staging: bcm2835-camera: make video_device const
Make this const as it is only used in a copy operation.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28 10:40:39 +02:00
Julia Lawall f66af90acf staging: bcm2835-camera: constify vb2_ops structures
These vb2_ops structures are only stored in the ops field of a
vb2_queue structure, which is declared as const.  Thus the vb2_ops
structures themselves can be const.

Done with the help of Coccinelle.

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct vb2_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-18 15:57:16 -07:00
Bhumika Goyal 044cb69a92 staging: bcm2835-audio: make snd_pcm_hardware const
Make these const as they are only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-18 15:57:16 -07:00
Gustavo A. R. Silva a4400dfdbd staging: bcm2835-audio: constify snd_pcm_ops structures
Check for snd_pcm_ops structures that are only stored in the ops field of
a snd_soc_platform_driver structure or passed as the third argument to
snd_pcm_set_ops. The corresponding field or parameter is declared const,
so snd_pcm_ops structures that have this property can be declared as
const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_pcm_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_platform_driver e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i;
expression e1, e2; position p;
@@
snd_pcm_set_ops(e1, e2, &i@p)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_pcm_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct snd_pcm_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-30 08:28:21 -07:00
Greg Kroah-Hartman a29e249072 Merge 4.13-rc2 into staging-next
This resolves a merge issue and gets the vmbox drm driver into this
branch to be able to start taking fixes for it...

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-23 19:53:30 -07:00
Andrey Severin b691bbe2d2 Staging:vc04_services:vchiq_util.c: kzalloc call changed to kcalloc
kzalloc call was changed to kcalloc by checkpatch.pl recommendation

Signed-off-by: Andrey Severin <lkd1024@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-18 08:57:59 +02:00
Dan Carpenter 397fcd12e4 staging: vchiq_arm: fix error codes in probe
If vchiq_debugfs_init() fails, then we accidentally return a valid
pointer casted to int on error.  This code is simpler if we get rid of
the "ptr_err" variable and just use "err" throughout.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16 09:13:53 +02:00
Linus Torvalds 920f2ecdf6 sound updates for 4.13-rc1
This development cycle resulted in a fair amount of changes in both
 core and driver sides.  The most significant change in ALSA core is
 about PCM.  Also the support of of-graph card and the new DAPM widget
 for DSP are noteworthy changes in ASoC core.  And there're lots of
 small changes splat over the tree, as you can see in diffstat.
 
 Below are a few highlights:
 
 ALSA core:
 - Removal of set_fs() hackery from PCM core stuff, and the code
   reorganization / optimization thereafter
 - Improved support of PCM ack ops, and a new ABI for improved
   control/status mmap handling
 - Lots of constifications in various codes
 
 ASoC core:
 - The support of of-graph card, which may work as a better generic
   device for a replacement of simple-card
 - New widget types intended mainly for use with DSPs
 
 ASoC drivers:
 - New drivers for Allwinner V3s SoCs
 - Ensonic ES8316 codec support
 - More Intel SKL and KBL works
 - More device support for Intel SST Atom (mostly for cheap tablets and
   2-in-1 devices)
 - Support for Rockchip PDM controllers
 - Support for STM32 I2S and S/PDIF controllers
 - Support for ZTE AUD96P22 codecs
 
 HD-audio:
 - Support of new Realtek codecs (ALC215/ALC285/ALC289), more quirks
   for HP and Dell machines
 - A few more fixes for i915 component binding
 
 Note that of-graph change may bring the conflicts with a later pull
 request of devicetree, as currently found in linux-next.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEECxfAB4MH3rD5mfB6bDGAVD0pKaQFAllbtmMOHHRpd2FpQHN1
 c2UuZGUACgkQbDGAVD0pKaTMkhAAnqvRvh9nYBI1E2VGtJON/AFcsF4s6xdJd0ow
 Bn5Kq/07rGWxAi8Cy69LM930eQrZl+xR69I7LMkC54BxVNhvhXNef7E5GXPbRi+3
 l6dkBmkqvwmmHP5iiOxKtYSAnUfJitu1rmtAOVAjRh8rsWNeLuI8N8V/uilQBioi
 lRywdBjdylub00H1DL8cmZHbrBb4pYrL/LepTswZL3I/UZ225fMiIGFd8tXpQPwZ
 IKRZiuzrc3SykxSsL/aNeyxP+2qTYRtPfl/FGenKBBO2PJmGAb00yAdtQJRcD2eX
 Xf1alfvpNgpy/U6+C7dJgNWQvvr+lPCaFXuMukIDno/zg/xD1V1Ev/fnbVEINLve
 xMOnuJSGGaY6fu6eZ4Cck0VfZIj7UVA9x8zvBOKntIhq/VLfE7DDu3p9tiAZAVfH
 nMOLAhy+0kFyHSrv6zVWQj+cmjPwLvaW7fNWVljL5/MWuF5GJi05DUOfV/vk8BaO
 EnyVqe2ynzNLTsFpLHHy6XKgKtSTkPygxYSNuI7kSYAxD5qE6hXXKXTAqJ3LjDkO
 tGiFmxp/vHrlNvcyRjXc30th/9PPj/mRBcJ2KyjXPa63L5ZW86PiyIHKxJA4yogv
 y4z2ZlhIz90cZvpigFHtFqq1puVlDtKDbAaJ6AKrP8HEHUlMiPNApsSjWWBUcfzV
 DXzrlg0=
 =PUEh
 -----END PGP SIGNATURE-----

Merge tag 'sound-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "This development cycle resulted in a fair amount of changes in both
  core and driver sides. The most significant change in ALSA core is
  about PCM. Also the support of of-graph card and the new DAPM widget
  for DSP are noteworthy changes in ASoC core. And there're lots of
  small changes splat over the tree, as you can see in diffstat.

  Below are a few highlights:

  ALSA core:
   - Removal of set_fs() hackery from PCM core stuff, and the code
     reorganization / optimization thereafter
   - Improved support of PCM ack ops, and a new ABI for improved
     control/status mmap handling
   - Lots of constifications in various codes

  ASoC core:
   - The support of of-graph card, which may work as a better generic
     device for a replacement of simple-card
   - New widget types intended mainly for use with DSPs

  ASoC drivers:
   - New drivers for Allwinner V3s SoCs
   - Ensonic ES8316 codec support
   - More Intel SKL and KBL works
   - More device support for Intel SST Atom (mostly for cheap tablets
     and 2-in-1 devices)
   - Support for Rockchip PDM controllers
   - Support for STM32 I2S and S/PDIF controllers
   - Support for ZTE AUD96P22 codecs

  HD-audio:
   - Support of new Realtek codecs (ALC215/ALC285/ALC289), more quirks
     for HP and Dell machines
   - A few more fixes for i915 component binding"

* tag 'sound-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (418 commits)
  ALSA: hda - Fix unbalance of i915 module refcount
  ASoC: Intel: Skylake: Remove driver debugfs exit
  ASoC: Intel: Skylake: explicitly add the headers sst-dsp.h
  ALSA: hda/realtek - Remove GPIO_MASK
  ALSA: hda/realtek - Fix typo of pincfg for Dell quirk
  ALSA: pcm: add a documentation for tracepoints
  ALSA: atmel: ac97c: fix error return code in atmel_ac97c_probe()
  ALSA: x86: fix error return code in hdmi_lpe_audio_probe()
  ASoC: Intel: Skylake: Add support to read firmware registers
  ASoC: Intel: Skylake: Add sram address to sst_addr structure
  ASoC: Intel: Skylake: Debugfs facility to dump module config
  ASoC: Intel: Skylake: Add debugfs support
  ASoC: fix semicolon.cocci warnings
  ASoC: rt5645: Add quirk override by module option
  ASoC: rsnd: make arrays path and cmd_case static const
  ASoC: audio-graph-card: add widgets and routing for external amplifier support
  ASoC: audio-graph-card: update bindings for amplifier support
  ASoC: rt5665: calibration should be done before jack detection
  ASoC: rsnd: constify dev_pm_ops structures.
  ASoC: nau8825: change crosstalk-bypass property to bool type
  ...
2017-07-06 10:56:51 -07:00
Takashi Iwai 4c7aba46c9 Merge branch 'for-linus' into for-next
For applying more ALSA timer cleanups.
2017-06-07 10:25:30 +02:00
Stefan Wahren 57d14635f9 staging: vchiq_core: Replace remaining BUG_ON with WARN_ON
This replaces all remaining BUG_ON with WARN_ON. So in case of
a VCHIQ bug the system is still usable.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren d1eab9dec6 staging: vchiq_core: Bail out in case of invalid tx_pos
Properly handle the error case in case of an invalid tx_pos.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren 6f2370d260 staging: vchiq_core: Don't BUG if process is unexpected
Bail out properly if the process index doesn't match the remote insert.
We also drop the BUG in case the process index is at local insert,
so we can trigger the WARN_ON again some steps later.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren 5d1a94bb28 staging: vchiq_core: Bail out if ref_count is unexpected
If the ref counter of service has an unexpected value then we better
bail out.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren 6b8db0bce3 staging: vchiq_core: Bail out if service is NULL
In the unlikely case that service is NULL we should bail out instead
of calling BUG_ON(). The other BUG_ON calls will be fixed in separate
patches.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren 00b9d0f560 staging: vchiq_core: Don't BUG if sending RESUME fails
VCHIQ suspend and resume isn't implemented, but even it was
there is no need to call BUG().

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren 359afaccd9 staging: vchiq_core: Bailout if VCHIQ state is already initialized
In case VCHIQ state is already initialized we need to bailout
in order to aovid a memory leak.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:12 +02:00
Stefan Wahren 7c35c6af0c staging: vchiq_core: Simplify VCHIQ init
Since the ARM side of VCHIQ support only 1 state, we could simplify
the init code. This makes it possible to avoid BUG_ON and a theoretical
overflow of id.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:30 +02:00
Stefan Wahren 244156ca90 staging: vchiq_2835_arm: Use PAGE_MASK macro
Use the PAGE_MASK instead of open code it.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:30 +02:00
Stefan Wahren 025f69ade9 staging: vchiq_2835_arm: Handle vmalloc_to_page error case
In case vmalloc_to_page returns NULL create_pagelist must abort
imediatly.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:30 +02:00
Stefan Wahren 804980adb9 staging: vchiq_2835_arm: Fix function name cleaup_pagelistinfo
Assuming the intension of the function is to clean up, so fix the function
name accordingly.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Stefan Wahren b322396ce8 staging: vchiq_arm: Avoid multiline dereference
Reduce the indentation within vchiq_dump_service_use_state in order
to avoid a multiline derefernce.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Stefan Wahren 42a6bd8f77 staging: vchiq_arm: Fix variable names in comment
This comment was apparently forgotten in the correction of CamelCase.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Stefan Wahren 76262b2951 staging: vchiq_2835_arm: Remove unnecessary assignment to slot_mem_size
The variable slot_mem_size is assigned a value which is never used.
This issue has been found by CppCheck.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Stefan Wahren 158ef80a87 staging: vchiq_2835_arm: Reduce scope of i in free_pagelist
We can reduce the scope of the counting variable i. This has
been found by CppCheck.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Stefan Wahren d3de2bb882 staging: vchiq_core: Use return value of mutex_lock_killable directly
Instead of saving the return value of mutex_lock_killable in a
local variable we could use the value directly.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Takashi Iwai 9ce7b9cf64 staging: bcm2835-audio: Deliver indirect-PCM transfer error
Now that the indirect-PCM transfer helper gives back an error, we
should return the error from ack callbacks.

Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-25 23:34:47 +02:00
Phil Elwell ff92b9e3c9 staging: vc04_services: Fix bulk cache maintenance
vchiq_arm supports transfers less than one page and at arbitrary
alignment, using the dma-mapping API to perform its cache maintenance
(even though the VPU drives the DMA hardware). Read (DMA_FROM_DEVICE)
operations use cache invalidation for speed, falling back to
clean+invalidate on partial cache lines, with writes (DMA_TO_DEVICE)
using flushes.

If a read transfer has ends which aren't page-aligned, performing cache
maintenance as if they were whole pages can lead to memory corruption
since the partial cache lines at the ends (and any cache lines before or
after the transfer area) will be invalidated. This bug was masked until
the disabling of the cache flush in flush_dcache_page().

Honouring the requested transfer start- and end-points prevents the
corruption.

Fixes: cf9caf1929 ("staging: vc04_services: Replace dmac_map_area with dmac_map_sg")
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Cc: stable <stable@vger.kernel.org> # 4.10
Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15 11:48:44 +02:00
Kevin Wern baa7a586b5 staging: media/platform/bcm2835: remove gstreamer workaround
Gstreamer's v4l2src reacted poorly to certain outputs from the bcm2835
video driver's ioctl ops function vidioc_enum_framesizes, so a
workaround was created that could be activated by user input. This
workaround would replace the driver's ioctl ops struct with another,
similar struct--only with no function pointed to by
vidioc_enum_framesizes. With no response, gstreamer would attempt to
continue with some default settings that happened to work better.

However, this bug has been fixed in gstreamer since 2014, so we
shouldn't include this workaround in the stable version of the driver.

Signed-off-by: Kevin Wern <kevin.m.wern@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:54:24 +02:00
Haim Daniel 361b3f54ba staging: vc04_services: add parenthesis to macros
vchi_cfg.h: fix checkpatch ERROR: Macros with complex values should be enclosed in parenthesis

Signed-off-by: Haim Daniel <haimdaniel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 17:05:59 +02:00
Aishwarya Pant 951142c293 staging: bcm2835-audio: remove unnecessary log messages
Remove unnecessary log messages in the driver which are just tracking
function entry and exits.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 16:58:42 +02:00
Colin Ian King 34bc8f9392 staging: bcm2835-camera: fix spelling mistake: "elementry" -> "elementary"
trivial fix to spelling mistake in various comments and pr_debug messages

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 16:58:18 +02:00
Greg Kroah-Hartman 1c816bad41 Merge 4.11-rc4 into staging-next
We need the IIO fixes in here as well to handle merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-27 09:11:25 +02:00
Stefan Wahren 2ea91ce574 staging: vchiq_arm: Fix MODULE_LICENSE
Regarding to the header the driver is licensed under BSD and GPL.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21 08:52:33 +01:00
Michael Zoran 325b5b6c96 staging: bcm2835-audio: Add support for simultanous HDMI and Headphone audio
The firmware for the Raspberry PI already supports simultanous output
of audio through both the HDMI and the Headphone jack.  The current
implementation of ALSA doesn't expose this well to user mode since
the firmware audio is represented as a single card.

A newer approach is taken here and a virtual card is created for each
output(HDMI, Headphones, and Traditional ALSA).  The firmware has
the concept of channels or streams for which the number to use is
passed in the device tree. These streams are allocated to each of the
virtual cards.

As a side effect of this change, since each output is represented
independenly it's now very easy to use PulseAudio to control the
priorities of the outputs.

Testing:

Audacity and VLC were both loaded at the same time.  Each application
was assigned to a different card. With this change I was able to play
different music files at the same time through the HDMI and Headphones
jacks and control the audio independently.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21 08:38:33 +01:00
Dave Stevenson f7d51372d7 bcm2835-v4l2: Fix buffer overflow problem
https://github.com/raspberrypi/linux/issues/1447
port_parameter_get() failed to account for the header
(u32 id and u32 size) in the size before memcpying
the response into the response buffer, so overrunning
the provided buffer by 8 bytes.

Account for those bytes, and also a belt-and-braces
check to ensure we never copy more than *value_size
bytes into value.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Tested-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21 08:38:33 +01:00
Arnd Bergmann ce95e3a9c5 staging: vc04_services: make BCM_VIDEOCORE tristate
Adding the 'bool' symbol brought back a randconfig build bug that
I had fixed before:

drivers/staging/built-in.o: In function `vchiq_probe':
(.text+0x1da30): undefined reference to `rpi_firmware_get'
drivers/staging/built-in.o: In function `vchiq_platform_init':
(.text+0x27494): undefined reference to `rpi_firmware_property'

The problem is that when RASPBERRYPI_FIRMWARE is a loadable module,
but BCM2835_VCHIQ can again be built-in. Making BCM_VIDEOCORE
itself tristate will make Kconfig honor the dependency correctly.

Fixes: 6bbfe4a761 ("staging: vc04_services: Create new BCM_VIDEOCORE setting for VideoCore services.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21 08:36:35 +01:00
Colin Ian King 35060a228e staging: vc04_services: fix NULL pointer dereference on pointer 'service'
Currently, if pservice is null then service is set to NULL and immediately
afterwards service is dereferenced causing a null pointer dereference. Fix
this by bailing out early of the function with a null return.

Detected by CoverityScan, CID#1419681 ("Explicit null dereferenced")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21 08:36:14 +01:00
Gargi Sharma 702d8d0f0e staging: vc04_services: Replace typedef with struct
Using typedef for a structure type and upper case struct names is not
suggested in Linux kernel coding style guidelines. Hence, occurences
of typedefs have been removed and struct names converted to lowercase
in the file. Grep was also used to ensure that all occurence of the
typedefs have been removed. The module compiles without any warnings
or errors.

Script 1:
@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_T":
  coccinelle.T2 = T[:-2].lower();
  print T
else:
  coccinelle.T2=T.lower();

@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

@r3@
type r1.T;
identifier c1.T2;
@@
- T
+ struct T2

Script 2:
@@
typedef VCHIQ_ELEMENT_T;
@@

(
- VCHIQ_ELEMENT_T
+ struct vchiq_element
)

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16 11:33:04 +09:00
Gargi Sharma 363c6fefa6 staging: vc04_services: Remove type and function prototype
The function prototype is for a function that is not even in
the kernel, and hence has been removed.
The type VCHIQ_SHARED_MEM_INFO_T is not used anywhere in the
kernel as well.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16 11:33:04 +09:00
Jean-Baptiste Abbadie fb03333f51 staging: vc04_services: Remove unused functions
These four functions are not used and report errors with sparse.

Signed-off-by: Jean-Baptiste Abbadie <jb@abbadie.fr>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16 11:33:04 +09:00
Aishwarya Pant 0adbfd4694 staging: bcm2835-audio: fix memory leak in bcm2835_audio_open_connection()
In bcm2835_audio_open_connection(), if VCHI connection fails or
initialisation of VCHI audio instance fails vchi_instance needs to be
deallocated otherwise it will cause a memory leak.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14 07:57:53 +08:00
Aishwarya Pant e3173e5783 staging: bcm2835-audio: deallocate work when queue_work(...) fails
This patch de-allocates work when queue_work(..) fails in the
bcm2835-audio work functions

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14 07:57:53 +08:00
Aishwarya Pant 8f1fff07b0 staging: bcm2835-audio: use conditional only for error case
* Refactor conditional to check if memory allocation has failed and
immediately return (-ENOMEM); if block for success case is removed.

* Return the error value -EBUSY when queue_work() fails.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14 07:57:53 +08:00
Aishwarya Pant 5e00b25853 staging: bcm2835-audio: propagate PTR_ERR value instead of -EPERM
It is better to propagate PTR_ERR value instead of a hardcoded value
(-EPERM here)

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14 07:57:53 +08:00
Aishwarya Pant d676e37fb6 staging: bcm2835-audio: replace null with error pointer value
This patch replaces NULL values returned by vc_vchi_audio_init(...) with
error pointer values:
	- Return ERR_PTR(-EINVAL) when too many instances of audio
	  service are initialised
	- Return ERR_PTR(-ENOMEM) when kzalloc fails
	- RETURN ERR_PTR(-EPERM) when vchi connections fail to open

Similarly, a NULL check where vc_vchi_audio_init(...) is called is
replaced by IS_ERR(..)

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14 07:57:53 +08:00
Aishwarya Pant fc8612b1cb staging: bcm2835-audio: Replace kmalloc with kzalloc
Replace kmalloc and memset with kzalloc.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14 07:57:53 +08:00
Derek Robson d0dee553a3 Staging: bcm2835: Fixed style of block comments
Fixed style of block comments across whole driver
Found using checkpatch

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 15:16:55 +01:00
Aishwarya Pant 2ba835dd3e staging: bcm2835-camera: remove anonymous field declarations
Anonymous field declarations are error prone. This patch replaces
anonymous declarations with explicit field declarations for typedef
SERVICE_CREATION_T in vchiq_mmal_init(..)

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 15:16:51 +01:00
Aishwarya Pant 7ebe438c64 staging: bcm2835-audio: remove anonymous field declarations
Anonymous field declarations are error prone. This patch replaces
anonymous declarations with explicit field declarations for typedef
SERVICE_CREATION_T in vc_vchi_audio_init(..)

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 15:16:51 +01:00
Michael Zoran 82c41a994c staging: vchi: Remove ARM64 from TODO list
ARM64 for core vchiq which is the core of vc04_services should
now be work complete.  The driver compiles without any errors
or warnings, and works just as well as 32 bit mode.  The
necessary compatibility wrappers for the 32 bit ioctls have been
written and merged.

Since no more ARM64 specific changes should be needed, perhaps
it's best to remove it from the TODO list.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:13:33 +01:00
Aishwarya Pant b8f9326762 staging: bcm2835-camera: use kernel preferred style for handling errors
This patch replaces NULL error values with error pointer values.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:13:07 +01:00
Aishwarya Pant 6aec8c56bc staging: bcm2835-camera: replace kmalloc with kzalloc
This patch replaces kmalloc and memset with kzalloc

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:13:07 +01:00
Aishwarya Pant a1d76d7a3c staging: bcm2835-camera: add check to avoid null pointer dereference
This patch adds checks after memory allocation to avoid possible null
pointer dereferences.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:13:07 +01:00
Michael Zoran fcd1f55359 staging: bcm2835-camera: remove depends on ARM
Since all the arm64 specific issues have been fixed now
and the camera is working fine with a arm64 kernel, the
depends on ARM can be removed from Kconfig.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:10 +01:00
Michael Zoran 2367eb3fbe staging: bcm2835-camera: Fix bogus compiler warnings regarding constants
In debug logging code, the compiler is warning about imposible
situations and size of constants not matching the format specifier.

This change fixes all three instances of this.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:10 +01:00
Michael Zoran 85b1ac7359 staging: bcm2835-camera: Fix buffer overflow calculation on query of camera properties
The code that queries properties on the camera has a check
for buffer overruns if the firmware sends too much data.  This
check is incorrect, and during testing I was seeing stack corruption.

I believe this error can actually happen in normal use, just for
some reason it doesn't appear on 32 bit as often.  So perhaps
it's best for the check to be fixed.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:10 +01:00
Michael Zoran 74369b5f22 staging: bcm2835-camera: Convert spinlock to mutex in handle mapping code
The handle mapping code that converts context pointers to handles uses
a spinlock.  Since the btree implementation can sleep while allocating
memory, turning on several kernel debugging options will result in
errors in the log.

Since this code path is never called in atomic context, perhaps it's
better to just use a mutex.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:10 +01:00
Michael Zoran 68aeab5106 staging: bcm2835-camera: Convert struct mmal_buffer_header info fields to u32
The struct mmal_buffer_header has multiple fields used for informational
and debugging purposes.  These are safe to convert to u32.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:10 +01:00
Michael Zoran 3fd4674fc4 staging: bcm2835-camera: Convert struct mmal_port info fields to u32
The struct mmal_port has a few informational fields. Convert these to
u32.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:09 +01:00
Michael Zoran 7beb354f85 staging: bcm2835-camera: Convert client_context field to a 32 bit handle
The client_context field is passed around which is really just a pointer
to a msg_context.  A lookup table mechanism for msg_context was added
previously, so convert this field to a handle as well.

The firmware never interperates the client_context, just passed it back.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:09 +01:00
Michael Zoran c45fe9c657 staging: bcm2835-camera: Convert delayed_buffer to u32
A delayed buffer field is passed between the firmware and the
kernel.  This field is never used either so it's safe to
change it to a u32.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:09 +01:00
Michael Zoran 4fe0809309 staging: bcm2835-camera: Convert client_component field to u32
In the messages passed back and forth between the camera and
the firmware, a client_component field is passed.

This is a pointer to a structure that represents part of the
camera. Luckly, it's only used for debug logging, so simply
convert it to a u32.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:09 +01:00
Michael Zoran ad428fc0af staging: bcm2835-camera: Create struct mmal_es_format_local to mirror struct mmal_es_format
The struct struct mmal_es_format is passed between the firmware which has
pointers.  A local version of mmal_es_format is also used.

Luckly, the two versions are always memberwise copied from each other
so simply have different structures for the local and msg versions.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10 10:12:09 +01:00
Narcisa Ana Maria Vasile 001943e8ea staging: vc04_services: Refactor conditionals
Refactor conditionals to reduce one level of indentation and improve
code readability.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 19:27:28 +01:00
Narcisa Ana Maria Vasile 418314821b staging: vc04_services: Remove error message on kmalloc() failure
Remove 'Out of memory' message because kmalloc already prints a message
in case of error.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 19:27:28 +01:00
Gargi Sharma d493859392 staging: vc04_services: Use ARRAY_SIZE macro
Use ARRAY_SIZE to calculate the size of an array.
The semantic patch used can be found here:
https://github.com/coccinelle/coccinellery/blob/master/arraysize/array.cocci

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 19:07:57 +01:00
Stefan Wahren 8d2aa8bff9 staging: vchiq_utils: Don't include headers twice
There is no need to include types.h and vmalloc.h twice.

This issue has been found by make includecheck.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 19:06:36 +01:00
simran singhal 6c849caf81 staging: vc04_services: Clean up tests if NULL returned on failure
Some functions like kmalloc/kzalloc return NULL on failure.
When NULL represents failure, !x is commonly used.

This was done using Coccinelle:
@@
expression *e;
identifier l1;
@@

e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(...);
...
- e == NULL
+ !e

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 19:06:36 +01:00
Sreya Mittal ba100438e4 staging: vc04_services: bcm2835-audio: Align with parenthesis
Fix the checkpatch issue:
Alignment should match open parenthesis

Signed-off-by: Sreya Mittal <sreyamittal5@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 14:35:51 +01:00
Michael Zoran 12ab165971 staging: vchiq_arm: Disable ability to dump memory by default
vc04_services has an ioctl interface to dump arbitrary memory
to a custom debug log.  This is typically only needed by
diagnostic tools, and can potentially be a security issue
if the devtmpfs node doesn't have adequate permissions set.

Since the ability to dump memory still has debugging value,
create a new build configuration and disable the feature
by default.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 13:39:05 +01:00
Michael Zoran 5569a12609 staging: vchiq_arm: Add compatibility wrappers for ioctls
This patch adds compatibility wrappers for the ioctls
exposed by vchiq/vc04_services.  The compat ioctls are
completely implemented on top of the native ioctls.  No
existing lines are modified.

While the ideal approach would be to cleanup the existing
code, this path is simplier and easier to review. While
it does have a small runtime performance penality vs
seperating the existing code into wrapper+worker functions,
the penality is small since only the metadata is copied
back onto the 32 bit user mode stack.

The on top of approach is the approach used by several
existing performance critical subsystems of Linux such
as the DRM 3D graphics subsystem.

Testing:

1. A 32 bit chroot was created on a RPI 3 and vchiq_test
was built for armhf.  The usual tests were run such as
vchiq_test -f 10 and vchiq_test -p.

2. This patch was copied onto the shipping version of
the Linux kernel used for the RPI and that kernel was
built for arm64. That kernel was used to boot Raspbian.
Many of the builtin features are now functional such
as the "hello_pi" examples, and minecraft_pi.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 13:39:05 +01:00
Michael Zoran 4e6bafdfb9 staging: bcm2835_camera: Use a mapping table for context field of mmal_msg_header
The camera driver passes messages back and forth between the firmware with
requests and replies.  One of the fields of the message header called
context is a pointer so the size changes between 32 bit and 64 bit.

The context field is used to pair reply messages from the firmware with
request messages from the kernel.  The simple solution would be
to use the padding field for the upper 32 bits of pointers, but this
would rely on the firmware always copying the pad field.

So instead handles are generated that are 32 bit numbers and a mapping
stored in a btree as implemented by the btree library in the kernel lib
directory.  The mapping pairs the handle with the pointer to the actual
data. The btree library was chosen since it's very easy to use and
red black trees would be overkill.

The camera driver also now forces in the btree library if the camera is
included in the build.  The btree library is a hidden configuration
option.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 13:39:05 +01:00
Michael Zoran 81b2cbdbf3 staging: bcm2835_camera: Convert control_service field of mmal_msg_header to u32
The camera driver passes messages back and forth between the firmware with
requests and replies.  One of the fields of the message header called
control_service is a pointer so the size changes between 32 bit and 64 bit.

Luckly, the field is not interperated by the driver, so it can be changed
to a u32 which has a fixed size.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 13:39:05 +01:00
Michael Zoran 7e8dbea410 staging: bcm2835-camera: Remove explicit cache flush operations
The camera code has an explicit cache flush operation
which is not portable.  Now that vc04_services is using portable
DMA APIs that already do the cache flushing, explicit flushes
should no longer be needed.

The one call to __cpuc_flush_dcache_area has been removed.

Testing:
	The offical V2 camera for the RPI was tested on a RPI 3
	running in 32 bit mode(armhf).  The cheese application
	and ffmpeg was used to view and stream video from the
	camera.  Nothing new seems to be broken without the
	cache flushing.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-08 13:37:44 +01:00
Derek Robson e13b567d52 Staging: media: platform: bcm2835 - style fix
Changed permissions to octal style
Found using checkpatch

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-07 20:11:41 +01:00
Aishwarya Pant d01e631855 staging: bcm2835-audio: remove unused semaphores
This patch removes unused semaphores alsa_stream->buffers_update_sem
and alsa_stream->control_sem from struct bcm2835_alsa_stream

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-07 20:11:39 +01:00
Narcisa Ana Maria Vasile 85fa002f2e staging: bcm2835-camera: Replace ternary operator with min_t macro
Use macro min_t to get the minimum of two values for readability.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-07 20:11:38 +01:00
Arnd Bergmann b3bd0f2849 staging/vc04_services: add CONFIG_OF dependency
After several hours of debugging this obviously bogus but elaborate
gcc-7.0.1 warning,

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c: In function 'vchiq_complete_bulk':
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:603:4: error: argument 2 null where non-null expected [-Werror=nonnull]
    memcpy((char *)page_address(pages[0]) +
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     pagelist->offset,
     ~~~~~~~~~~~~~~~~~
     fragments,
     ~~~~~~~~~~
     head_bytes);
     ~~~~~~~~~~~
In file included from include/linux/string.h:18:0,
                 from include/linux/bitmap.h:8,
                 from include/linux/cpumask.h:11,
                 from include/linux/interrupt.h:9,
                 from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:37:
arch/arm/include/asm/string.h:16:15: note: in a call to function 'memcpy' declared here
 extern void * memcpy(void *, const void *, __kernel_size_t) __nocapture(2);
               ^~~~~~

I have concluded that gcc was technically right in the first place:

vchiq_complete_bulk is an externally visible function that calls
free_pagelist(), which in turn derives a pointer from the global
g_fragments_base variable.

g_fragments_base is initialized in vchiq_platform_init(), but
we only get there if of_property_read_u32() successfully reads the
cache line size. When CONFIG_OF is disabled, this always fails, and
g_fragments_base is guaranteed to be NULL when vchiq_complete_bulk()
gets called.

This adds a CONFIG_OF Kconfig dependency, which is also technically correct
but nonobvious, and thus seems like a good fit for the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:38:49 +01:00
Aishwarya Pant 25280d9774 staging: bcm2835-audio: use min_t() macro instead of min()
use min_t() macro in place of min() to replace the two typecasts of min.
Change suggested by checkpatch script.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:32 +01:00
Aishwarya Pant c828033722 staging: bcm2835-audio: match alignment with open parenthesis
Fix the following checkpatch warning issued on bcm2835-vchiq.c:
CHECK: Alignment should match open parenthesis

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:32 +01:00
Aishwarya Pant 30b3adf06d staging: bcm2835-audio: fix typo in word
fix typo in word receives

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:31 +01:00
Aishwarya Pant c05f4ad139 staging: bcm2835-audio: use braces on all arms of statement
Add braces on all arms of the if-else statements in bcm2835-vchiq.c to
comply with kernel coding style.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:31 +01:00
Aishwarya Pant da2ee3eeb8 staging: bcm2835-audio: remove spaces after cast
Remove instances of unnecessary blank space after cast in bcm2835-vchiq.c

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:31 +01:00
Aishwarya Pant 637e078eaf staging: bcm2835-audio: replace printk(KERN_ERR...) with dev_err(...)
Use dev_err(... in place of printk(KERN_ERR ...
Problem found by checkpatch

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:31 +01:00
Aishwarya Pant 1f52aaf853 staging: bcm2835-audio: remove extra blank line
Fix the warning: Blank lines aren't necessary after an open brace
'{' issued by checkpatch on bcm2835-ctl.c

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:31 +01:00
Aishwarya Pant d812cd58c8 staging: bcm2835-audio: use kernel preferred block commenting style
Fix block comment formatting to suppress the following warning thrown by
checkpatch: Block comments use a trailing */ on a separate line

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:31 +01:00
Aishwarya Pant 01fb592f93 staging: bcm2835-audio: move logical continuation to the same line
Keep logical continuations on the same line to improve code readability

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:31 +01:00
Aishwarya Pant d561c88560 staging: bcm2835-audio: remove space after cast
Remove instances of unnecessary blank space after cast in bcm2835-ctl.c

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:12:31 +01:00
Michael Zoran 32c2aafcbf staging: bcm2835-camera: select BCM2835_VCHIQ rather then depending on it.
Change the camera's dependency on BCM2835_VCHIQ to a select
since camera support is typically more important to people
then base VCHIQ(which they may not even know what it's for).

Also, with a dependency the camera support would not be
visiable until VCHIQ is selected first, and that may
not be what most people would expect.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:02:03 +01:00
Michael Zoran 8400dbe9da staging: bcm2835-audio: select BCM2835_VCHIQ rather then depending on it.
Change the audio's dependency on BCM2835_VCHIQ to a select
since audio support is typically more important to people
then base VCHIQ(which they may not even know what it's for).

Also, with a dependency the audio support would not be
visiable until VCHIQ is selected first, and that may
not be what most people would expect.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:02:03 +01:00
Michael Zoran 6bbfe4a761 staging: vc04_services: Create new BCM_VIDEOCORE setting for VideoCore services.
Create a new memuconfig for Broadcom VideoCore services
since VideoCore is a general term used by Broadcom for a
large family of products that includes more then the BCM2835.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 14:02:03 +01:00
Aishwarya Pant 36b4894e4a staging: bcm2835-camera: prefer allocating memory using sizeof(*ptr) instead of sizeof(struct type name)
Using sizeof(*ptr) instead of sizeof(struct type name) is more robust to
errors.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 13:57:17 +01:00
Narcisa Ana Maria Vasile 1625538220 staging: bcm2835-camera: Replace 'uint32_t' with kernel type u32
This patch fixes the checkpatch.pl issue:
CHECK: Prefer kernel type 'u32' over 'uint32_t'

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 13:57:17 +01:00
Narcisa Ana Maria Vasile 3213a6e5a8 staging: bcm2835-camera: Add spaces around '<<'
This patch fixes the checkpatch.pl issue:
CHECK: spaces preferred around that '<<' (ctx:VxV)

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 13:57:17 +01:00
Narcisa Ana Maria Vasile a68eb156d2 staging: bcm2835-camera: Remove unnecessary blank lines
This patch fixes the checkpatch.pl issue:
CHECK: Please don't use multiple blank lines

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 13:57:17 +01:00
Narcisa Ana Maria Vasile 3302603e14 staging: vc04_services: bcm2835-camera: Remove unnecessary variable
Instead of storing the result, make the function return directly

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 13:57:17 +01:00
Narcisa Ana Maria Vasile 372499b589 staging: vc04_services: Removed unnecessary variable
Removed unnecessary variable and used instead the parameter
that was already defined

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:39:54 +01:00
Narcisa Ana Maria Vasile fa2ccd35d7 staging: bcm2835-camera: Refactored get_format function
Now, when the condition inside the for is fulfilled, I return the result,
instead of checking afterwards whether the counter has reached or not
the end of the list.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:39:54 +01:00
Aishwarya Pant 4bc58d1675 staging: vc04_services: bcm2835-camera: Simplify NULL comparisons
Remove instances of explicit NULL comparisons in bcm2835-camera driver
for code compaction.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:39:53 +01:00
Stefan Wahren dd4eab3a3a staging: vchiq_arm: Don't define PAGE_SIZE
There is no need to define PAGE_SIZE in the vchiq driver
so remove the define from vchiq_pagelist.h .

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Stefan Wahren 6d80d63620 staging: vchiq_arm: Include linux/mm.h
vchiq_2835_arm.c uses functions and macros like put_page() or
PAGE_ALIGN(). So we better include the necessary header.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Stefan Wahren 3791ea92b7 staging: vchiq_arm: Remove unnecessary includes
Including those headers is unnecessary, so we better remove them.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Narcisa Ana Maria Vasile 15411ed5c6 staging: bcm2835-audio: Fixed spacing around '&'
This was reported by checkpatch.pl

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Alexandru Jercaianu ac3c5ec8d4 Staging: bcm2835-audio: Removed redundant check
This was reported by checkpatch.pl

Signed-off-by: Alexandru Jercaianu <alex.jercaianu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Michael Zoran 128aacf2c9 staging: bcm2835-camera: Update driver name
Update the name of the camera driver as displayed
by the Kconfig to match the audio driver style.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Michael Zoran fa5dc7c4d0 staging: bcm2835-audio: Update driver description
The audio driver description contains a reference to a card.
Since this is for built in audio, drop the card reference
from the description.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Michael Zoran 212afb97ef staging: bcm2835-camera: Move driver under vc04_services
The bcm2835-camera driver is part of v04_services, so it makes
sense for it to be located under vc04_services to make
configuration clearer.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Michael Zoran 051420a997 staging: bcm2835-audio: Move driver under vc04_services
The bcm2835-audio driver is part of v04_services, so it makes
sense for it to be located under vc04_services to make
configuration clearer.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:06 +01:00
Gargi Sharma 47db0f6c9a staging: vc04_services: Remove explicit NULL comparison
Replace explicit NULL comparison with ! operator to
simplify code.

Found with Coccinelle script:
@@
expression ptr;
position p;
statement s0, s1;
@@

ptr@p =
\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|usb_alloc_urb\|
alloc_netdev\|dev_alloc_skb\)(...)
... when != ptr

if (
(
+ !
ptr
- == NULL
)
) s0 else s1

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:02 +01:00
Yamanappagouda Patil 1ee6491241 staging: vc04_services: Fixed "space prohibited after that open/close parenthesis" erros.
Fixed checkpath.pl erros "space prohibited after that open/close parenthesis" in vchiq_version.c file.

Signed-off-by: Yamanappagouda Patil <goudapatilk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:02 +01:00
simran singhal 0169acaea5 staging: vc04_services: Using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)).
It clarifies the divisor calculations. This occurence was detected using
the coccinelle script:

@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:02 +01:00
Yamanappagouda Patil 6e475350a4 staging: vc04_services: Fixed 'missing a blank line' warnings.
Fixed checkpatch.pl "missing a blank line after declarations" warning
messages in vc04_services module.

Signed-off-by: Yamanappagouda Patil <goudapatilk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:02 +01:00
Linus Torvalds 91aff98b79 Staging/IIO driver fixes for 4.11-rc1
Here are a few small staging and IIO driver fixes for issues that showed
 up after the big set if changes you merged last week.
 
 Nothing major, just small bugs resolved in some IIO drivers, a lustre
 allocation fix, and some RaspberryPi driver fixes for reported problems,
 as well as a MAINTAINERS entry update.
 
 All of these have been in linux-next for a week with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWLpyRg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ynFRwCglHKVpiXmfJmXhP5PwYlc2Ji/0TEAnAhsFKgA
 PZCq+XiZqerupIobBbm6
 =oHZ8
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.11-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO driver fixes from Greg KH:
 "Here are a few small staging and IIO driver fixes for issues that
  showed up after the big set if changes you merged last week.

  Nothing major, just small bugs resolved in some IIO drivers, a lustre
  allocation fix, and some RaspberryPi driver fixes for reported
  problems, as well as a MAINTAINERS entry update.

  All of these have been in linux-next for a week with no reported
  issues"

* tag 'staging-4.11-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: fsl-mc: fix warning in DT ranges parser
  MAINTAINERS: Remove Noralf Trønnes as fbtft maintainer
  staging: vchiq_2835_arm: Make cache-line-size a required DT property
  staging: bcm2835/mmal-vchiq: unlock on error in buffer_from_host()
  staging/lustre/lnet: Fix allocation size for sv_cpt_data
  iio: adc: xilinx: Fix error handling
  iio: 104-quad-8: Fix off-by-one error when addressing flag register
  iio: adc: handle unknow of_device_id data
2017-03-04 11:26:18 -08:00
Ingo Molnar 3f07c01441 sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h>
We are going to split <linux/sched/signal.h> out of <linux/sched.h>, which
will have to be picked up from other headers and a couple of .c files.

Create a trivial placeholder <linux/sched/signal.h> file that just
maps to <linux/sched.h> to make this patch obviously correct and
bisectable.

Include the new header in the files that are going to need it.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-03-02 08:42:29 +01:00
Masahiro Yamada 608595ed9b scripts/spelling.txt: add "therfore" pattern and fix typo instances
Fix typos and add the following to the scripts/spelling.txt:

  therfore||therefore

Besides, tidy up comment blocks for 80-col wrapping.

Link: http://lkml.kernel.org/r/1481573103-11329-31-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>
2017-02-27 18:43:47 -08:00
Michael Zoran 6cf1bf636a staging: vchiq_2835_arm: Make cache-line-size a required DT property
The original github source allowed for the cache-line-size property
to be missing.  Since recent firmwares also require this property,
it makes sense to always require it in the driver as well.

If the cache-line-size property is missing, then the driver probe
should fail as no dev since the kernel and dt may be out of sync.
The fix is to add a check for the return value of of_property_read_u32.

Changes V2:
	1. Add error message if cache-line-size is missing.
	2. Simple check for non-zero return value from
	   of_property_read_u32.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-26 17:05:48 +01:00
Mandel Benjamin 0a44127501 Staging: vc04_services: Fix the "space prohibited" code style errors
Fixes the following code style errors:

ERROR: space prohibited after/before that open/closed parenthesis

Signed-off-by: Mandel Benjamin <benyx.mandel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-16 10:44:59 -08:00
Mandel Benjamin 6b0d6284d9 Staging: vc04_services: Fix the "wrong indent" code style errors
Fixes the following code style errors:

ERROR: code indent should use tabs where possible

Signed-off-by: Mandel Benjamin <benyx.mandel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-16 10:44:59 -08:00
Stafford Horne 38955adfeb staging: vchip_shim: Remove unneeded stddef.h include
Building on openrisc musl toolchain this causes the allyesconfig build
to fail.

  drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c:42:20:
  fatal error: stddef.h: No such file or directory

Removing this causes no issues with the build.

Signed-off-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-05 11:41:39 +01:00
Michael Zoran 2038043008 staging: vc04_services: Make vchi_msg_queue static
The vchi_msg_queue function which is used by other drivers
to queue a message is difficult to understand and overly
generic.

Make the function static and remove it from the exported
symbols.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-31 10:48:14 +01:00
Michael Zoran 619969770f staging: vc04_services: Add vchi_queue_user_message function
The vchi_msg_queue function which is used by other drivers
to queue a message is difficult to understand and overly
generic.

Add a new function which is a wrapper on top of vchi_msg_queue
that is specifically for queuing a message located in user
address space.

int
vchi_queue_user_message(VCHI_SERVICE_HANDLE_T handle,
                        void __user *data,
                        unsigned int size)

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-31 10:48:14 +01:00
Michael Zoran fbcaed9e32 staging: vc04_services: Add vchi_queue_kernel_message function
The vchi_msg_queue function which is used by other drivers
to queue a message is difficult to understand and overly
generic.

Add a new function which is a wrapper on top of vchi_msg_queue
that is specifically for queuing a message located in kernel
address space.

int
vchi_queue_kernel_message(VCHI_SERVICE_HANDLE_T handle,
			  void *data,
			  unsigned int size)

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-31 10:48:14 +01:00
Adrien Descamps 564f87f952 staging: vc04: Fix coding style errors "open brace go on the same line"
Open braces for enum, union and struct go on the same line.

Signed-off-by: Adrien Descamps <adrien.descamps@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 11:30:32 +01:00
Phil Elwell a2db578bc0 staging: vchiq_arm: Avoid premature message stalls
The constants MAX_COMPLETIONS and MSG_QUEUE_SIZE control
the number of messages that can be outstanding to each client
before the system as a whole stalls. If the numbers are too
small then unnecessary thread switching will occur while
waiting for a (potentially low priority) client thread to
consume some data; badly written clients can even lead to
deadlock.

For services that carry many short messages, 16 messages can
represent a very small amount of data. Since the resources
are small - 16 bytes for a completion, 4 bytes for a message
pointer - increase the limits so they are unlikely to be hit
except in exceptional circumstances.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 11:08:57 +01:00
Phil Elwell ca3df03b83 staging: vc04_services: Fix messages appearing twice
An issue was observed when flushing openmax components
which generate a large number of messages returning
buffers to host.

We occasionally found a duplicate message from 16
messages prior, resulting in a buffer returned twice.

So fix the issue by adding more memory barriers.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 11:08:57 +01:00
Phil Elwell 5069c86acb staging: vchiq_arm: Service callbacks must not fail
Service callbacks are not allowed to return an error. The internal
callback that delivers events and messages to user tasks does not
enqueue them if the service is closing, but this is not an error
and should not be reported as such.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 11:08:57 +01:00
Phil Elwell 72ed1db4cd staging: vchiq_arm: Fix unlocked access to dequeue_pending
The dequeue_pending flag wasn't protected by a spinlock in the
service_callback. So fix this to make it safe.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 11:08:57 +01:00
Phil Elwell c599a22e60 staging: vchiq_core: Reduce the memdump size
This reduces the memory dump size to a sufficient value of 16 bytes.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 11:08:57 +01:00
Stefan Wahren b33050d069 staging: vc04_services: Fix space issues
This fixes the space coding styles issues complained by checkpatch.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:42:46 +01:00
Stefan Wahren f306ed07d1 staging: vc04_services: Fix indentation
This should fix the indentation issues found by checkpatch.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:42:46 +01:00
Stefan Wahren 946d61ace1 staging: vc04_services: Drop vchiq_2835.h
There is no need for a vchiq_2835.h with its 2 local defines.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:42:46 +01:00
Stefan Wahren 698c4eba86 staging: vc04_services: Improve readability of kthread names
This patch tries to make the kernel thread names of vchiq a little
bit more self explaining and look closer to the existing ones:

slot handler: VCHIQ-%d -> vchiq-slot/%d
recycle thread: VCHIQr-%d -> vchiq-recy/%d
sync thread: VCHIQs-%d -> vhciq-sync/%d
keep-alive thread: VCHIQka-%d -> vchiq-keep/%d

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:42:46 +01:00
Stefan Wahren 364d26f150 staging: vc04_services: Use preferred kernel types
This patch fixes issues reported by checkpatch.pl about preferred
kernel types.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:42:46 +01:00
Stefan Wahren 9431667382 staging: vchiq_core: make local spinlock static
The quota_spinlock is only local. So make it static.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:42:46 +01:00
Stefan Wahren b19dae1d2f staging: vchiq_core: remove unused variable type
This variable is assigned a value, but never used. So remove it.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:41:31 +01:00
Stefan Wahren c5520ee074 staging: vc04_services: make local functions static
The functions vchiq_dump_shared_state() and vchiq_is_connected() are only
used locally. So make them static.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:41:30 +01:00
Stefan Wahren c98a5a0f1c staging: vchiq_arm: remove vchiq_platform_check_resume
This function is never used, so we could remove it.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:41:30 +01:00
Aaron Moore eeee8b1776 staging: vc04_services: Fix bracing on single statement blocks
Fix coding style issue caught by checkpatch.pl relating to braces on
single statement blocks. This issue was corrected in 3 locations.

Signed-off-by: Aaron Moore <aaron@atamisk.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 16:33:17 +01:00
Mike Kofron c322160ac5 staging: vc04_services: Fix NULL ptr sparse warnings
In calls to queue_message() in vchiq_core.c, the "void *context"
parameter is set as 0 rather than NULL. This patch amends each call to
use the proper NULL pointer. The following sparse warnings are fixed:

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:1623:23: warning: Using plain integer as NULL pointer
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:1976:47: warning: Using plain integer as NULL pointer
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:2075:47: warning: Using plain integer as NULL pointer
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:2095:47: warning: Using plain integer as NULL pointer
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:2907:39: warning: Using plain integer as NULL pointer
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:2929:39: warning: Using plain integer as NULL pointer
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:3059:72: warning: Using plain integer as NULL pointer
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:3860:31: warning: Using plain integer as NULL pointer
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:3870:31: warning: Using plain integer as NULL pointer
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:3880:31: warning: Using plain integer as NULL pointer

Signed-off-by: Mike Kofron <mpkofron@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 16:33:17 +01:00
Greg Kroah-Hartman f5f4c80e9a staging: vc04_services: add HAS_DMA dependancy
We need DMA for this, otherwise the build breaks, so fix this up.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Lee Jones <lee@kernel.org>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-17 09:39:59 +01:00
Arnd Bergmann 6fde3789a2 staging: vc04_services: clarify firmware dependency
The raspberrypi-firmware driver may be built as a loadable module,
which causes a link-time failure if the vc04_services driver is
built-in during compile-testing:

drivers/staging/vc04_services/vchiq.o: In function `vchiq_probe':
vchiq_connected.c:(.text.vchiq_probe+0x2c): undefined reference to `rpi_firmware_get'
drivers/staging/vc04_services/vchiq.o: In function `vchiq_platform_init':
vchiq_connected.c:(.text.vchiq_platform_init+0x1f0): undefined reference to `rpi_firmware_property'

This extends the dependency list to ensure the firmware is either
reachable, or completely disabled in case of compile-testing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-16 18:30:46 +01:00
Arnd Bergmann b826d73b30 staging: vc04_services: remove duplicate mutex_lock_interruptible
The driver tries to redefine mutex_lock_interruptible as an open-coded
mutex_lock_killable, but that definition clashes with the normal
mutex_lock_interruptible definition when CONFIG_DEBUG_LOCK_ALLOC
is set:

staging/vc04_services/interface/vchiq_arm/vchiq_killable.h:67:0: error: "mutex_lock_interruptible" redefined [-Werror]
 #define mutex_lock_interruptible mutex_lock_interruptible_killable
include/linux/mutex.h:161:0: note: this is the location of the previous definition

This simply removes the private implementation and uses the
normal mutex_lock_killable directly.

We could do the same for the down_interruptible_killable here, but
it's better to just remove the semaphores entirely from the driver,
which also takes care of that.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-16 18:30:46 +01:00
kbuild test robot caac19b97d staging: vc04_services: fix ifnullfree.cocci warnings
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c:65:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14 15:38:42 +01:00
kbuild test robot 5209f93b19 staging: vc04_services: fix array_size.cocci warnings
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:193:39-40: WARNING: Use ARRAY_SIZE

 Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element

Semantic patch information:
 This makes an effort to find cases where ARRAY_SIZE can be used such as
 where there is a division of sizeof the array by the sizeof its first
 element or by any indexed element or the element type. It replaces the
 division of the two sizeofs by ARRAY_SIZE.

Generated by: scripts/coccinelle/misc/array_size.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14 15:38:41 +01:00
kbuild test robot 30d84860c9 staging: vc04_services: fix returnvar.cocci warnings
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1788:16-22: Unneeded variable: "status". Return "VCHIQ_SUCCESS" on line 1824

 Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14 15:38:41 +01:00
kbuild test robot 53a6e71fdf staging: vc04_services: fix setup_timer.cocci warnings
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1817:2-12: Use setup_timer function for function on line 1818.

 Use setup_timer function instead of initializing timer with the function
 and data fields
Generated by: scripts/coccinelle/api/setup_timer.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14 15:38:41 +01:00
Greg Kroah-Hartman abbdc56b17 staging: vc04_services: add CONFIG_COMPILE_TEST ability
It would be nice to be able to build this code on other platforms other
than only the RPi, so add some empty macros to allow this to happen, and
turn off BROKEN as the code can now build properly thanks to Michael's
work.

Cc: Michael Zoran <mzoran@crowfest.net>
Cc: Daniel Stone <daniels@collabora.com>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Pranith Kumar <bobby.prani@gmail.com>
Cc: popcornmix <popcornmix@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-10 23:48:54 +01:00