X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fparport%2Fprocfs.c;h=d950fc34320a61e21a32f9a8b4dc928f9fcc365a;hb=a8e98d6d51a3eb7bb061b1625193a129c8bd094f;hp=2e744a274517c517b31889e0553451427e28a209;hpb=71bc7bf045262e82c645cad48fd56dd17e75344e;p=powerpc.git diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c index 2e744a2745..d950fc3432 100644 --- a/drivers/parport/procfs.c +++ b/drivers/parport/procfs.c @@ -233,12 +233,12 @@ static int do_hardware_modes (ctl_table *table, int write, return copy_to_user(result, buffer, len) ? -EFAULT : 0; } -#define PARPORT_PORT_DIR(child) { 0, NULL, NULL, 0, 0555, child } -#define PARPORT_PARPORT_DIR(child) { DEV_PARPORT, "parport", \ - NULL, 0, 0555, child } -#define PARPORT_DEV_DIR(child) { CTL_DEV, "dev", NULL, 0, 0555, child } -#define PARPORT_DEVICES_ROOT_DIR { DEV_PARPORT_DEVICES, "devices", \ - NULL, 0, 0555, NULL } +#define PARPORT_PORT_DIR(CHILD) { .ctl_name = 0, .procname = NULL, .mode = 0555, .child = CHILD } +#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \ + .mode = 0555, .child = CHILD } +#define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD } +#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \ + .mode = 0555, .child = NULL } static const unsigned long parport_min_timeslice_value = PARPORT_MIN_TIMESLICE_VALUE; @@ -263,50 +263,107 @@ struct parport_sysctl_table { }; static const struct parport_sysctl_table parport_sysctl_template = { - NULL, + .sysctl_header = NULL, { - { DEV_PARPORT_SPINTIME, "spintime", - NULL, sizeof(int), 0644, NULL, - &proc_dointvec_minmax, NULL, NULL, - (void*) &parport_min_spintime_value, - (void*) &parport_max_spintime_value }, - { DEV_PARPORT_BASE_ADDR, "base-addr", - NULL, 0, 0444, NULL, - &do_hardware_base_addr }, - { DEV_PARPORT_IRQ, "irq", - NULL, 0, 0444, NULL, - &do_hardware_irq }, - { DEV_PARPORT_DMA, "dma", - NULL, 0, 0444, NULL, - &do_hardware_dma }, - { DEV_PARPORT_MODES, "modes", - NULL, 0, 0444, NULL, - &do_hardware_modes }, + { + .procname = "spintime", + .data = NULL, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec_minmax, + .extra1 = (void*) &parport_min_spintime_value, + .extra2 = (void*) &parport_max_spintime_value + }, + { + .procname = "base-addr", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_hardware_base_addr + }, + { + .procname = "irq", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_hardware_irq + }, + { + .procname = "dma", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_hardware_dma + }, + { + .procname = "modes", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_hardware_modes + }, PARPORT_DEVICES_ROOT_DIR, #ifdef CONFIG_PARPORT_1284 - { DEV_PARPORT_AUTOPROBE, "autoprobe", - NULL, 0, 0444, NULL, - &do_autoprobe }, - { DEV_PARPORT_AUTOPROBE + 1, "autoprobe0", - NULL, 0, 0444, NULL, - &do_autoprobe }, - { DEV_PARPORT_AUTOPROBE + 2, "autoprobe1", - NULL, 0, 0444, NULL, - &do_autoprobe }, - { DEV_PARPORT_AUTOPROBE + 3, "autoprobe2", - NULL, 0, 0444, NULL, - &do_autoprobe }, - { DEV_PARPORT_AUTOPROBE + 4, "autoprobe3", - NULL, 0, 0444, NULL, - &do_autoprobe }, + { + .procname = "autoprobe", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_autoprobe + }, + { + .procname = "autoprobe0", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_autoprobe + }, + { + .procname = "autoprobe1", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_autoprobe + }, + { + .procname = "autoprobe2", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_autoprobe + }, + { + .procname = "autoprobe3", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_autoprobe + }, #endif /* IEEE 1284 support */ - {0} + {} }, - { {DEV_PARPORT_DEVICES_ACTIVE, "active", NULL, 0, 0444, NULL, - &do_active_device }, {0}}, - { PARPORT_PORT_DIR(NULL), {0}}, - { PARPORT_PARPORT_DIR(NULL), {0}}, - { PARPORT_DEV_DIR(NULL), {0}} + { + { + .procname = "active", + .data = NULL, + .maxlen = 0, + .mode = 0444, + .proc_handler = &do_active_device + }, + {} + }, + { + PARPORT_PORT_DIR(NULL), + {} + }, + { + PARPORT_PARPORT_DIR(NULL), + {} + }, + { + PARPORT_DEV_DIR(NULL), + {} + } }; struct parport_device_sysctl_table @@ -322,19 +379,45 @@ struct parport_device_sysctl_table static const struct parport_device_sysctl_table parport_device_sysctl_template = { - NULL, + .sysctl_header = NULL, { - { DEV_PARPORT_DEVICE_TIMESLICE, "timeslice", - NULL, sizeof(int), 0644, NULL, - &proc_doulongvec_ms_jiffies_minmax, NULL, NULL, - (void*) &parport_min_timeslice_value, - (void*) &parport_max_timeslice_value }, + { + .procname = "timeslice", + .data = NULL, + .maxlen = sizeof(unsigned long), + .mode = 0644, + .proc_handler = &proc_doulongvec_ms_jiffies_minmax, + .extra1 = (void*) &parport_min_timeslice_value, + .extra2 = (void*) &parport_max_timeslice_value + }, }, - { {0, NULL, NULL, 0, 0555, NULL}, {0}}, - { PARPORT_DEVICES_ROOT_DIR, {0}}, - { PARPORT_PORT_DIR(NULL), {0}}, - { PARPORT_PARPORT_DIR(NULL), {0}}, - { PARPORT_DEV_DIR(NULL), {0}} + { + { + .ctl_name = 0, + .procname = NULL, + .data = NULL, + .maxlen = 0, + .mode = 0555, + .child = NULL + }, + {} + }, + { + PARPORT_DEVICES_ROOT_DIR, + {} + }, + { + PARPORT_PORT_DIR(NULL), + {} + }, + { + PARPORT_PARPORT_DIR(NULL), + {} + }, + { + PARPORT_DEV_DIR(NULL), + {} + } }; struct parport_default_sysctl_table @@ -351,28 +434,45 @@ extern int parport_default_spintime; static struct parport_default_sysctl_table parport_default_sysctl_table = { - NULL, + .sysctl_header = NULL, + { + { + .procname = "timeslice", + .data = &parport_default_timeslice, + .maxlen = sizeof(parport_default_timeslice), + .mode = 0644, + .proc_handler = &proc_doulongvec_ms_jiffies_minmax, + .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, + .proc_handler = &proc_dointvec_minmax, + .extra1 = (void*) &parport_min_spintime_value, + .extra2 = (void*) &parport_max_spintime_value + }, + {} + }, + { + { + .ctl_name = DEV_PARPORT_DEFAULT, + .procname = "default", + .mode = 0555, + .child = parport_default_sysctl_table.vars + }, + {} + }, { - { DEV_PARPORT_DEFAULT_TIMESLICE, "timeslice", - &parport_default_timeslice, - sizeof(parport_default_timeslice), 0644, NULL, - &proc_doulongvec_ms_jiffies_minmax, NULL, NULL, - (void*) &parport_min_timeslice_value, - (void*) &parport_max_timeslice_value }, - { DEV_PARPORT_DEFAULT_SPINTIME, "spintime", - &parport_default_spintime, - sizeof(parport_default_spintime), 0644, NULL, - &proc_dointvec_minmax, NULL, NULL, - (void*) &parport_min_spintime_value, - (void*) &parport_max_spintime_value }, - {0} + PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), + {} }, - { { DEV_PARPORT_DEFAULT, "default", NULL, 0, 0555, - parport_default_sysctl_table.vars },{0}}, { - PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), - {0}}, - { PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir), {0}} + PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir), + {} + } }; @@ -388,7 +488,7 @@ int parport_proc_register(struct parport *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[0].data = &port->spintime; @@ -398,13 +498,13 @@ int parport_proc_register(struct parport *port) t->vars[6 + i].extra2 = &port->probe_info[i]; 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->parport_dir[0].child = t->port_dir; t->dev_dir[0].child = t->parport_dir; - t->sysctl_header = register_sysctl_table(t->dev_dir, 0); + t->sysctl_header = register_sysctl_table(t->dev_dir); if (t->sysctl_header == NULL) { kfree(t); t = NULL; @@ -437,30 +537,16 @@ int parport_device_proc_register(struct pardevice *device) 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].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->devices_root_dir[0].child = t->device_dir; -#ifdef CONFIG_PARPORT_1284 - - 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].ctl_name = 0; t->device_dir[0].procname = device->name; - t->device_dir[0].extra1 = device; t->device_dir[0].child = t->vars; t->vars[0].data = &device->timeslice; - t->sysctl_header = register_sysctl_table(t->dev_dir, 0); + t->sysctl_header = register_sysctl_table(t->dev_dir); if (t->sysctl_header == NULL) { kfree(t); t = NULL; @@ -483,7 +569,7 @@ int parport_device_proc_unregister(struct pardevice *device) static int __init parport_default_proc_register(void) { parport_default_sysctl_table.sysctl_header = - register_sysctl_table(parport_default_sysctl_table.dev_dir, 0); + register_sysctl_table(parport_default_sysctl_table.dev_dir); return 0; }