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 08:07:57 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-16 16:20:36 -06:00
|
|
|
/* Sysctl interface for parport devices.
|
|
|
|
*
|
2006-06-26 10:19:23 -06:00
|
|
|
* Authors: David Campbell
|
2005-04-16 16:20:36 -06:00
|
|
|
* Tim Waugh <tim@cyberelk.demon.co.uk>
|
|
|
|
* Philip Blundell <philb@gnu.org>
|
|
|
|
* Andrea Arcangeli
|
|
|
|
* Riccardo Facchetti <fizban@tin.it>
|
|
|
|
*
|
|
|
|
* based on work by Grant Guenther <grant@torque.net>
|
|
|
|
* and Philip Blundell
|
|
|
|
*
|
|
|
|
* Cleaned up include files - Russell King <linux@arm.uk.linux.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/parport.h>
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <linux/sysctl.h>
|
2015-05-20 09:26:57 -06:00
|
|
|
#include <linux/device.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2016-12-24 12:46:01 -07:00
|
|
|
#include <linux/uaccess.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)
|
|
|
|
|
|
|
|
#define PARPORT_MIN_TIMESLICE_VALUE 1ul
|
|
|
|
#define PARPORT_MAX_TIMESLICE_VALUE ((unsigned long) HZ)
|
|
|
|
#define PARPORT_MIN_SPINTIME_VALUE 1
|
|
|
|
#define PARPORT_MAX_SPINTIME_VALUE 1000
|
|
|
|
|
2014-06-06 15:37:58 -06:00
|
|
|
static int do_active_device(struct ctl_table *table, int write,
|
2005-04-16 16:20:36 -06:00
|
|
|
void __user *result, size_t *lenp, loff_t *ppos)
|
|
|
|
{
|
|
|
|
struct parport *port = (struct parport *)table->extra1;
|
|
|
|
char buffer[256];
|
|
|
|
struct pardevice *dev;
|
|
|
|
int len = 0;
|
|
|
|
|
|
|
|
if (write) /* can't happen anyway */
|
|
|
|
return -EACCES;
|
|
|
|
|
|
|
|
if (*ppos) {
|
|
|
|
*lenp = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (dev = port->devices; dev ; dev = dev->next) {
|
|
|
|
if(dev == port->cad) {
|
|
|
|
len += sprintf(buffer, "%s\n", dev->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!len) {
|
|
|
|
len += sprintf(buffer, "%s\n", "none");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len > *lenp)
|
|
|
|
len = *lenp;
|
|
|
|
else
|
|
|
|
*lenp = len;
|
|
|
|
|
|
|
|
*ppos += len;
|
|
|
|
|
|
|
|
return copy_to_user(result, buffer, len) ? -EFAULT : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_PARPORT_1284
|
2014-06-06 15:37:58 -06:00
|
|
|
static int do_autoprobe(struct ctl_table *table, int write,
|
2005-04-16 16:20:36 -06:00
|
|
|
void __user *result, size_t *lenp, loff_t *ppos)
|
|
|
|
{
|
|
|
|
struct parport_device_info *info = table->extra2;
|
|
|
|
const char *str;
|
|
|
|
char buffer[256];
|
|
|
|
int len = 0;
|
|
|
|
|
|
|
|
if (write) /* permissions stop this */
|
|
|
|
return -EACCES;
|
|
|
|
|
|
|
|
if (*ppos) {
|
|
|
|
*lenp = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((str = info->class_name) != NULL)
|
|
|
|
len += sprintf (buffer + len, "CLASS:%s;\n", str);
|
|
|
|
|
|
|
|
if ((str = info->model) != NULL)
|
|
|
|
len += sprintf (buffer + len, "MODEL:%s;\n", str);
|
|
|
|
|
|
|
|
if ((str = info->mfr) != NULL)
|
|
|
|
len += sprintf (buffer + len, "MANUFACTURER:%s;\n", str);
|
|
|
|
|
|
|
|
if ((str = info->description) != NULL)
|
|
|
|
len += sprintf (buffer + len, "DESCRIPTION:%s;\n", str);
|
|
|
|
|
|
|
|
if ((str = info->cmdset) != NULL)
|
|
|
|
len += sprintf (buffer + len, "COMMAND SET:%s;\n", str);
|
|
|
|
|
|
|
|
if (len > *lenp)
|
|
|
|
len = *lenp;
|
|
|
|
else
|
|
|
|
*lenp = len;
|
|
|
|
|
|
|
|
*ppos += len;
|
|
|
|
|
|
|
|
return copy_to_user (result, buffer, len) ? -EFAULT : 0;
|
|
|
|
}
|
|
|
|
#endif /* IEEE1284.3 support. */
|
|
|
|
|
2014-06-06 15:37:58 -06:00
|
|
|
static int do_hardware_base_addr(struct ctl_table *table, int write,
|
|
|
|
void __user *result,
|
|
|
|
size_t *lenp, loff_t *ppos)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
struct parport *port = (struct parport *)table->extra1;
|
|
|
|
char buffer[20];
|
|
|
|
int len = 0;
|
|
|
|
|
|
|
|
if (*ppos) {
|
|
|
|
*lenp = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (write) /* permissions prevent this anyway */
|
|
|
|
return -EACCES;
|
|
|
|
|
|
|
|
len += sprintf (buffer, "%lu\t%lu\n", port->base, port->base_hi);
|
|
|
|
|
|
|
|
if (len > *lenp)
|
|
|
|
len = *lenp;
|
|
|
|
else
|
|
|
|
*lenp = len;
|
|
|
|
|
|
|
|
*ppos += len;
|
|
|
|
|
|
|
|
return copy_to_user(result, buffer, len) ? -EFAULT : 0;
|
|
|
|
}
|
|
|
|
|
2014-06-06 15:37:58 -06:00
|
|
|
static int do_hardware_irq(struct ctl_table *table, int write,
|
|
|
|
void __user *result,
|
|
|
|
size_t *lenp, loff_t *ppos)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
struct parport *port = (struct parport *)table->extra1;
|
|
|
|
char buffer[20];
|
|
|
|
int len = 0;
|
|
|
|
|
|
|
|
if (*ppos) {
|
|
|
|
*lenp = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (write) /* permissions prevent this anyway */
|
|
|
|
return -EACCES;
|
|
|
|
|
|
|
|
len += sprintf (buffer, "%d\n", port->irq);
|
|
|
|
|
|
|
|
if (len > *lenp)
|
|
|
|
len = *lenp;
|
|
|
|
else
|
|
|
|
*lenp = len;
|
|
|
|
|
|
|
|
*ppos += len;
|
|
|
|
|
|
|
|
return copy_to_user(result, buffer, len) ? -EFAULT : 0;
|
|
|
|
}
|
|
|
|
|
2014-06-06 15:37:58 -06:00
|
|
|
static int do_hardware_dma(struct ctl_table *table, int write,
|
|
|
|
void __user *result,
|
|
|
|
size_t *lenp, loff_t *ppos)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
struct parport *port = (struct parport *)table->extra1;
|
|
|
|
char buffer[20];
|
|
|
|
int len = 0;
|
|
|
|
|
|
|
|
if (*ppos) {
|
|
|
|
*lenp = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (write) /* permissions prevent this anyway */
|
|
|
|
return -EACCES;
|
|
|
|
|
|
|
|
len += sprintf (buffer, "%d\n", port->dma);
|
|
|
|
|
|
|
|
if (len > *lenp)
|
|
|
|
len = *lenp;
|
|
|
|
else
|
|
|
|
*lenp = len;
|
|
|
|
|
|
|
|
*ppos += len;
|
|
|
|
|
|
|
|
return copy_to_user(result, buffer, len) ? -EFAULT : 0;
|
|
|
|
}
|
|
|
|
|
2014-06-06 15:37:58 -06:00
|
|
|
static int do_hardware_modes(struct ctl_table *table, int write,
|
|
|
|
void __user *result,
|
|
|
|
size_t *lenp, loff_t *ppos)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
struct parport *port = (struct parport *)table->extra1;
|
|
|
|
char buffer[40];
|
|
|
|
int len = 0;
|
|
|
|
|
|
|
|
if (*ppos) {
|
|
|
|
*lenp = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (write) /* permissions prevent this anyway */
|
|
|
|
return -EACCES;
|
|
|
|
|
|
|
|
{
|
|
|
|
#define printmode(x) {if(port->modes&PARPORT_MODE_##x){len+=sprintf(buffer+len,"%s%s",f?",":"",#x);f++;}}
|
|
|
|
int f = 0;
|
|
|
|
printmode(PCSPP);
|
|
|
|
printmode(TRISTATE);
|
|
|
|
printmode(COMPAT);
|
|
|
|
printmode(EPP);
|
|
|
|
printmode(ECP);
|
|
|
|
printmode(DMA);
|
|
|
|
#undef printmode
|
|
|
|
}
|
|
|
|
buffer[len++] = '\n';
|
|
|
|
|
|
|
|
if (len > *lenp)
|
|
|
|
len = *lenp;
|
|
|
|
else
|
|
|
|
*lenp = len;
|
|
|
|
|
|
|
|
*ppos += len;
|
|
|
|
|
|
|
|
return copy_to_user(result, buffer, len) ? -EFAULT : 0;
|
|
|
|
}
|
|
|
|
|
2009-11-05 15:34:02 -07:00
|
|
|
#define PARPORT_PORT_DIR(CHILD) { .procname = NULL, .mode = 0555, .child = CHILD }
|
|
|
|
#define PARPORT_PARPORT_DIR(CHILD) { .procname = "parport", \
|
2007-02-14 01:33:54 -07:00
|
|
|
.mode = 0555, .child = CHILD }
|
2009-11-05 15:34:02 -07:00
|
|
|
#define PARPORT_DEV_DIR(CHILD) { .procname = "dev", .mode = 0555, .child = CHILD }
|
2007-10-18 04:05:30 -06:00
|
|
|
#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \
|
2007-02-14 01:33:54 -07:00
|
|
|
.mode = 0555, .child = NULL }
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
static const unsigned long parport_min_timeslice_value =
|
|
|
|
PARPORT_MIN_TIMESLICE_VALUE;
|
|
|
|
|
|
|
|
static const unsigned long parport_max_timeslice_value =
|
|
|
|
PARPORT_MAX_TIMESLICE_VALUE;
|
|
|
|
|
|
|
|
static const int parport_min_spintime_value =
|
|
|
|
PARPORT_MIN_SPINTIME_VALUE;
|
|
|
|
|
|
|
|
static const int parport_max_spintime_value =
|
|
|
|
PARPORT_MAX_SPINTIME_VALUE;
|
|
|
|
|
|
|
|
|
|
|
|
struct parport_sysctl_table {
|
|
|
|
struct ctl_table_header *sysctl_header;
|
2014-06-06 15:37:58 -06:00
|
|
|
struct ctl_table vars[12];
|
|
|
|
struct ctl_table device_dir[2];
|
|
|
|
struct ctl_table port_dir[2];
|
|
|
|
struct ctl_table parport_dir[2];
|
|
|
|
struct ctl_table dev_dir[2];
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct parport_sysctl_table parport_sysctl_template = {
|
2007-02-14 01:33:54 -07:00
|
|
|
.sysctl_header = NULL,
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2007-02-14 01:33:54 -07:00
|
|
|
{
|
|
|
|
.procname = "spintime",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = sizeof(int),
|
|
|
|
.mode = 0644,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = proc_dointvec_minmax,
|
2007-02-14 01:33:54 -07:00
|
|
|
.extra1 = (void*) &parport_min_spintime_value,
|
|
|
|
.extra2 = (void*) &parport_max_spintime_value
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.procname = "base-addr",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_hardware_base_addr
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.procname = "irq",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_hardware_irq
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.procname = "dma",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_hardware_dma
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.procname = "modes",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_hardware_modes
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
2005-04-16 16:20:36 -06:00
|
|
|
PARPORT_DEVICES_ROOT_DIR,
|
|
|
|
#ifdef CONFIG_PARPORT_1284
|
2007-02-14 01:33:54 -07:00
|
|
|
{
|
|
|
|
.procname = "autoprobe",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_autoprobe
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.procname = "autoprobe0",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_autoprobe
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.procname = "autoprobe1",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_autoprobe
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.procname = "autoprobe2",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_autoprobe
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.procname = "autoprobe3",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_autoprobe
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
2005-04-16 16:20:36 -06:00
|
|
|
#endif /* IEEE 1284 support */
|
2007-02-14 01:33:54 -07:00
|
|
|
{}
|
2005-04-16 16:20:36 -06:00
|
|
|
},
|
2007-02-14 01:33:54 -07:00
|
|
|
{
|
|
|
|
{
|
|
|
|
.procname = "active",
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0444,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = do_active_device
|
2007-02-14 01:33:54 -07:00
|
|
|
},
|
|
|
|
{}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
PARPORT_PORT_DIR(NULL),
|
|
|
|
{}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
PARPORT_PARPORT_DIR(NULL),
|
|
|
|
{}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
PARPORT_DEV_DIR(NULL),
|
|
|
|
{}
|
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct parport_device_sysctl_table
|
|
|
|
{
|
|
|
|
struct ctl_table_header *sysctl_header;
|
2014-06-06 15:37:58 -06:00
|
|
|
struct ctl_table vars[2];
|
|
|
|
struct ctl_table device_dir[2];
|
|
|
|
struct ctl_table devices_root_dir[2];
|
|
|
|
struct ctl_table port_dir[2];
|
|
|
|
struct ctl_table parport_dir[2];
|
|
|
|
struct ctl_table dev_dir[2];
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct parport_device_sysctl_table
|
|
|
|
parport_device_sysctl_template = {
|
2007-02-14 01:33:54 -07:00
|
|
|
.sysctl_header = NULL,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.procname = "timeslice",
|
|
|
|
.data = NULL,
|
2007-12-17 17:19:51 -07:00
|
|
|
.maxlen = sizeof(unsigned long),
|
2007-02-14 01:33:54 -07:00
|
|
|
.mode = 0644,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = proc_doulongvec_ms_jiffies_minmax,
|
2007-02-14 01:33:54 -07:00
|
|
|
.extra1 = (void*) &parport_min_timeslice_value,
|
|
|
|
.extra2 = (void*) &parport_max_timeslice_value
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.procname = NULL,
|
|
|
|
.data = NULL,
|
|
|
|
.maxlen = 0,
|
|
|
|
.mode = 0555,
|
|
|
|
.child = NULL
|
|
|
|
},
|
|
|
|
{}
|
|
|
|
},
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2007-02-14 01:33:54 -07:00
|
|
|
PARPORT_DEVICES_ROOT_DIR,
|
|
|
|
{}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
PARPORT_PORT_DIR(NULL),
|
|
|
|
{}
|
2005-04-16 16:20:36 -06:00
|
|
|
},
|
2007-02-14 01:33:54 -07:00
|
|
|
{
|
|
|
|
PARPORT_PARPORT_DIR(NULL),
|
|
|
|
{}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
PARPORT_DEV_DIR(NULL),
|
|
|
|
{}
|
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct parport_default_sysctl_table
|
|
|
|
{
|
|
|
|
struct ctl_table_header *sysctl_header;
|
2014-06-06 15:37:58 -06:00
|
|
|
struct ctl_table vars[3];
|
|
|
|
struct ctl_table default_dir[2];
|
|
|
|
struct ctl_table parport_dir[2];
|
|
|
|
struct ctl_table dev_dir[2];
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct parport_default_sysctl_table
|
|
|
|
parport_default_sysctl_table = {
|
2007-02-14 01:33:54 -07:00
|
|
|
.sysctl_header = NULL,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.procname = "timeslice",
|
|
|
|
.data = &parport_default_timeslice,
|
|
|
|
.maxlen = sizeof(parport_default_timeslice),
|
|
|
|
.mode = 0644,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = proc_doulongvec_ms_jiffies_minmax,
|
2007-02-14 01:33:54 -07:00
|
|
|
.extra1 = (void*) &parport_min_timeslice_value,
|
|
|
|
.extra2 = (void*) &parport_max_timeslice_value
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.procname = "spintime",
|
|
|
|
.data = &parport_default_spintime,
|
|
|
|
.maxlen = sizeof(parport_default_spintime),
|
|
|
|
.mode = 0644,
|
2009-11-16 04:11:48 -07:00
|
|
|
.proc_handler = proc_dointvec_minmax,
|
2007-02-14 01:33:54 -07:00
|
|
|
.extra1 = (void*) &parport_min_spintime_value,
|
|
|
|
.extra2 = (void*) &parport_max_spintime_value
|
|
|
|
},
|
|
|
|
{}
|
|
|
|
},
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2007-02-14 01:33:54 -07:00
|
|
|
{
|
|
|
|
.procname = "default",
|
|
|
|
.mode = 0555,
|
|
|
|
.child = parport_default_sysctl_table.vars
|
|
|
|
},
|
|
|
|
{}
|
2005-04-16 16:20:36 -06:00
|
|
|
},
|
|
|
|
{
|
2007-02-14 01:33:54 -07:00
|
|
|
PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir),
|
|
|
|
{}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir),
|
|
|
|
{}
|
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int parport_proc_register(struct parport *port)
|
|
|
|
{
|
|
|
|
struct parport_sysctl_table *t;
|
|
|
|
int i;
|
|
|
|
|
2013-03-11 10:39:22 -06:00
|
|
|
t = kmemdup(&parport_sysctl_template, sizeof(*t), GFP_KERNEL);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (t == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
t->device_dir[0].extra1 = port;
|
|
|
|
|
2007-10-18 04:05:30 -06:00
|
|
|
for (i = 0; i < 5; i++)
|
2005-04-16 16:20:36 -06:00
|
|
|
t->vars[i].extra1 = port;
|
|
|
|
|
|
|
|
t->vars[0].data = &port->spintime;
|
|
|
|
t->vars[5].child = t->device_dir;
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
t->vars[6 + i].extra2 = &port->probe_info[i];
|
|
|
|
|
|
|
|
t->port_dir[0].procname = port->name;
|
|
|
|
|
|
|
|
t->port_dir[0].child = t->vars;
|
|
|
|
t->parport_dir[0].child = t->port_dir;
|
|
|
|
t->dev_dir[0].child = t->parport_dir;
|
|
|
|
|
2007-02-14 01:34:09 -07:00
|
|
|
t->sysctl_header = register_sysctl_table(t->dev_dir);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (t->sysctl_header == NULL) {
|
|
|
|
kfree(t);
|
|
|
|
t = NULL;
|
|
|
|
}
|
|
|
|
port->sysctl_table = t;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int parport_proc_unregister(struct parport *port)
|
|
|
|
{
|
|
|
|
if (port->sysctl_table) {
|
|
|
|
struct parport_sysctl_table *t = port->sysctl_table;
|
|
|
|
port->sysctl_table = NULL;
|
|
|
|
unregister_sysctl_table(t->sysctl_header);
|
|
|
|
kfree(t);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int parport_device_proc_register(struct pardevice *device)
|
|
|
|
{
|
|
|
|
struct parport_device_sysctl_table *t;
|
|
|
|
struct parport * port = device->port;
|
|
|
|
|
2013-03-11 10:39:22 -06:00
|
|
|
t = kmemdup(&parport_device_sysctl_template, sizeof(*t), GFP_KERNEL);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (t == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
t->dev_dir[0].child = t->parport_dir;
|
|
|
|
t->parport_dir[0].child = t->port_dir;
|
|
|
|
t->port_dir[0].procname = port->name;
|
|
|
|
t->port_dir[0].child = t->devices_root_dir;
|
|
|
|
t->devices_root_dir[0].child = t->device_dir;
|
|
|
|
|
|
|
|
t->device_dir[0].procname = device->name;
|
|
|
|
t->device_dir[0].child = t->vars;
|
|
|
|
t->vars[0].data = &device->timeslice;
|
|
|
|
|
2007-02-14 01:34:09 -07:00
|
|
|
t->sysctl_header = register_sysctl_table(t->dev_dir);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (t->sysctl_header == NULL) {
|
|
|
|
kfree(t);
|
|
|
|
t = NULL;
|
|
|
|
}
|
|
|
|
device->sysctl_table = t;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int parport_device_proc_unregister(struct pardevice *device)
|
|
|
|
{
|
|
|
|
if (device->sysctl_table) {
|
|
|
|
struct parport_device_sysctl_table *t = device->sysctl_table;
|
|
|
|
device->sysctl_table = NULL;
|
|
|
|
unregister_sysctl_table(t->sysctl_header);
|
|
|
|
kfree(t);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int __init parport_default_proc_register(void)
|
|
|
|
{
|
2015-05-20 09:26:57 -06:00
|
|
|
int ret;
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
parport_default_sysctl_table.sysctl_header =
|
2007-02-14 01:34:09 -07:00
|
|
|
register_sysctl_table(parport_default_sysctl_table.dev_dir);
|
2015-05-20 09:26:57 -06:00
|
|
|
if (!parport_default_sysctl_table.sysctl_header)
|
|
|
|
return -ENOMEM;
|
|
|
|
ret = parport_bus_init();
|
|
|
|
if (ret) {
|
|
|
|
unregister_sysctl_table(parport_default_sysctl_table.
|
|
|
|
sysctl_header);
|
|
|
|
return ret;
|
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit parport_default_proc_unregister(void)
|
|
|
|
{
|
|
|
|
if (parport_default_sysctl_table.sysctl_header) {
|
|
|
|
unregister_sysctl_table(parport_default_sysctl_table.
|
|
|
|
sysctl_header);
|
|
|
|
parport_default_sysctl_table.sysctl_header = NULL;
|
|
|
|
}
|
2015-05-20 09:26:57 -06:00
|
|
|
parport_bus_exit();
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#else /* no sysctl or no procfs*/
|
|
|
|
|
|
|
|
int parport_proc_register(struct parport *pp)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int parport_proc_unregister(struct parport *pp)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int parport_device_proc_register(struct pardevice *device)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int parport_device_proc_unregister(struct pardevice *device)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int __init parport_default_proc_register (void)
|
|
|
|
{
|
2015-05-20 09:26:57 -06:00
|
|
|
return parport_bus_init();
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit parport_default_proc_unregister (void)
|
|
|
|
{
|
2015-05-20 09:26:57 -06:00
|
|
|
parport_bus_exit();
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-04-12 09:26:10 -06:00
|
|
|
subsys_initcall(parport_default_proc_register)
|
2005-04-16 16:20:36 -06:00
|
|
|
module_exit(parport_default_proc_unregister)
|