1
0
Fork 0
Commit Graph

103 Commits (redonkable)

Author SHA1 Message Date
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Linus Torvalds c9946d014f HSI changes for the v4.13 series
* misc. cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAllbWKUACgkQ2O7X88g7
 +pr69A//WKi6MoFPPlQs6ONfNWSVLGkeCTbMixTLQm0T8Jp3DtsOuNlXaLDYzUCm
 BRAD9KAaDce6XyLxCOwx5CdYOpTJa5EiGA6jCp/GlBUzxw8GDjQnmuWmR2nMFT9O
 H+9w7aEhALj5z/BPItYr28jes/lq33iF87S+VOdXzM4DFnHepOWZyWTHSYVOcKOg
 Ev8xJXLVWxpDblEM7GaQzAVWGvWtgbjCd2FEvlNEWQRLg9IWRVut+F84x/QQGlZA
 cmXzX80fs91+LpgD0+10x9iUX84jLhWFx+GePjIFSYWTm3XOpV226ufJuaRjhejs
 QN21oEpLnlZ1XF6T3q/xFwJgHjQP/EedEiVUt+FWAqInD7xZQJRNds//jlGU/TXd
 QROy22JefHoPQlbZ09SP9Pq6w7mZcPmKux3BCdWcOoSne47hYJrU105cR6vbRDF2
 pYH6J2tZfiemMvFtnEJJuiDIklh1OrMlunQy9+0A4bRJZKtS3hp5eDuw4CmieXip
 TVGMYGmyTMdut2qSGg6VarST2kdMvbfWC3Raz21ff2kDReiseHR00z+laLqs78SA
 VnyqRMVXWyHrvpGrIJPveO77W2/ywq/fI0Lib8aAyIWkNq+2OvKuODfiQTimBc9z
 KgYZ5xQW4SjNm4Se2GiNiCwURgrwx5Y1u9X3RkZjVtInbfPNj8o=
 =8HaP
 -----END PGP SIGNATURE-----

Merge tag 'hsi-for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi

Pull HSI updates from Sebastian Reichel:
 "Misc cleanups"

* tag 'hsi-for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi:
  HSI: core: Use kcalloc() in two functions
  HSI: Use kcalloc() in hsi_register_board_info()
  HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()
  HSI: omap_ssi: Fix a typo in a comment line
  HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller()
  HSI: nokia-modem: Add a space character for better code readability in nokia_modem_probe()
  HSI: nokia-modem: Delete error messages for a failed memory allocation in two functions
  HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe()
2017-07-04 14:28:22 -07:00
David S. Miller ed66e50d95 hsi: Fix build regression due to netdev destructor fix.
> ../drivers/hsi/clients/ssi_protocol.c:1069:5: error: 'struct net_device' has no member named 'destructor'

Reported-by: Mark Brown <broonie@kernel.org>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-08 10:16:05 -04:00
Markus Elfring 67ddd75771 HSI: core: Use kcalloc() in two functions
Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08 13:21:43 +02:00
Markus Elfring de7c98eb7c HSI: Use kcalloc() in hsi_register_board_info()
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08 13:21:43 +02:00
Markus Elfring 0fbad7c8e2 HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()
The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such a statement here.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08 13:21:43 +02:00
Markus Elfring 8621e620c1 HSI: omap_ssi: Fix a typo in a comment line
Add a missing character in this description for a function call.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08 13:21:43 +02:00
Markus Elfring 4a8557de7f HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller()
* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "devm_kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08 13:21:43 +02:00
Markus Elfring 34b2486def HSI: nokia-modem: Add a space character for better code readability in nokia_modem_probe()
The script "checkpatch.pl" pointed information out like the following.

ERROR: space required before the open parenthesis '('

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08 13:21:43 +02:00
Markus Elfring 4e3b9baa2f HSI: nokia-modem: Delete error messages for a failed memory allocation in two functions
The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such statements here.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08 13:21:43 +02:00
Markus Elfring 1be0593f05 HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe()
* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "devm_kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data structure by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08 13:21:43 +02:00
Dan Carpenter 3026050179 HSI: ssi_protocol: double free in ssip_pn_xmit()
If skb_pad() fails then it frees skb and we don't need to free it again
at the end of the function.

