Commit graph

29 commits

Author SHA1 Message Date
Yang Yingliang
077f5d900f drivers: dio: add missing iounmap() in dio_init()
If kzalloc() fails, iounmap() need be called in error path.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220511064506.3398512-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-19 18:56:51 +02:00
Aleksa Vučković
aafce7bc59 drivers: dio: Missing a blank line after declarations
This patch fixes the checkpatch.pl error:

< WARNING: Missing a blank line after declarations
< #97: FILE: drivers/dio/dio.c:97:
< +     unsigned int i;
< +     for (i = 0; i < ARRAY_SIZE(names); i++)

Signed-off-by: Aleksa Vučković <aleksav013@gmail.com>
Link: https://lore.kernel.org/r/20220127135054.27281-7-aleksav013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04 16:45:39 +01:00
Aleksa Vučković
dffae938c0 drivers: dio: code indent should use tabs
This patch fixes the checkpatch.pl error:

< ERROR: code indent should use tabs where possible
< #61: FILE: drivers/dio/dio.c:61:
< +        int id;$
<
< WARNING: please, no spaces at the start of a line
< #61: FILE: drivers/dio/dio.c:61:
< +        int id;$
<
< ERROR: code indent should use tabs where possible
< #62: FILE: drivers/dio/dio.c:62:
< +        const char *name;$
<
< WARNING: please, no spaces at the start of a line
< #62: FILE: drivers/dio/dio.c:62:
< +        const char *name;$

+ 44 more errors of type "code indent should use tabs where
possible"
+ 41 more warnings of type "please, no spaces at the start of a
line"

Signed-off-by: Aleksa Vučković <aleksav013@gmail.com>
Link: https://lore.kernel.org/r/20220127135054.27281-6-aleksav013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04 16:45:39 +01:00
Aleksa Vučković
f8b187c254 drivers: dio: space required after that ','
This patch fixes the checkpatch.pl error:

< ERROR: space required after that ',' (ctx:VxV)
< #239: FILE: drivers/dio/dio.c:239:
< +                strcpy(dev->name,dio_getname(dev->id));

Signed-off-by: Aleksa Vučković <aleksav013@gmail.com>
Link: https://lore.kernel.org/r/20220127135054.27281-5-aleksav013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04 16:45:39 +01:00
Aleksa Vučković
c3c6138589 drivers: dio: space prohibited after parenthesis
This patch fixes the checkpatch.pl error:

< ERROR: space prohibited after that open parenthesis '('
< #67: FILE: drivers/dio/dio.c:67:
< +#define DIOFBNAME(x) { DIO_ENCODE_ID( DIO_ID_FBUFFER, DIO_ID2_##x),
DIO_DESC2_##x }

Signed-off-by: Aleksa Vučković <aleksav013@gmail.com>
Link: https://lore.kernel.org/r/20220127135054.27281-4-aleksav013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04 16:45:39 +01:00
Aleksa Vučković
7649cb6f3d drivers: dio: trailing whitespace
This patch fixes the checkpatch.pl errors and warnings:

