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-01 17:07:57 +03:00
// SPDX-License-Identifier: GPL-2.0
2008-04-24 02:37:04 +04:00
/*
* Glue code for the ISP1760 driver and bus
* Currently there is support for
* - OpenFirmware
* - PCI
2009-07-16 07:22:54 +04:00
* - PDEV ( generic platform device centralized driver model )
2008-04-24 02:37:04 +04:00
*
* ( c ) 2007 Sebastian Siewior < bigeasy @ linutronix . de >
*
*/
# include <linux/usb.h>
# include <linux/io.h>
2011-07-04 00:09:31 +04:00
# include <linux/module.h>
2015-01-21 01:55:44 +03:00
# include <linux/of.h>
2009-02-10 19:55:51 +03:00
# include <linux/platform_device.h>
2015-01-21 01:55:44 +03:00
# include <linux/slab.h>
2009-07-16 07:22:54 +04:00
# include <linux/usb/isp1760.h>
2010-04-25 01:21:52 +04:00
# include <linux/usb/hcd.h>
2008-04-24 02:37:04 +04:00
2015-01-21 01:55:57 +03:00
# include "isp1760-core.h"
2015-01-21 01:55:56 +03:00
# include "isp1760-regs.h"
2008-04-24 02:37:04 +04:00
2017-02-25 14:20:55 +03:00
# ifdef CONFIG_USB_PCI
2008-04-24 02:37:04 +04:00
# include <linux/pci.h>
# endif
2017-02-25 14:20:55 +03:00
# ifdef CONFIG_USB_PCI
2015-01-21 01:55:53 +03:00
static int isp1761_pci_init ( struct pci_dev * dev )
2008-04-24 02:37:04 +04:00
{
2015-01-21 01:55:53 +03:00
resource_size_t mem_start ;
resource_size_t mem_length ;
u8 __iomem * iobase ;
2008-04-24 02:37:04 +04:00
u8 latency , limit ;
int retry_count ;
2015-01-21 01:55:53 +03:00
u32 reg_data ;
2008-04-24 02:37:04 +04:00
/* Grab the PLX PCI shared memory of the ISP 1761 we need */
2015-01-21 01:55:53 +03:00
mem_start = pci_resource_start ( dev , 3 ) ;
mem_length = pci_resource_len ( dev , 3 ) ;
if ( mem_length < 0xffff ) {
2008-12-01 13:47:40 +03:00
printk ( KERN_ERR " memory length for this resource is wrong \n " ) ;
2015-01-21 01:55:53 +03:00
return - ENOMEM ;
2008-04-24 02:37:04 +04:00
}
2015-01-21 01:55:53 +03:00
if ( ! request_mem_region ( mem_start , mem_length , " ISP-PCI " ) ) {
2008-04-24 02:37:04 +04:00
printk ( KERN_ERR " host controller already in use \n " ) ;
2015-01-21 01:55:53 +03:00
return - EBUSY ;
2008-12-01 13:47:40 +03:00
}
/* map available memory */
2015-01-21 01:55:53 +03:00
iobase = ioremap_nocache ( mem_start , mem_length ) ;
if ( ! iobase ) {
2008-12-01 13:47:40 +03:00
printk ( KERN_ERR " Error ioremap failed \n " ) ;
2015-01-21 01:55:53 +03:00
release_mem_region ( mem_start , mem_length ) ;
return - ENOMEM ;
2008-04-24 02:37:04 +04:00
}
/* bad pci latencies can contribute to overruns */
pci_read_config_byte ( dev , PCI_LATENCY_TIMER , & latency ) ;
if ( latency ) {
pci_read_config_byte ( dev , PCI_MAX_LAT , & limit ) ;
if ( limit & & limit < latency )
pci_write_config_byte ( dev , PCI_LATENCY_TIMER , limit ) ;
}
/* Try to check whether we can access Scratch Register of
* Host Controller or not . The initial PCI access is retried until
* local init for the PCI bridge is completed
*/
retry_count = 20 ;
reg_data = 0 ;
while ( ( reg_data ! = 0xFACE ) & & retry_count ) {
/*by default host is in 16bit mode, so
* io operations at this stage must be 16 bit
* */
2015-01-21 01:55:53 +03:00
writel ( 0xface , iobase + HC_SCRATCH_REG ) ;
2008-04-24 02:37:04 +04:00
udelay ( 100 ) ;
2015-01-21 01:55:53 +03:00
reg_data = readl ( iobase + HC_SCRATCH_REG ) & 0x0000ffff ;
2008-04-24 02:37:04 +04:00
retry_count - - ;
}
2015-01-21 01:55:53 +03:00
iounmap ( iobase ) ;
release_mem_region ( mem_start , mem_length ) ;
2008-12-01 13:47:40 +03:00
2008-04-24 02:37:04 +04:00
/* Host Controller presence is detected by writing to scratch register
* and reading back and checking the contents are same or not
*/
if ( reg_data ! = 0xFACE ) {
2008-08-14 20:37:34 +04:00
dev_err ( & dev - > dev , " scratch register mismatch %x \n " , reg_data ) ;
2015-01-21 01:55:53 +03:00
return - ENOMEM ;
2008-04-24 02:37:04 +04:00
}
2015-01-21 01:55:53 +03:00
/* Grab the PLX PCI mem maped port start address we need */
mem_start = pci_resource_start ( dev , 0 ) ;
mem_length = pci_resource_len ( dev , 0 ) ;
if ( ! request_mem_region ( mem_start , mem_length , " ISP1761 IO MEM " ) ) {
printk ( KERN_ERR " request region #1 \n " ) ;
return - EBUSY ;
}
iobase = ioremap_nocache ( mem_start , mem_length ) ;
if ( ! iobase ) {
printk ( KERN_ERR " ioremap #1 \n " ) ;
release_mem_region ( mem_start , mem_length ) ;
return - ENOMEM ;
}
2008-04-24 02:37:04 +04:00
2008-12-01 13:47:40 +03:00
/* configure PLX PCI chip to pass interrupts */
# define PLX_INT_CSR_REG 0x68
reg_data = readl ( iobase + PLX_INT_CSR_REG ) ;
reg_data | = 0x900 ;
writel ( reg_data , iobase + PLX_INT_CSR_REG ) ;
2008-04-24 02:37:04 +04:00
2008-12-01 13:47:40 +03:00
/* done with PLX IO access */
2008-04-24 02:37:04 +04:00
iounmap ( iobase ) ;
2015-01-21 01:55:53 +03:00
release_mem_region ( mem_start , mem_length ) ;
return 0 ;
}
static int isp1761_pci_probe ( struct pci_dev * dev ,
const struct pci_device_id * id )
{
unsigned int devflags = 0 ;
int ret ;
if ( ! dev - > irq )
return - ENODEV ;
if ( pci_enable_device ( dev ) < 0 )
return - ENODEV ;
ret = isp1761_pci_init ( dev ) ;
if ( ret < 0 )
goto error ;
pci_set_master ( dev ) ;
2008-12-01 13:47:40 +03:00
2015-01-21 01:55:52 +03:00
dev - > dev . dma_mask = NULL ;
2015-01-21 01:55:58 +03:00
ret = isp1760_register ( & dev - > resource [ 3 ] , dev - > irq , 0 , & dev - > dev ,
devflags ) ;
2015-01-21 01:55:53 +03:00
if ( ret < 0 )
goto error ;
2008-12-01 13:47:40 +03:00
2015-01-21 01:55:53 +03:00
return 0 ;
error :
pci_disable_device ( dev ) ;
return ret ;
2008-04-24 02:37:04 +04:00
}
2008-12-01 13:47:40 +03:00
2008-04-24 02:37:04 +04:00
static void isp1761_pci_remove ( struct pci_dev * dev )
{
2015-01-21 01:55:45 +03:00
isp1760_unregister ( & dev - > dev ) ;
2008-04-24 02:37:04 +04:00
pci_disable_device ( dev ) ;
}
static void isp1761_pci_shutdown ( struct pci_dev * dev )
{
printk ( KERN_ERR " ips1761_pci_shutdown \n " ) ;
}
2016-05-04 05:15:37 +03:00
static const struct pci_device_id isp1760_plx [ ] = {
2008-11-30 18:50:04 +03:00
{
. class = PCI_CLASS_BRIDGE_OTHER < < 8 ,
. class_mask = ~ 0 ,
. vendor = PCI_VENDOR_ID_PLX ,
. device = 0x5406 ,
. subvendor = PCI_VENDOR_ID_PLX ,
. subdevice = 0x9054 ,
} ,
{ }
2008-04-24 02:37:04 +04:00
} ;
MODULE_DEVICE_TABLE ( pci , isp1760_plx ) ;
static struct pci_driver isp1761_pci_driver = {
. name = " isp1760 " ,
. id_table = isp1760_plx ,
. probe = isp1761_pci_probe ,
. remove = isp1761_pci_remove ,
. shutdown = isp1761_pci_shutdown ,
} ;
# endif
2012-11-19 22:21:48 +04:00
static int isp1760_plat_probe ( struct platform_device * pdev )
2009-02-10 19:55:51 +03:00
{
2015-01-21 01:55:58 +03:00
unsigned long irqflags ;
2015-01-21 01:55:44 +03:00
unsigned int devflags = 0 ;
2009-02-10 19:55:51 +03:00
struct resource * mem_res ;
struct resource * irq_res ;
2015-01-21 01:55:44 +03:00
int ret ;
2009-02-10 19:55:51 +03:00
mem_res = platform_get_resource ( pdev , IORESOURCE_MEM , 0 ) ;
irq_res = platform_get_resource ( pdev , IORESOURCE_IRQ , 0 ) ;
if ( ! irq_res ) {
2016-09-27 19:16:59 +03:00
pr_warn ( " isp1760: IRQ resource not available \n " ) ;
2015-01-21 01:55:52 +03:00
return - ENODEV ;
2009-02-10 19:55:51 +03:00
}
2015-01-21 01:55:58 +03:00
irqflags = irq_res - > flags & IRQF_TRIGGER_MASK ;
2009-02-10 19:55:51 +03:00
2015-01-21 01:55:44 +03:00
if ( IS_ENABLED ( CONFIG_OF ) & & pdev - > dev . of_node ) {
struct device_node * dp = pdev - > dev . of_node ;
u32 bus_width = 0 ;
if ( of_device_is_compatible ( dp , " nxp,usb-isp1761 " ) )
2009-07-16 07:22:54 +04:00
devflags | = ISP1760_FLAG_ISP1761 ;
2015-01-21 01:55:44 +03:00
/* Some systems wire up only 16 of the 32 data lines */
of_property_read_u32 ( dp , " bus-width " , & bus_width ) ;
if ( bus_width = = 16 )
2009-07-16 07:22:54 +04:00
devflags | = ISP1760_FLAG_BUS_WIDTH_16 ;
2015-01-21 01:55:44 +03:00
if ( of_property_read_bool ( dp , " port1-otg " ) )
2009-07-16 07:22:54 +04:00
devflags | = ISP1760_FLAG_OTG_EN ;
2015-01-21 01:55:44 +03:00
if ( of_property_read_bool ( dp , " analog-oc " ) )
2009-07-16 07:22:54 +04:00
devflags | = ISP1760_FLAG_ANALOG_OC ;
2015-01-21 01:55:44 +03:00
if ( of_property_read_bool ( dp , " dack-polarity " ) )
2009-07-16 07:22:54 +04:00
devflags | = ISP1760_FLAG_DACK_POL_HIGH ;
2015-01-21 01:55:44 +03:00
if ( of_property_read_bool ( dp , " dreq-polarity " ) )
devflags | = ISP1760_FLAG_DREQ_POL_HIGH ;
} else if ( dev_get_platdata ( & pdev - > dev ) ) {
struct isp1760_platform_data * pdata =
dev_get_platdata ( & pdev - > dev ) ;
if ( pdata - > is_isp1761 )
devflags | = ISP1760_FLAG_ISP1761 ;
if ( pdata - > bus_width_16 )
devflags | = ISP1760_FLAG_BUS_WIDTH_16 ;
if ( pdata - > port1_otg )
devflags | = ISP1760_FLAG_OTG_EN ;
if ( pdata - > analog_oc )
devflags | = ISP1760_FLAG_ANALOG_OC ;
if ( pdata - > dack_polarity_high )
devflags | = ISP1760_FLAG_DACK_POL_HIGH ;
if ( pdata - > dreq_polarity_high )
2009-07-16 07:22:54 +04:00
devflags | = ISP1760_FLAG_DREQ_POL_HIGH ;
}
2015-01-21 01:55:51 +03:00
ret = isp1760_register ( mem_res , irq_res - > start , irqflags , & pdev - > dev ,
devflags ) ;
2015-01-21 01:55:47 +03:00
if ( ret < 0 )
2015-01-21 01:55:52 +03:00
return ret ;
2009-02-10 19:55:51 +03:00
pr_info ( " ISP1760 USB device initialised \n " ) ;
2015-01-21 01:55:44 +03:00
return 0 ;
2009-02-10 19:55:51 +03:00
}
2012-11-19 22:26:20 +04:00
static int isp1760_plat_remove ( struct platform_device * pdev )
2009-02-10 19:55:51 +03:00
{
2015-01-21 01:55:45 +03:00
isp1760_unregister ( & pdev - > dev ) ;
2012-04-05 16:56:07 +04:00
2009-02-10 19:55:51 +03:00
return 0 ;
}
2015-01-21 01:55:44 +03:00
# ifdef CONFIG_OF
static const struct of_device_id isp1760_of_match [ ] = {
{ . compatible = " nxp,usb-isp1760 " , } ,
{ . compatible = " nxp,usb-isp1761 " , } ,
{ } ,
} ;
MODULE_DEVICE_TABLE ( of , isp1760_of_match ) ;
# endif
2009-02-10 19:55:51 +03:00
static struct platform_driver isp1760_plat_driver = {
. probe = isp1760_plat_probe ,
2012-11-19 22:21:08 +04:00
. remove = isp1760_plat_remove ,
2009-02-10 19:55:51 +03:00
. driver = {
. name = " isp1760 " ,
2015-01-21 01:55:44 +03:00
. of_match_table = of_match_ptr ( isp1760_of_match ) ,
2009-02-10 19:55:51 +03:00
} ,
} ;
2008-04-24 02:37:04 +04:00
static int __init isp1760_init ( void )
{
2009-02-10 19:55:51 +03:00
int ret , any_ret = - ENODEV ;
2008-04-24 02:37:04 +04:00
2015-01-21 01:55:49 +03:00
isp1760_init_kmem_once ( ) ;
2008-04-24 02:37:04 +04:00
2009-02-10 19:55:51 +03:00
ret = platform_driver_register ( & isp1760_plat_driver ) ;
if ( ! ret )
any_ret = 0 ;
2017-02-25 14:20:55 +03:00
# ifdef CONFIG_USB_PCI
2008-04-24 02:37:04 +04:00
ret = pci_register_driver ( & isp1761_pci_driver ) ;
2009-02-10 19:55:51 +03:00
if ( ! ret )
any_ret = 0 ;
2008-04-24 02:37:04 +04:00
# endif
2009-02-10 19:55:51 +03:00
if ( any_ret )
2015-01-21 01:55:49 +03:00
isp1760_deinit_kmem_cache ( ) ;
2009-02-10 19:55:51 +03:00
return any_ret ;
2008-04-24 02:37:04 +04:00
}
module_init ( isp1760_init ) ;
static void __exit isp1760_exit ( void )
{
2009-02-10 19:55:51 +03:00
platform_driver_unregister ( & isp1760_plat_driver ) ;
2017-02-25 14:20:55 +03:00
# ifdef CONFIG_USB_PCI
2008-04-24 02:37:04 +04:00
pci_unregister_driver ( & isp1761_pci_driver ) ;
# endif
2015-01-21 01:55:49 +03:00
isp1760_deinit_kmem_cache ( ) ;
2008-04-24 02:37:04 +04:00
}
module_exit ( isp1760_exit ) ;