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
2013-06-25 23:15:24 +04:00
# include <linux/init.h>
2005-04-17 02:20:36 +04:00
# include <linux/types.h>
# include <linux/kernel.h>
# include <linux/mm.h>
# include <linux/tty.h>
# include <linux/console.h>
# include <linux/rtc.h>
# include <linux/vt_kern.h>
# include <linux/interrupt.h>
# include <asm/setup.h>
# include <asm/bootinfo.h>
2013-10-02 13:37:33 +04:00
# include <asm/bootinfo-apollo.h>
2013-10-04 13:41:24 +04:00
# include <asm/byteorder.h>
2005-04-17 02:20:36 +04:00
# include <asm/apollohw.h>
# include <asm/irq.h>
# include <asm/machdep.h>
u_long sio01_physaddr ;
u_long sio23_physaddr ;
u_long rtc_physaddr ;
u_long pica_physaddr ;
u_long picb_physaddr ;
u_long cpuctrl_physaddr ;
u_long timer_physaddr ;
u_long apollo_model ;
2020-09-24 18:29:17 +03:00
extern void dn_sched_init ( void ) ;
2005-04-17 02:20:36 +04:00
extern void dn_init_IRQ ( void ) ;
extern int dn_dummy_hwclk ( int , struct rtc_time * ) ;
extern void dn_dummy_reset ( void ) ;
# ifdef CONFIG_HEARTBEAT
static void dn_heartbeat ( int on ) ;
# endif
2006-10-07 17:16:45 +04:00
static irqreturn_t dn_timer_int ( int irq , void * ) ;
2005-04-17 02:20:36 +04:00
static void dn_get_model ( char * model ) ;
static const char * apollo_models [ ] = {
[ APOLLO_DN3000 - APOLLO_DN3000 ] = " DN3000 (Otter) " ,
[ APOLLO_DN3010 - APOLLO_DN3000 ] = " DN3010 (Otter) " ,
[ APOLLO_DN3500 - APOLLO_DN3000 ] = " DN3500 (Cougar II) " ,
[ APOLLO_DN4000 - APOLLO_DN3000 ] = " DN4000 (Mink) " ,
[ APOLLO_DN4500 - APOLLO_DN3000 ] = " DN4500 (Roadrunner) "
} ;
2013-06-25 23:15:24 +04:00
int __init apollo_parse_bootinfo ( const struct bi_record * record )
{
2005-04-17 02:20:36 +04:00
int unknown = 0 ;
2013-10-04 13:41:24 +04:00
const void * data = record - > data ;
2005-04-17 02:20:36 +04:00
2013-10-04 13:41:24 +04:00
switch ( be16_to_cpu ( record - > tag ) ) {
case BI_APOLLO_MODEL :
apollo_model = be32_to_cpup ( data ) ;
break ;
2005-04-17 02:20:36 +04:00
2013-10-04 13:41:24 +04:00
default :
unknown = 1 ;
2005-04-17 02:20:36 +04:00
}
return unknown ;
}
2013-06-25 23:15:24 +04:00
static void __init dn_setup_model ( void )
{
2014-05-10 14:40:53 +04:00
pr_info ( " Apollo hardware found: [%s] \n " ,
apollo_models [ apollo_model - APOLLO_DN3000 ] ) ;
2005-04-17 02:20:36 +04:00
switch ( apollo_model ) {
case APOLLO_UNKNOWN :
panic ( " Unknown apollo model " ) ;
break ;
case APOLLO_DN3000 :
case APOLLO_DN3010 :
sio01_physaddr = SAU8_SIO01_PHYSADDR ;
rtc_physaddr = SAU8_RTC_PHYSADDR ;
pica_physaddr = SAU8_PICA ;
picb_physaddr = SAU8_PICB ;
cpuctrl_physaddr = SAU8_CPUCTRL ;
timer_physaddr = SAU8_TIMER ;
break ;
case APOLLO_DN4000 :
sio01_physaddr = SAU7_SIO01_PHYSADDR ;
sio23_physaddr = SAU7_SIO23_PHYSADDR ;
rtc_physaddr = SAU7_RTC_PHYSADDR ;
pica_physaddr = SAU7_PICA ;
picb_physaddr = SAU7_PICB ;
cpuctrl_physaddr = SAU7_CPUCTRL ;
timer_physaddr = SAU7_TIMER ;
break ;
case APOLLO_DN4500 :
panic ( " Apollo model not yet supported " ) ;
break ;
case APOLLO_DN3500 :
sio01_physaddr = SAU7_SIO01_PHYSADDR ;
sio23_physaddr = SAU7_SIO23_PHYSADDR ;
rtc_physaddr = SAU7_RTC_PHYSADDR ;
pica_physaddr = SAU7_PICA ;
picb_physaddr = SAU7_PICB ;
cpuctrl_physaddr = SAU7_CPUCTRL ;
timer_physaddr = SAU7_TIMER ;
break ;
default :
panic ( " Undefined apollo model " ) ;
break ;
}
}
int dn_serial_console_wait_key ( struct console * co ) {
while ( ! ( sio01 . srb_csrb & 1 ) )
barrier ( ) ;
return sio01 . rhrb_thrb ;
}
void dn_serial_console_write ( struct console * co , const char * str , unsigned int count )
{
while ( count - - ) {
if ( * str = = ' \n ' ) {
sio01 . rhrb_thrb = ( unsigned char ) ' \r ' ;
while ( ! ( sio01 . srb_csrb & 0x4 ) )
;
}
sio01 . rhrb_thrb = ( unsigned char ) * str + + ;
while ( ! ( sio01 . srb_csrb & 0x4 ) )
;
}
}
void dn_serial_print ( const char * str )
{
while ( * str ) {
if ( * str = = ' \n ' ) {
sio01 . rhrb_thrb = ( unsigned char ) ' \r ' ;
while ( ! ( sio01 . srb_csrb & 0x4 ) )
;
}
sio01 . rhrb_thrb = ( unsigned char ) * str + + ;
while ( ! ( sio01 . srb_csrb & 0x4 ) )
;
}
}
2007-07-20 07:33:28 +04:00
void __init config_apollo ( void )
{
2005-04-17 02:20:36 +04:00
int i ;
dn_setup_model ( ) ;
mach_sched_init = dn_sched_init ; /* */
mach_init_IRQ = dn_init_IRQ ;
mach_hwclk = dn_dummy_hwclk ; /* */
mach_reset = dn_dummy_reset ; /* */
# ifdef CONFIG_HEARTBEAT
mach_heartbeat = dn_heartbeat ;
# endif
mach_get_model = dn_get_model ;
cpuctrl = 0xaa00 ;
/* clear DMA translation table */
for ( i = 0 ; i < 0x400 ; i + + )
addr_xlat_map [ i ] = 0 ;
}
2006-10-07 17:16:45 +04:00
irqreturn_t dn_timer_int ( int irq , void * dev_id )
2006-06-25 16:47:02 +04:00
{
2005-04-17 02:20:36 +04:00
volatile unsigned char x ;
2020-09-24 18:21:00 +03:00
legacy_timer_tick ( 1 ) ;
2020-09-24 17:37:37 +03:00
timer_heartbeat ( ) ;
2005-04-17 02:20:36 +04:00
2012-07-20 23:54:29 +04:00
x = * ( volatile unsigned char * ) ( apollo_timer + 3 ) ;
x = * ( volatile unsigned char * ) ( apollo_timer + 5 ) ;
2005-04-17 02:20:36 +04:00
return IRQ_HANDLED ;
}
2020-09-24 18:29:17 +03:00
void dn_sched_init ( void )
2006-10-07 17:16:45 +04:00
{
2005-04-17 02:20:36 +04:00
/* program timer 1 */
2012-07-20 23:54:29 +04:00
* ( volatile unsigned char * ) ( apollo_timer + 3 ) = 0x01 ;
* ( volatile unsigned char * ) ( apollo_timer + 1 ) = 0x40 ;
* ( volatile unsigned char * ) ( apollo_timer + 5 ) = 0x09 ;
* ( volatile unsigned char * ) ( apollo_timer + 7 ) = 0xc4 ;
2005-04-17 02:20:36 +04:00
/* enable IRQ of PIC B */
* ( volatile unsigned char * ) ( pica + 1 ) & = ( ~ 8 ) ;
#if 0
2014-05-10 14:40:53 +04:00
pr_info ( " *(0x10803) %02x \n " ,
* ( volatile unsigned char * ) ( apollo_timer + 0x3 ) ) ;
pr_info ( " *(0x10803) %02x \n " ,
* ( volatile unsigned char * ) ( apollo_timer + 0x3 ) ) ;
2005-04-17 02:20:36 +04:00
# endif
2020-09-24 18:21:00 +03:00
if ( request_irq ( IRQ_APOLLO , dn_timer_int , 0 , " time " , NULL ) )
2008-12-30 16:01:07 +03:00
pr_err ( " Couldn't register timer interrupt \n " ) ;
2005-04-17 02:20:36 +04:00
}
int dn_dummy_hwclk ( int op , struct rtc_time * t ) {
if ( ! op ) { /* read */
t - > tm_sec = rtc - > second ;
t - > tm_min = rtc - > minute ;
t - > tm_hour = rtc - > hours ;
t - > tm_mday = rtc - > day_of_month ;
t - > tm_wday = rtc - > day_of_week ;
m68k: Fix off-by-one calendar month
This fixes a bug in read_persistent_clock() which causes the system
clock to lag the Real Time Clock by one month. The problem was noticed
on a Mac, but theoretically it must also affect Atari, BVME6000 and Q40.
The tm_mon value in the struct rtc_time passed to mach_hwclk() is
zero-based, and atari_mste_hwclk(), atari_tt_hwclk(), bvme6000_hwclk(),
mac_hwclk() and q40_hwclk() all make this adjustment. Unfortunately,
dn_dummy_hwclk(), mvme147_hwclk(), mvme16x_hwclk(), sun3_hwclk() and
sun3x_hwclk() fail to decrement tm_mon. Also m68328_hwclk() assumes
a one-based tm_mon.
Bring these platforms into line and fix read_persistent_clock() so it
works correctly on all m68k platforms.
The datasheets for the RTC devices found on the affected platforms
all confirm that the year is stored as a value in the range 0-99 and
the month is stored as a value in the range 1-12. Please refer to the
datasheets for MC146818 (Apollo), DS1643 (MVME), ICM7170 (Sun 3)
and M48T02 (Sun 3x).
Reported-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2018-04-23 04:02:57 +03:00
t - > tm_mon = rtc - > month - 1 ;
2005-04-17 02:20:36 +04:00
t - > tm_year = rtc - > year ;
m68k: Fix off-by-one calendar month
This fixes a bug in read_persistent_clock() which causes the system
clock to lag the Real Time Clock by one month. The problem was noticed
on a Mac, but theoretically it must also affect Atari, BVME6000 and Q40.
The tm_mon value in the struct rtc_time passed to mach_hwclk() is
zero-based, and atari_mste_hwclk(), atari_tt_hwclk(), bvme6000_hwclk(),
mac_hwclk() and q40_hwclk() all make this adjustment. Unfortunately,
dn_dummy_hwclk(), mvme147_hwclk(), mvme16x_hwclk(), sun3_hwclk() and
sun3x_hwclk() fail to decrement tm_mon. Also m68328_hwclk() assumes
a one-based tm_mon.
Bring these platforms into line and fix read_persistent_clock() so it
works correctly on all m68k platforms.
The datasheets for the RTC devices found on the affected platforms
all confirm that the year is stored as a value in the range 0-99 and
the month is stored as a value in the range 1-12. Please refer to the
datasheets for MC146818 (Apollo), DS1643 (MVME), ICM7170 (Sun 3)
and M48T02 (Sun 3x).
Reported-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2018-04-23 04:02:57 +03:00
if ( t - > tm_year < 70 )
t - > tm_year + = 100 ;
2005-04-17 02:20:36 +04:00
} else {
rtc - > second = t - > tm_sec ;
rtc - > minute = t - > tm_min ;
rtc - > hours = t - > tm_hour ;
rtc - > day_of_month = t - > tm_mday ;
if ( t - > tm_wday ! = - 1 )
rtc - > day_of_week = t - > tm_wday ;
m68k: Fix off-by-one calendar month
This fixes a bug in read_persistent_clock() which causes the system
clock to lag the Real Time Clock by one month. The problem was noticed
on a Mac, but theoretically it must also affect Atari, BVME6000 and Q40.
The tm_mon value in the struct rtc_time passed to mach_hwclk() is
zero-based, and atari_mste_hwclk(), atari_tt_hwclk(), bvme6000_hwclk(),
mac_hwclk() and q40_hwclk() all make this adjustment. Unfortunately,
dn_dummy_hwclk(), mvme147_hwclk(), mvme16x_hwclk(), sun3_hwclk() and
sun3x_hwclk() fail to decrement tm_mon. Also m68328_hwclk() assumes
a one-based tm_mon.
Bring these platforms into line and fix read_persistent_clock() so it
works correctly on all m68k platforms.
The datasheets for the RTC devices found on the affected platforms
all confirm that the year is stored as a value in the range 0-99 and
the month is stored as a value in the range 1-12. Please refer to the
datasheets for MC146818 (Apollo), DS1643 (MVME), ICM7170 (Sun 3)
and M48T02 (Sun 3x).
Reported-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2018-04-23 04:02:57 +03:00
rtc - > month = t - > tm_mon + 1 ;
rtc - > year = t - > tm_year % 100 ;
2005-04-17 02:20:36 +04:00
}
return 0 ;
}
void dn_dummy_reset ( void ) {
dn_serial_print ( " The end ! \n " ) ;
for ( ; ; ) ;
}
void dn_dummy_waitbut ( void ) {
dn_serial_print ( " waitbut \n " ) ;
}
static void dn_get_model ( char * model )
{
strcpy ( model , " Apollo " ) ;
if ( apollo_model > = APOLLO_DN3000 & & apollo_model < = APOLLO_DN4500 )
strcat ( model , apollo_models [ apollo_model - APOLLO_DN3000 ] ) ;
}
# ifdef CONFIG_HEARTBEAT
static int dn_cpuctrl = 0xff00 ;
static void dn_heartbeat ( int on ) {
if ( on ) {
dn_cpuctrl & = ~ 0x100 ;
cpuctrl = dn_cpuctrl ;
}
else {
dn_cpuctrl & = ~ 0x100 ;
dn_cpuctrl | = 0x100 ;
cpuctrl = dn_cpuctrl ;
}
}
# endif