< ERROR: trailing whitespace
< #5: FILE: drivers/dio/dio.c:5:
< + * $
<
< ERROR: trailing whitespace
< #11: FILE: drivers/dio/dio.c:11:
< + *    This means that framebuffers should pass it as $
<
< ERROR: trailing whitespace
< #17: FILE: drivers/dio/dio.c:17:
< + *    Every DIO card has a fixed interrupt priority level. This
function $
<
< ERROR: trailing whitespace
< #20: FILE: drivers/dio/dio.c:20:
< + *    Return a character string describing this board [might be "" if
$
<
< ERROR: trailing whitespace
< #25: FILE: drivers/dio/dio.c:25:
< + * This file is based on the way the Amiga port handles Zorro II
cards, $

+ 15 more errors and warnings of type "trailing whitespace"

Signed-off-by: Aleksa Vučković <aleksav013@gmail.com>
Link: https://lore.kernel.org/r/20220127135054.27281-3-aleksav013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04 16:45:39 +01:00
Aleksa Vučković
8a4606c642 drivers: dio: brace should be on the previous line
This patch fixes the checkpatch.pl errors and warnings:

< ERROR: open brace '{' following struct go on the same line
< +struct dioname
< +{
<
< ERROR: that open brace { should be on the previous line
< +static struct dioname names[] =
< +{
<
< ERROR: that open brace { should be on the previous line
< +        for (scode = 0; scode < DIO_SCMAX; ++scode)
< +        {
<
< WARNING: braces {} are not necessary for any arm of this statement
< +        if (scode >= DIOII_SCBASE) {
< [...]
< +        } else if (scode > DIO_SCMAX || scode < 0)
< [...]
< +        else if (DIO_SCINHOLE(scode))
< [...]

Signed-off-by: Aleksa Vučković <aleksav013@gmail.com>
Link: https://lore.kernel.org/r/20220127135054.27281-2-aleksav013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04 16:45:39 +01:00
Aleksa Vučković
10f4629f85 drivers: dio: Use <linux/io.h> instead <asm/io.h>
This patch fixes the checkpatch.pl warning:

< WARNING: Use #include <linux/io.h> instead of <asm/io.h>
< #36: FILE: drivers/dio/dio.c:36:
< +#include <asm/io.h>                             /* readb() */

Signed-off-by: Aleksa Vučković <aleksav013@gmail.com>
Link: https://lore.kernel.org/r/20220127135054.27281-1-aleksav013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04 16:45:39 +01:00
Salah Triki
d1d26f40f7 dio: return -ENOMEM when kzalloc() fails
Return -ENOMEM when kzalloc() fails in order to inform the caller of the
failure.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
Link: https://lore.kernel.org/r/20210702133114.GA314157@pc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-21 15:53:24 +02:00
Christoph Hellwig
fe557319aa maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault
Better describe what these functions do.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-17 10:57:41 -07:00
Geert Uytterhoeven
b87c9661bf dio: Fix dio_bus_match() kerneldoc
The kerneldoc for dio_bus_match() was obviously copied from
dio_match_device(), but wasnt't updated for the different calling
context and semantics.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20200112165613.20960-3-geert@linux-m68k.org
2020-03-09 11:12:19 +01:00
Geert Uytterhoeven
b387575933 dio: Make dio_match_device() static
Unlike its PCI counterpart, dio_match_device() was never used outside
the DIO bus code.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20200112165613.20960-2-geert@linux-m68k.org
2020-03-09 11:12:19 +01:00
Thomas Gleixner
ec8f24b7fa treewide: Add SPDX license identifier - Makefile/Kconfig
Add SPDX license identifiers to all Make/Kconfig files which:

 - Have no license information of any form

These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:

  GPL-2.0-only

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 10:50:46 +02:00
Geert Uytterhoeven
627f192d1e dio: Fix buffer overflow in case of unknown board
With gcc 8.2.0:

    drivers/dio/dio.c: In function ‘dio_init’:
    drivers/dio/dio.c:240:17: warning: ‘strcpy’ writing 69 or more bytes into a region of size 64 overflows the destination [-Wstringop-overflow=]
		     strcpy(dev->name,dio_getname(dev->id));
		     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Indeed, if an unknown board is present, the target buffer will overflow.
Shorten the unknown board name string to fix this, and declare it as an
array while at it.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2019-01-21 10:36:53 +01:00
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
Al Viro
c02205e9f3 dio: use probe_kernel_read()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27 15:41:45 -04:00
Linus Torvalds
7c0f6ba682 Replace <asm/uaccess.h> with <linux/uaccess.h> globally
This was entirely automated, using the script by Al:

  PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
  sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
        $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

to do the replacement at the end of the merge window.

Requested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-24 11:46:01 -08:00
Stephen Rothwell
f699b7f351 m68k: don't export static inline functions
These now cause errors due to changes present in linux-next:

(__ksymtab_sorted+0x1258): undefined reference to `dio_dev_driver'
(__ksymtab_sorted+0x4d48): undefined reference to `zorro_dev_driver'

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2009-12-06 11:18:28 +01:00
Kay Sievers
9591463af7 dio: struct device - replace bus_id with dev_name(), dev_set_name()
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
2009-03-24 16:38:22 -07:00
Geert Uytterhoeven
fae3306ac0 m68k: dio - Kill resource_size_t format warnings
warning: format '%08lx' expects type 'long unsigned int', but argument 3 has
type 'resource_size_t'

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2009-01-12 20:56:42 +01:00
Geert Uytterhoeven
2e4c77bea3 m68k: dio - Kill warn_unused_result warnings
warning: ignoring return value of 'device_register', declared with attribute
warn_unused_result
warning: ignoring return value of 'device_create_file', declared with
attribute warn_unused_result

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2009-01-12 20:56:41 +01:00
Akinobu Mita
18c993629a dio: use dio_match_device() in dio_bus_match()
dio_bus_match() can use dio_match_device().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-20 17:24:40 -07:00
Alejandro Martinez Ruiz
0a8320b04c dio: ARRAY_SIZE() cleanup
[Geert: eliminate NUMNAMES, as suggested by Richard Knutsson ]
[akpm@linux-foundation.org: coding-syle fixes]
Signed-off-by: Alejandro Martinez Ruiz <alex@flawedcode.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Richard Knutsson <ricknu-0@student.ltu.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-05 09:44:23 -08:00
Randy Dunlap
771fcb58e5 dio: fix kernel-doc notation
Fix kernel-doc in drivers/dio/ so that it is formatted correctly
and the parameter names match the function parameters.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-By: Jochen Friedrich <jochen@scram.de>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
2008-02-03 16:29:12 +02:00
Bjorn Helgaas
e51c01b084 [PATCH] hp300: fix driver_register() return handling, remove dio_module_init()
Remove the assumption that driver_register() returns the number of devices
bound to the driver.  In fact, it returns zero for success or a negative
error value.

dio_module_init() used the device count to automatically unregister and
unload drivers that found no devices.  That might have worked at one time,
but has been broken for some time because dio_register_driver() returned
either a negative error or a positive count (never zero).  So it could only
unregister on failure, when it's not needed anyway.

This functionality could be resurrected in individual drivers by counting
devices in their .probe() methods.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Philip Blundell <philb@gnu.org>
Cc: Jochen Friedrich <jochen@scram.de>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-25 08:22:53 -08:00
Russell King
5b34bf8877 [PATCH] Add dio_bus_type probe and remove methods
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-13 11:26:07 -08:00
Deepak Saxena
e66860cbda [PATCH] drivers/dio: kmalloc + memset -> kzalloc conversion
Signed-off-by: Deepak Saxena <dsaxena@plexity.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 07:53:59 -08:00
Yani Ioannou
74880c063b [PATCH] Driver Core: drivers/base - drivers/i2c/chips/adm1026.c: update device attribute callbacks
Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20 15:15:32 -07:00
Linus Torvalds
1da177e4c3 Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
2005-04-16 15:20:36 -07:00