Fixes: dc7bf5d7 ("HSI: Introduce driver for SSI Protocol")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-04-21 17:58:45 +02:00
Ingo Molnar 174cd4b1e5 sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>
Fix up affected files that include this signal functionality via sched.h.

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:32 +01:00
Dave Jiang 11bac80004 mm, fs: reduce fault, page_mkwrite, and pfn_mkwrite to take only vmf
->fault(), ->page_mkwrite(), and ->pfn_mkwrite() calls do not need to
take a vma and vmf parameter when the vma already resides in vmf.

Remove the vma parameter to simplify things.

[arnd@arndb.de: fix ARM build]
  Link: http://lkml.kernel.org/r/20170125223558.1451224-1-arnd@arndb.de
Link: http://lkml.kernel.org/r/148521301778.19116.10840599906674778980.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-24 17:46:54 -08:00
Jarod Wilson b3e3893e12 net: use core MTU range checking in misc drivers
firewire-net:
- set min/max_mtu
- remove fwnet_change_mtu

nes:
- set max_mtu
- clean up nes_netdev_change_mtu

xpnet:
- set min/max_mtu
- remove xpnet_dev_change_mtu

hippi:
- set min/max_mtu
- remove hippi_change_mtu

batman-adv:
- set max_mtu
- remove batadv_interface_change_mtu
- initialization is a little async, not 100% certain that max_mtu is set
  in the optimal place, don't have hardware to test with

rionet:
- set min/max_mtu
- remove rionet_change_mtu

slip:
- set min/max_mtu
- streamline sl_change_mtu

um/net_kern:
- remove pointless ndo_change_mtu

hsi/clients/ssi_protocol:
- use core MTU range checking
- remove now redundant ssip_pn_set_mtu

ipoib:
- set a default max MTU value
- Note: ipoib's actual max MTU can vary, depending on if the device is in
  connected mode or not, so we'll just set the max_mtu value to the max
  possible, and let the ndo_change_mtu function continue to validate any new
  MTU change requests with checks for CM or not. Note that ipoib has no
  min_mtu set, and thus, the network core's mtu > 0 check is the only lower
  bounds here.

mptlan:
- use net core MTU range checking
- remove now redundant mpt_lan_change_mtu

fddi:
- min_mtu = 21, max_mtu = 4470
- remove now redundant fddi_change_mtu (including export)

fjes:
- min_mtu = 8192, max_mtu = 65536
- The max_mtu value is actually one over IP_MAX_MTU here, but the idea is to
  get past the core net MTU range checks so fjes_change_mtu can validate a
  new MTU against what it supports (see fjes_support_mtu in fjes_hw.c)

hsr:
- min_mtu = 0 (calls ether_setup, max_mtu is 1500)

f_phonet:
- min_mtu = 6, max_mtu = 65541

u_ether:
- min_mtu = 14, max_mtu = 15412

phonet/pep-gprs:
- min_mtu = 576, max_mtu = 65530
- remove redundant gprs_set_mtu

