Commit 25398a15 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Linus Torvalds

sysctl: parport remove binary paths

The sysctl binary paths don't look as if they even code work, .data is not
filled in, and all of the proc_handlers look at extra1 and there is not
strategy routine.

So just kill the binary paths.

In addition this patch removes the setting of extra1 on directories.  It
doesn't look like the parport code ever examines it, and it's bad sysctl form.

[bunk@kernel.org: remove parport_device_num()]
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0d135a4a
...@@ -25,7 +25,6 @@ Global functions: ...@@ -25,7 +25,6 @@ Global functions:
parport_open parport_open
parport_close parport_close
parport_device_id parport_device_id
parport_device_num
parport_device_coords parport_device_coords
parport_find_class parport_find_class
parport_find_device parport_find_device
...@@ -735,7 +734,7 @@ NULL is returned. ...@@ -735,7 +734,7 @@ NULL is returned.
SEE ALSO SEE ALSO
parport_register_device, parport_device_num parport_register_device
parport_close - unregister device for particular device number parport_close - unregister device for particular device number
------------- -------------
...@@ -787,29 +786,7 @@ Many devices have ill-formed IEEE 1284 Device IDs. ...@@ -787,29 +786,7 @@ Many devices have ill-formed IEEE 1284 Device IDs.
SEE ALSO SEE ALSO
parport_find_class, parport_find_device, parport_device_num parport_find_class, parport_find_device
parport_device_num - convert device coordinates to device number
------------------
SYNOPSIS
#include <linux/parport.h>
int parport_device_num (int parport, int mux, int daisy);
DESCRIPTION
Convert between device coordinates (port, multiplexor, daisy chain
address) and device number (zero-based).
RETURN VALUE
Device number, or -1 if no device at given coordinates.
SEE ALSO
parport_device_coords, parport_open, parport_device_id
parport_device_coords - convert device number to device coordinates parport_device_coords - convert device number to device coordinates
------------------ ------------------
...@@ -833,7 +810,7 @@ Zero on success, in which case the coordinates are (*parport, *mux, ...@@ -833,7 +810,7 @@ Zero on success, in which case the coordinates are (*parport, *mux,
SEE ALSO SEE ALSO
parport_device_num, parport_open, parport_device_id parport_open, parport_device_id
parport_find_class - find a device by its class parport_find_class - find a device by its class
------------------ ------------------
......
...@@ -275,35 +275,6 @@ void parport_close(struct pardevice *dev) ...@@ -275,35 +275,6 @@ void parport_close(struct pardevice *dev)
parport_unregister_device(dev); parport_unregister_device(dev);
} }
/**
* parport_device_num - convert device coordinates
* @parport: parallel port number
* @mux: multiplexor port number (-1 for no multiplexor)
* @daisy: daisy chain address (-1 for no daisy chain address)
*
* This tries to locate a device on the given parallel port,
* multiplexor port and daisy chain address, and returns its
* device number or %-ENXIO if no device with those coordinates
* exists.
**/
int parport_device_num(int parport, int mux, int daisy)
{
int res = -ENXIO;
struct daisydev *dev;
spin_lock(&topology_lock);
dev = topology;
while (dev && dev->port->portnum != parport &&
dev->port->muxport != mux && dev->daisy != daisy)
dev = dev->next;
if (dev)
res = dev->devnum;
spin_unlock(&topology_lock);
return res;
}
/* Send a daisy-chain-style CPP command packet. */ /* Send a daisy-chain-style CPP command packet. */
static int cpp_daisy(struct parport *port, int cmd) static int cpp_daisy(struct parport *port, int cmd)
{ {
......
...@@ -237,7 +237,7 @@ static int do_hardware_modes (ctl_table *table, int write, ...@@ -237,7 +237,7 @@ static int do_hardware_modes (ctl_table *table, int write,
#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \ #define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \
.mode = 0555, .child = CHILD } .mode = 0555, .child = CHILD }
#define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD } #define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD }
#define PARPORT_DEVICES_ROOT_DIR { .ctl_name = DEV_PARPORT_DEVICES, .procname = "devices", \ #define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \
.mode = 0555, .child = NULL } .mode = 0555, .child = NULL }
static const unsigned long parport_min_timeslice_value = static const unsigned long parport_min_timeslice_value =
...@@ -266,7 +266,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -266,7 +266,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.sysctl_header = NULL, .sysctl_header = NULL,
{ {
{ {
.ctl_name = DEV_PARPORT_SPINTIME,
.procname = "spintime", .procname = "spintime",
.data = NULL, .data = NULL,
.maxlen = sizeof(int), .maxlen = sizeof(int),
...@@ -276,7 +275,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -276,7 +275,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.extra2 = (void*) &parport_max_spintime_value .extra2 = (void*) &parport_max_spintime_value
}, },
{ {
.ctl_name = DEV_PARPORT_BASE_ADDR,
.procname = "base-addr", .procname = "base-addr",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -284,7 +282,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -284,7 +282,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_hardware_base_addr .proc_handler = &do_hardware_base_addr
}, },
{ {
.ctl_name = DEV_PARPORT_IRQ,
.procname = "irq", .procname = "irq",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -292,7 +289,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -292,7 +289,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_hardware_irq .proc_handler = &do_hardware_irq
}, },
{ {
.ctl_name = DEV_PARPORT_DMA,
.procname = "dma", .procname = "dma",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -300,7 +296,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -300,7 +296,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_hardware_dma .proc_handler = &do_hardware_dma
}, },
{ {
.ctl_name = DEV_PARPORT_MODES,
.procname = "modes", .procname = "modes",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -310,7 +305,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -310,7 +305,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
PARPORT_DEVICES_ROOT_DIR, PARPORT_DEVICES_ROOT_DIR,
#ifdef CONFIG_PARPORT_1284 #ifdef CONFIG_PARPORT_1284
{ {
.ctl_name = DEV_PARPORT_AUTOPROBE,
.procname = "autoprobe", .procname = "autoprobe",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -318,7 +312,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -318,7 +312,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_autoprobe .proc_handler = &do_autoprobe
}, },
{ {
.ctl_name = DEV_PARPORT_AUTOPROBE + 1,
.procname = "autoprobe0", .procname = "autoprobe0",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -326,7 +319,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -326,7 +319,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_autoprobe .proc_handler = &do_autoprobe
}, },
{ {
.ctl_name = DEV_PARPORT_AUTOPROBE + 2,
.procname = "autoprobe1", .procname = "autoprobe1",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -334,7 +326,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -334,7 +326,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_autoprobe .proc_handler = &do_autoprobe
}, },
{ {
.ctl_name = DEV_PARPORT_AUTOPROBE + 3,
.procname = "autoprobe2", .procname = "autoprobe2",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -342,7 +333,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -342,7 +333,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.proc_handler = &do_autoprobe .proc_handler = &do_autoprobe
}, },
{ {
.ctl_name = DEV_PARPORT_AUTOPROBE + 4,
.procname = "autoprobe3", .procname = "autoprobe3",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -354,7 +344,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { ...@@ -354,7 +344,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
}, },
{ {
{ {
.ctl_name = DEV_PARPORT_DEVICES_ACTIVE,
.procname = "active", .procname = "active",
.data = NULL, .data = NULL,
.maxlen = 0, .maxlen = 0,
...@@ -393,7 +382,6 @@ parport_device_sysctl_template = { ...@@ -393,7 +382,6 @@ parport_device_sysctl_template = {
.sysctl_header = NULL, .sysctl_header = NULL,
{ {
{ {
.ctl_name = DEV_PARPORT_DEVICE_TIMESLICE,
.procname = "timeslice", .procname = "timeslice",
.data = NULL, .data = NULL,
.maxlen = sizeof(int), .maxlen = sizeof(int),
...@@ -449,7 +437,6 @@ parport_default_sysctl_table = { ...@@ -449,7 +437,6 @@ parport_default_sysctl_table = {
.sysctl_header = NULL, .sysctl_header = NULL,
{ {
{ {
.ctl_name = DEV_PARPORT_DEFAULT_TIMESLICE,
.procname = "timeslice", .procname = "timeslice",
.data = &parport_default_timeslice, .data = &parport_default_timeslice,
.maxlen = sizeof(parport_default_timeslice), .maxlen = sizeof(parport_default_timeslice),
...@@ -459,7 +446,6 @@ parport_default_sysctl_table = { ...@@ -459,7 +446,6 @@ parport_default_sysctl_table = {
.extra2 = (void*) &parport_max_timeslice_value .extra2 = (void*) &parport_max_timeslice_value
}, },
{ {
.ctl_name = DEV_PARPORT_DEFAULT_SPINTIME,
.procname = "spintime", .procname = "spintime",
.data = &parport_default_spintime, .data = &parport_default_spintime,
.maxlen = sizeof(parport_default_spintime), .maxlen = sizeof(parport_default_spintime),
...@@ -502,7 +488,7 @@ int parport_proc_register(struct parport *port) ...@@ -502,7 +488,7 @@ int parport_proc_register(struct parport *port)
t->device_dir[0].extra1 = port; t->device_dir[0].extra1 = port;
for (i = 0; i < 8; i++) for (i = 0; i < 5; i++)
t->vars[i].extra1 = port; t->vars[i].extra1 = port;
t->vars[0].data = &port->spintime; t->vars[0].data = &port->spintime;
...@@ -512,7 +498,7 @@ int parport_proc_register(struct parport *port) ...@@ -512,7 +498,7 @@ int parport_proc_register(struct parport *port)
t->vars[6 + i].extra2 = &port->probe_info[i]; t->vars[6 + i].extra2 = &port->probe_info[i];
t->port_dir[0].procname = port->name; t->port_dir[0].procname = port->name;
t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */ t->port_dir[0].ctl_name = 0;
t->port_dir[0].child = t->vars; t->port_dir[0].child = t->vars;
t->parport_dir[0].child = t->port_dir; t->parport_dir[0].child = t->port_dir;
...@@ -551,26 +537,12 @@ int parport_device_proc_register(struct pardevice *device) ...@@ -551,26 +537,12 @@ int parport_device_proc_register(struct pardevice *device)
t->dev_dir[0].child = t->parport_dir; t->dev_dir[0].child = t->parport_dir;
t->parport_dir[0].child = t->port_dir; t->parport_dir[0].child = t->port_dir;
t->port_dir[0].procname = port->name; t->port_dir[0].procname = port->name;
t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */ t->port_dir[0].ctl_name = 0;
t->port_dir[0].child = t->devices_root_dir; t->port_dir[0].child = t->devices_root_dir;
t->devices_root_dir[0].child = t->device_dir; t->devices_root_dir[0].child = t->device_dir;
#ifdef CONFIG_PARPORT_1284 t->device_dir[0].ctl_name = 0;
t->device_dir[0].ctl_name =
parport_device_num(port->number, port->muxport,
device->daisy)
+ 1; /* nb 0 isn't legal here */
#else /* No IEEE 1284 support */
/* parport_device_num isn't available. */
t->device_dir[0].ctl_name = 1;
#endif /* IEEE 1284 support or not */
t->device_dir[0].procname = device->name; t->device_dir[0].procname = device->name;
t->device_dir[0].extra1 = device;
t->device_dir[0].child = t->vars; t->device_dir[0].child = t->vars;
t->vars[0].data = &device->timeslice; t->vars[0].data = &device->timeslice;
......
...@@ -510,7 +510,6 @@ extern struct pardevice *parport_open (int devnum, const char *name, ...@@ -510,7 +510,6 @@ extern struct pardevice *parport_open (int devnum, const char *name,
int flags, void *handle); int flags, void *handle);
extern void parport_close (struct pardevice *dev); extern void parport_close (struct pardevice *dev);
extern ssize_t parport_device_id (int devnum, char *buffer, size_t len); extern ssize_t parport_device_id (int devnum, char *buffer, size_t len);
extern int parport_device_num (int parport, int mux, int daisy);
extern void parport_daisy_deselect_all (struct parport *port); extern void parport_daisy_deselect_all (struct parport *port);
extern int parport_daisy_select (struct parport *port, int daisy, int mode); extern int parport_daisy_select (struct parport *port, int daisy, int mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment