pipe: fix check in "set size" fcntl
[safe/jmp/linux-2.6] / drivers / parport / procfs.c
index bdbdab9..3f56bc0 100644 (file)
@@ -31,7 +31,7 @@
 #define PARPORT_MIN_SPINTIME_VALUE 1
 #define PARPORT_MAX_SPINTIME_VALUE 1000
 
-static int do_active_device(ctl_table *table, int write, struct file *filp,
+static int do_active_device(ctl_table *table, int write,
                      void __user *result, size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
@@ -68,7 +68,7 @@ static int do_active_device(ctl_table *table, int write, struct file *filp,
 }
 
 #ifdef CONFIG_PARPORT_1284
-static int do_autoprobe(ctl_table *table, int write, struct file *filp,
+static int do_autoprobe(ctl_table *table, int write,
                        void __user *result, size_t *lenp, loff_t *ppos)
 {
        struct parport_device_info *info = table->extra2;
@@ -111,7 +111,7 @@ static int do_autoprobe(ctl_table *table, int write, struct file *filp,
 #endif /* IEEE1284.3 support. */
 
 static int do_hardware_base_addr (ctl_table *table, int write,
-                                 struct file *filp, void __user *result,
+                                 void __user *result,
                                  size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
@@ -139,7 +139,7 @@ static int do_hardware_base_addr (ctl_table *table, int write,
 }
 
 static int do_hardware_irq (ctl_table *table, int write,
-                           struct file *filp, void __user *result,
+                           void __user *result,
                            size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
@@ -167,7 +167,7 @@ static int do_hardware_irq (ctl_table *table, int write,
 }
 
 static int do_hardware_dma (ctl_table *table, int write,
-                           struct file *filp, void __user *result,
+                           void __user *result,
                            size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
@@ -195,7 +195,7 @@ static int do_hardware_dma (ctl_table *table, int write,
 }
 
 static int do_hardware_modes (ctl_table *table, int write,
-                             struct file *filp, void __user *result,
+                             void __user *result,
                              size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
@@ -233,11 +233,11 @@ static int do_hardware_modes (ctl_table *table, int write,
        return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
 
-#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", \
+#define PARPORT_PORT_DIR(CHILD) { .procname = NULL, .mode = 0555, .child = CHILD }
+#define PARPORT_PARPORT_DIR(CHILD) { .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  { .ctl_name = DEV_PARPORT_DEVICES, .procname = "devices", \
+#define PARPORT_DEV_DIR(CHILD) { .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 =
@@ -266,100 +266,89 @@ static const struct parport_sysctl_table parport_sysctl_template = {
        .sysctl_header = NULL,
         {
                {
-                       .ctl_name       = DEV_PARPORT_SPINTIME,
                        .procname       = "spintime",
                        .data           = NULL,
                        .maxlen         = sizeof(int),
                        .mode           = 0644,
-                       .proc_handler   = &proc_dointvec_minmax,
+                       .proc_handler   = proc_dointvec_minmax,
                        .extra1         = (void*) &parport_min_spintime_value,
                        .extra2         = (void*) &parport_max_spintime_value
                },
                {
-                       .ctl_name       = DEV_PARPORT_BASE_ADDR,
                        .procname       = "base-addr",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   = &do_hardware_base_addr
+                       .proc_handler   = do_hardware_base_addr
                },
                {
-                       .ctl_name       = DEV_PARPORT_IRQ,
                        .procname       = "irq",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   = &do_hardware_irq
+                       .proc_handler   = do_hardware_irq
                },
                {
-                       .ctl_name       = DEV_PARPORT_DMA,
                        .procname       = "dma",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   = &do_hardware_dma
+                       .proc_handler   = do_hardware_dma
                },
                {
-                       .ctl_name       = DEV_PARPORT_MODES,
                        .procname       = "modes",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   = &do_hardware_modes
+                       .proc_handler   = do_hardware_modes
                },
                PARPORT_DEVICES_ROOT_DIR,
 #ifdef CONFIG_PARPORT_1284
                {
-                       .ctl_name       = DEV_PARPORT_AUTOPROBE,
                        .procname       = "autoprobe",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   = &do_autoprobe
+                       .proc_handler   = do_autoprobe
                },
                {
-                       .ctl_name       = DEV_PARPORT_AUTOPROBE + 1,
                        .procname       = "autoprobe0",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   =  &do_autoprobe
+                       .proc_handler   = do_autoprobe
                },
                {
-                       .ctl_name       = DEV_PARPORT_AUTOPROBE + 2,
                        .procname       = "autoprobe1",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   = &do_autoprobe
+                       .proc_handler   = do_autoprobe
                },
                {
-                       .ctl_name       = DEV_PARPORT_AUTOPROBE + 3,
                        .procname       = "autoprobe2",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   = &do_autoprobe
+                       .proc_handler   = do_autoprobe
                },
                {
-                       .ctl_name       = DEV_PARPORT_AUTOPROBE + 4,
                        .procname       = "autoprobe3",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   = &do_autoprobe
+                       .proc_handler   = do_autoprobe
                },
 #endif /* IEEE 1284 support */
                {}
        },
        {
                {
-                       .ctl_name       = DEV_PARPORT_DEVICES_ACTIVE,
                        .procname       = "active",
                        .data           = NULL,
                        .maxlen         = 0,
                        .mode           = 0444,
-                       .proc_handler   = &do_active_device
+                       .proc_handler   = do_active_device
                },
                {}
        },
@@ -393,19 +382,17 @@ parport_device_sysctl_template = {
        .sysctl_header = NULL,
        {
                {
-                       .ctl_name       = DEV_PARPORT_DEVICE_TIMESLICE,
                        .procname       = "timeslice",
                        .data           = NULL,
-                       .maxlen         = sizeof(int),
+                       .maxlen         = sizeof(unsigned long),
                        .mode           = 0644,
-                       .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
+                       .proc_handler   = proc_doulongvec_ms_jiffies_minmax,
                        .extra1         = (void*) &parport_min_timeslice_value,
                        .extra2         = (void*) &parport_max_timeslice_value
                },
        },
        {
                {
-                       .ctl_name       = 0,
                        .procname       = NULL,
                        .data           = NULL,
                        .maxlen         = 0,
@@ -441,30 +428,25 @@ struct parport_default_sysctl_table
        ctl_table dev_dir[2];
 };
 
-extern unsigned long parport_default_timeslice;
-extern int parport_default_spintime;
-
 static struct parport_default_sysctl_table
 parport_default_sysctl_table = {
        .sysctl_header  = NULL,
        {
                {
-                       .ctl_name       = DEV_PARPORT_DEFAULT_TIMESLICE,
                        .procname       = "timeslice",
                        .data           = &parport_default_timeslice,
                        .maxlen         = sizeof(parport_default_timeslice),
                        .mode           = 0644,
-                       .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
+                       .proc_handler   = proc_doulongvec_ms_jiffies_minmax,
                        .extra1         = (void*) &parport_min_timeslice_value,
                        .extra2         = (void*) &parport_max_timeslice_value
                },
                {
-                       .ctl_name       = DEV_PARPORT_DEFAULT_SPINTIME,
                        .procname       = "spintime",
                        .data           = &parport_default_spintime,
                        .maxlen         = sizeof(parport_default_spintime),
                        .mode           = 0644,
-                       .proc_handler   = &proc_dointvec_minmax,
+                       .proc_handler   = proc_dointvec_minmax,
                        .extra1         = (void*) &parport_min_spintime_value,
                        .extra2         = (void*) &parport_max_spintime_value
                },
@@ -472,7 +454,6 @@ parport_default_sysctl_table = {
        },
        {
                {
-                       .ctl_name       = DEV_PARPORT_DEFAULT,
                        .procname       = "default",
                        .mode           = 0555,
                        .child          = parport_default_sysctl_table.vars
@@ -502,7 +483,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;
@@ -512,7 +493,6 @@ 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].child = t->vars;
        t->parport_dir[0].child = t->port_dir;
@@ -551,26 +531,10 @@ 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].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].procname = device->name;
-       t->device_dir[0].extra1 = device;
        t->device_dir[0].child = t->vars;
        t->vars[0].data = &device->timeslice;