CC: netdev@vger.kernel.org
CC: linux-rdma@vger.kernel.org
CC: Stefan Richter <stefanr@s5r6.in-berlin.de>
CC: Faisal Latif <faisal.latif@intel.com>
CC: linux-rdma@vger.kernel.org
CC: Cliff Whickman <cpw@sgi.com>
CC: Robin Holt <robinmholt@gmail.com>
CC: Jes Sorensen <jes@trained-monkey.org>
CC: Marek Lindner <mareklindner@neomailbox.ch>
CC: Simon Wunderlich <sw@simonwunderlich.de>
CC: Antonio Quartulli <a@unstable.cc>
CC: Sathya Prakash <sathya.prakash@broadcom.com>
CC: Chaitra P B <chaitra.basappa@broadcom.com>
CC: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
CC: MPT-FusionLinux.pdl@broadcom.com
CC: Sebastian Reichel <sre@kernel.org>
CC: Felipe Balbi <balbi@kernel.org>
CC: Arvid Brodin <arvid.brodin@alten.se>
CC: Remi Denis-Courmont <courmisch@gmail.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-20 14:51:10 -04:00
Sebastian Reichel 9c99e5e519 HSI: omap_ssi: drop pm_runtime_irq_safe
pm_runtime_irq_safe increases the parents runtime usage
counter effectively keeping the OMAP SoC from idling.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:40:08 +02:00
Sebastian Reichel ad60db2f9f HSI: omap_ssi_port: use rpm autosuspend API
Instead of immediately sending the SSI module to
sleep, wait some time in case of new incoming or
outgoing traffic.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:40:03 +02:00
Sebastian Reichel 4e552310cd HSI: omap_ssi: call msg->complete() from process context
msg->complete() should always be called from process context once
irq_safe runtime pm flag is no longer set for omap-ssi.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:40:00 +02:00
Sebastian Reichel 604fdfa458 HSI: omap_ssi_port: ensure clocks are kept enabled during transfer
ensure, that clocks remain enabled, when a transfer is started.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:39:56 +02:00
Sebastian Reichel d2b8d695c6 HSI: omap_ssi_port: replace pm_runtime_put_sync with non-sync variant
There is no need to wait for hardware to really reach idle states,
so just release runtime PM asynchronously.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:39:43 +02:00
Sebastian Reichel fa1572d956 HSI: omap_ssi_port: avoid calling runtime_pm_*_sync inside spinlock
runtime_pm_*_sync can block when irq_safe flag is removed
from omap-ssi driver, so it may not be called while a
spinlock is held.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:39:39 +02:00
Sebastian Reichel 62aa292b3e HSI: omap_ssi_port: avoid pm_runtime_get_sync in ssi_start_dma and ssi_start_pio
These functions may be called from atomic context,
so avoid synchronous runtime pm calls.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:39:36 +02:00
Sebastian Reichel c4a6257315 HSI: omap_ssi_port: switch to threaded pio irq
Move pio interrupt handler from tasklet into thread to
allow runtime_pm_get_sync calls without irq_safe being
set.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:39:32 +02:00
Sebastian Reichel 927d3f8f73 HSI: omap_ssi_core: remove pm_runtime_get_sync call from tasklet
We may not call pm_runtime_get_sync() from tasklet, since
it can block once pm_runtime_irq_safe is removed for omap-ssi.

Since irq can should only be created for a running device,
we assume, that the device is already running and use non-
synchronous API instead.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:39:26 +02:00
Sebastian Reichel ea88f717cd HSI: omap_ssi_core: use pm_runtime_put instead of pm_runtime_put_sync
There is no need to disable the device synchronously, so
don't do it.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:39:21 +02:00
Sebastian Reichel 7c5d81620e HSI: omap_ssi_port: prepare start_tx/stop_tx for blocking pm_runtime calls
ssi_start_tx and ssi_stop_tx may be called from atomic context. Once
pm_runtime_irq_safe() is removed for omap-ssi, this will fail, due
to blocking pm_runtime_*_sync() calls.

This fixes ssi_stop_tx by using non-sync API and ssi_start_tx by
using a worker thread.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:39:15 +02:00
Sebastian Reichel de5a3774dd HSI: core: switch port event notifier from atomic to blocking
port events should be sent from process context after
irq_safe runtime pm flag is removed in omap-ssi.

Signed-off-By: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:38:53 +02:00
Sebastian Reichel 2083057aac HSI: omap_ssi_port: replace wkin_cken with atomic bitmap operations
This simplifies the code and avoids holding a spin_lock when
runtime pm calls are made. Once the irq_safe flag is removed
for omap_ssi's runtime pm, pm_runtime_get/put_sync can sleep,
which is a no-go while holding a spin_lock.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:38:47 +02:00
Sebastian Reichel cb70e4c1bc HSI: omap_ssi: convert cawake irq handler to thread
Convert cawake interrupt handler from tasklet to
threaded interrupt handler in preparation of
blocking runtime_pm calls.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:38:43 +02:00
Sebastian Reichel df26d639e2 HSI: ssi_protocol: fix ssip_xmit invocation
ssip_xmit should be called from process context,
since it calls hsi_async_write.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:38:37 +02:00
Sebastian Reichel 866dcb9d57 HSI: ssi_protocol: replace spin_lock with spin_lock_bh
To avoid setting irq_safe runtime pm flag in omap-ssi, multiple calls
will be moved to process context. This also affects ssi-protocol, so
use the safer spin_lock_bh instead of a simple spin_lock.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:38:32 +02:00
Sebastian Reichel 6d6c30973b HSI: ssi_protocol: avoid ssi_waketest call with held spinlock
This avoids calling ssi_waketest(), while a spinlock is
being hold, since ssi_waketest may sleep once irq_safe
runtime pm is disabled.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:37:58 +02:00
Sebastian Reichel b6616be324 HSI: omap_ssi: do not reset module
module reset and power management rule setup
is already done by hwmod. Remove this cruft,
which predates hwmod.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:37:43 +02:00
Sebastian Reichel 8c009f1f5d HSI: omap_ssi_port: remove useless newline
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
2016-06-28 00:37:20 +02:00
Andrew F. Davis e01957abd4 hsi: Build hsi_boardinfo.c into hsi core if enabled
If the HSI core is built as a module hsi_boardinfo may still
be built-in as its Kconfig type is bool, which can cause build
issues. Fix this by building this code into the HSI core when
enabled.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-15 16:02:50 +02:00
Iago Abal 3c13ab1d96 HSI: cmt_speech: Fix double spin_lock
Release &hi->lock before calling `cs_hsi_control_read_error' to avoid deadlock.

The bug was found using EBA (https://github.com/models-team/eba), which reported
the following:

    Double lock
    first at drivers/hsi/clients/cmt_speech.c:443
    second at drivers/hsi/clients/cmt_speech.c:447
    In cs_hsi_read_on_control_complete defined at drivers/hsi/clients/cmt_speech.c:438:
    (!) drivers/hsi/clients/cmt_speech.c:443: spin_lock(& hi->lock);
    (?) drivers/hsi/clients/cmt_speech.c:445: msg->status == 4 -> true
    (!) drivers/hsi/clients/cmt_speech.c:447: cs_hsi_control_read_error(hi, msg);
        (!) drivers/hsi/clients/cmt_speech.c:407: __cs_hsi_error_pre(hi, msg, "control read",
                       & hi->control_state);
            (!) drivers/hsi/clients/cmt_speech.c:382: spin_lock(& hi->lock);

Signed-off-by: Iago Abal <mail@iagoabal.eu>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-10 00:08:10 +02:00
Muhammad Falak R Wani b32bd7e7d5 hsi: use kmemdup
Use kmemdup when some other buffer is immediately copied into allocated
region. It replaces call to allocation followed by memcpy, by a single
call to kmemdup.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-29 20:38:02 +02:00
Muhammad Falak R Wani f6004b7bc6 HSI: cmt_speech: use vma_pages().
Replace explicit computation of vma page count by a call to
vma_pages()

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-29 20:37:45 +02:00
Arnd Bergmann c2f90a465d HSI: omap-ssi: move omap_ssi_port_update_fclk
After the clk change support, the ssi omap ssi core driver
now calls into the port driver to change fclk. This function
was previously inside of an #ifdef, because it was only used
when CONFIG_PM is enabled. Now it also gets used without
power management support:

drivers/hsi/built-in.o: In function `ssi_clk_event':
omap_ssi_port.c:(.text+0x1bf8): undefined reference to `omap_ssi_port_update_fclk'

This moves the function outside of the CONFIG_PM guard.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 4bcf741452 ("HSI: omap-ssi: add clk change support")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-09 22:45:18 +02:00
Arnd Bergmann ac8e3ff3a0 HSI: omap-ssi: include pinctrl header files
The driver now uses some pinctrl functions, but fails
to build if PINCTRL is disabled because the respective
header files are only included indirectly:

drivers/hsi/controllers/omap_ssi_core.c: In function 'ssi_clk_event':
drivers/hsi/controllers/omap_ssi_core.c:317:4: error: implicit declaration of function 'pinctrl_pm_select_idle_state' [-Werror=implicit-function-declaration]
drivers/hsi/controllers/omap_ssi_core.c:339:4: error: implicit declaration of function 'pinctrl_pm_select_default_state' [-Werror=implicit-function-declaration]
drivers/hsi/controllers/omap_ssi_port.c: In function 'ssi_flush':
drivers/hsi/controllers/omap_ssi_port.c:520:2: error: implicit declaration of function 'pinctrl_pm_select_idle_state' [-Werror=implicit-function-declaration]

This includes the headers from the files that call the functions,
which works even if pinctrl is turned off.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 4bcf741452 ("HSI: omap-ssi: add clk change support")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-09 22:45:18 +02:00
Arnd Bergmann 53c703501e HSI: omap-ssi: add COMMON_CLK dependency
Enabling the omap ssi driver without COMMON_CLK results in a build failure:

drivers/hsi/controllers/omap_ssi_core.c: In function 'ssi_clk_event':
drivers/hsi/controllers/omap_ssi_core.c:304:7: error: 'PRE_RATE_CHANGE' undeclared (first use in this function)

This adds a Kconfig dependency to avoid the invalid configuration.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 4bcf741452 ("HSI: omap-ssi: add clk change support")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-09 22:45:18 +02:00
Sebastian Reichel 4bcf741452 HSI: omap-ssi: add clk change support
This adds support for frequency changes of the SSI
functional clock, which may occur due to DVFS.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-By: Sebastian Reichel <sre@kernel.org>
2016-05-02 21:56:25 +02:00
Sebastian Reichel 0fae198988 HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module
Merge omap_ssi and omap_ssi_port into one module. This
fixes problems with module cycle dependencies introduced
by future patches.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-02 21:56:21 +02:00
Sebastian Reichel 2a57aba850 HSI: omap_ssi: fix removal of port platform device
This avoids removal of the HSI port device when
only the platform port device should be removed
and clears the POPULATED bit in the DT node, so
that a new platform device is created when the
driver is probed again.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-02 21:56:17 +02:00
Sebastian Reichel 0845e1f20a HSI: omap_ssi: make sure probe stays available
device can be unbind/rebind, so probe should
stay available.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-02 21:56:12 +02:00
Sebastian Reichel f704e1103e HSI: omap_ssi: fix module unloading
Removal of ssi controller debugfs directory must
happen after the clients have been removed from
it.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-02 21:56:01 +02:00
Sebastian Reichel 73e6ce09c0 HSI: omap_ssi_port: switch to gpiod API
Simplify driver by switching to new gpio descriptor based API.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-05-02 21:55:20 +02:00
Sebastian Reichel 87d99063be HSI: ssi-protocol: Use handshake logic from n950
When using the ssi-protocol driver with the Nokia N950, the
following error is thrown during modem powered up sequence.

[13852.274993]  port0: SSI error: 0x01
[13852.279205] ssi-protocol ssi-protocol: RX error detected
[13852.284820] ssi-protocol ssi-protocol: Main state: 1
[13852.290069] ssi-protocol ssi-protocol: Recv state: 0
[13852.295288] ssi-protocol ssi-protocol: Send state: 0
[13852.300537] ssi-protocol ssi-protocol: CMT Offline
[13852.305603] ssi-protocol ssi-protocol: Wake test 1
[13852.310638] ssi-protocol ssi-protocol: Data RX id: 0
[13852.315887] ssi-protocol ssi-protocol: Data TX id: 0
[13856.001464] ssi-protocol ssi-protocol: Watchdog trigerred
[13856.007293] ssi-protocol ssi-protocol: Main state: 1
[13856.012542] ssi-protocol ssi-protocol: Recv state: 0
[13856.017761] ssi-protocol ssi-protocol: Send state: 0
[13856.023010] ssi-protocol ssi-protocol: CMT Offline
[13856.028045] ssi-protocol ssi-protocol: Wake test 0
[13856.033111] ssi-protocol ssi-protocol: Data RX id: 0
[13856.038330] ssi-protocol ssi-protocol: Data TX id: 0

This patch fixes the issue by using the handshake setup from
the Nokia N950 kernel. The new handshake sequence also works
with the N900, so there is no need to differentiate between
both modems.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-28 17:47:56 +01:00
Sebastian Reichel 633f67a51d HSI: nokia-modem: add n950 and n9 support
The Nokia N950 and Nokia N9 also have a SSI connected
modem, which use the same protocols as the Nokia N900,
but with increased link speed (96000 kbps instead of
55000 kbps) and with less GPIOs.

Since it's unclear, if the N950 and the N9 use exactly
the same modem, each of them gets their own compatible
string.

Acked-by: Rob Herring <robh@kernel.org>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-28 17:46:08 +01:00
Andrzej Hajda 525e1abc6b HSI: omap_ssi_port: fix handling of_get_named_gpio result
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07 16:07:54 +01:00