PARPORT: C99 Initializers
PATCH 1/1 PARPORT: C99 Initializers
Hello.
D: convert drivers/parport/procfs.c to C99 initializers.
===== drivers/parport/procfs.c 1.2 vs edited =====
drivers/parport/procfs.c +210 -75
@@ -232,12 +232,29 @@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) { \ + .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 { \ + .ctl_name = DEV_PARPORT_DEVICES, \ + .procname = "devices", \ +}static const unsigned long parport_min_timeslice_value =PARPORT_MIN_TIMESLICE_VALUE ;
@@ -264,48 +281,105 @@static const struct parport_sysctl_table parport_sysctl_template = {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 }, + { + .ctl_name =DEV_PARPORT_SPINTIME , + .procname ="spintime" , + .maxlen =sizeof (int ), + .mode =0644 , + .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" , + .mode =0444 , + .proc_handler = &do_hardware_base_addr, + }, + { + .ctl_name =DEV_PARPORT_IRQ , + .procname ="irq" , + .mode =0444 , + .proc_handler = &do_hardware_irq, + }, + { + .ctl_name =DEV_PARPORT_DMA , + .procname ="dma" , + .mode =0444 , + .proc_handler = &do_hardware_dma, + }, + { + .ctl_name =DEV_PARPORT_MODES , + .procname ="modes" , + .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 }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE , + .procname ="autoprobe" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + {i + .ctl_name =DEV_PARPORT_AUTOPROBE +1 , + .procname ="autoprobe0" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +2 , + .procname ="autoprobe1" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +3 , + .procname ="autoprobe2" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +4 , + .procname ="autoprobe3" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, #endif /* IEEE 1284 support */ - {0 } + { + .ctl_name =0 ,/* sentinel */ + } }, - { {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 }} + { + { + .ctl_name =DEV_PARPORT_DEVICES_ACTIVE , + .procname ="active" , + .mode =0444 , + .proc_handler = &do_active_device, + }, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { +PARPORT_PORT_DIR (NULL ), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { +PARPORT_PARPORT_DIR (NULL ), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { +PARPORT_DEV_DIR (NULL ), + { + .ctl_name =0 ,/* sentinel */ + } + } };struct parport_device_sysctl_table
@@ -323,17 +397,51 @@ parport_device_sysctl_template = { 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 }, - }, - { {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 = DEV_PARPORT_DEVICE_TIMESLICE, + .procname = "timeslice", + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_doulongvec_ms_jiffies_minmax, + .extra1 = (void *) &parport_min_timeslice_value, + .extra2 = (void *) &parport_max_timeslice_value + }, + { + ctl_name = 0, /* sentinel */ + } + }, + { + { + .mode = 0555, + }, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_DEVICES_ROOT_DIR, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_PORT_DIR(NULL), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_PARPORT_DIR(NULL), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_DEV_DIR(NULL), + { + .ctl_name = 0, /* sentinel */ + } + } };struct parport_default_sysctl_table
@@ -352,26 +460,53 @@ parport_default_sysctl_table = { NULL, { - { 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} - }, - { { 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}} + { + .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, + .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, + .extra1 = (void *) &parport_min_spintime_value, + .extra2 = (void *) &parport_max_spintime_value, + }, + { + .ctl_name = 0, /* sentinel */ + } + }, + { + { + .ctl_name = DEV_PARPORT_DEFAULT, + .procname = "default", + .mode = 0555, + .proc_handler = parport_default_sysctl_table.vars, + }, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir), + { + .ctl_name = 0, /* sentinel */ + } + } };
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]> GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
In article <[email protected]> (at Sun, 01 Feb 2004 22:44:31 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <[email protected]> says:
Quoted 3 lines
Hello.
D: convert
drivers/parport/procfs.cto C99 initializers.
Oops, it contains several typos... Sorry for the mess. Please use this instead.
===== drivers/parport/procfs.c 1.2 vs edited =====
drivers/parport/procfs.c +210 -75
@@ -232,12 +232,29 @@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) { \ + .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 { \ + .ctl_name = DEV_PARPORT_DEVICES, \ + .procname = "devices", \ +}static const unsigned long parport_min_timeslice_value =PARPORT_MIN_TIMESLICE_VALUE ;
@@ -264,48 +281,105 @@static const struct parport_sysctl_table parport_sysctl_template = {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 }, + { + .ctl_name =DEV_PARPORT_SPINTIME , + .procname ="spintime" , + .maxlen =sizeof (int ), + .mode =0644 , + .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" , + .mode =0444 , + .proc_handler = &do_hardware_base_addr, + }, + { + .ctl_name =DEV_PARPORT_IRQ , + .procname ="irq" , + .mode =0444 , + .proc_handler = &do_hardware_irq, + }, + { + .ctl_name =DEV_PARPORT_DMA , + .procname ="dma" , + .mode =0444 , + .proc_handler = &do_hardware_dma, + }, + { + .ctl_name =DEV_PARPORT_MODES , + .procname ="modes" , + .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 }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE , + .procname ="autoprobe" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +1 , + .procname ="autoprobe0" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +2 , + .procname ="autoprobe1" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +3 , + .procname ="autoprobe2" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +4 , + .procname ="autoprobe3" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, #endif /* IEEE 1284 support */ - {0 } + { + .ctl_name =0 ,/* sentinel */ + } }, - { {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 }} + { + { + .ctl_name =DEV_PARPORT_DEVICES_ACTIVE , + .procname ="active" , + .mode =0444 , + .proc_handler = &do_active_device, + }, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { +PARPORT_PORT_DIR (NULL ), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { +PARPORT_PARPORT_DIR (NULL ), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { +PARPORT_DEV_DIR (NULL ), + { + .ctl_name =0 ,/* sentinel */ + } + } };struct parport_device_sysctl_table
@@ -323,17 +397,51 @@ parport_device_sysctl_template = { 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 }, - }, - { {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 = DEV_PARPORT_DEVICE_TIMESLICE, + .procname = "timeslice", + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_doulongvec_ms_jiffies_minmax, + .extra1 = (void *) &parport_min_timeslice_value, + .extra2 = (void *) &parport_max_timeslice_value + }, + { + ctl_name = 0, /* sentinel */ + } + }, + { + { + .mode = 0555, + }, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_DEVICES_ROOT_DIR, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_PORT_DIR(NULL), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_PARPORT_DIR(NULL), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_DEV_DIR(NULL), + { + .ctl_name = 0, /* sentinel */ + } + } };struct parport_default_sysctl_table
@@ -352,26 +460,53 @@ parport_default_sysctl_table = { NULL, { - { 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} - }, - { { 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}} + { + .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, + .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, + .extra1 = (void *) &parport_min_spintime_value, + .extra2 = (void *) &parport_max_spintime_value, + }, + { + .ctl_name = 0, /* sentinel */ + } + }, + { + { + .ctl_name = DEV_PARPORT_DEFAULT, + .procname = "default", + .mode = 0555, + .proc_handler = parport_default_sysctl_table.vars, + }, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir), + { + .ctl_name = 0, /* sentinel */ + } + } };
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]> GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
In article <[email protected]> (at Sun, 01 Feb 2004 22:56:19 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <[email protected]> says:
Quoted 1 line
Please use this instead.
Hmm... take 3...
(I don't understand why I didn't get errors while compiling before...)
===== drivers/parport/procfs.c 1.2 vs edited =====
drivers/parport/procfs.c +210 -75
@@ -232,12 +232,29 @@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) { \ + .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 { \ + .ctl_name = DEV_PARPORT_DEVICES, \ + .procname = "devices", \ +}static const unsigned long parport_min_timeslice_value =PARPORT_MIN_TIMESLICE_VALUE ;
@@ -264,48 +281,105 @@static const struct parport_sysctl_table parport_sysctl_template = {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 }, + { + .ctl_name =DEV_PARPORT_SPINTIME , + .procname ="spintime" , + .maxlen =sizeof (int ), + .mode =0644 , + .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" , + .mode =0444 , + .proc_handler = &do_hardware_base_addr, + }, + { + .ctl_name =DEV_PARPORT_IRQ , + .procname ="irq" , + .mode =0444 , + .proc_handler = &do_hardware_irq, + }, + { + .ctl_name =DEV_PARPORT_DMA , + .procname ="dma" , + .mode =0444 , + .proc_handler = &do_hardware_dma, + }, + { + .ctl_name =DEV_PARPORT_MODES , + .procname ="modes" , + .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 }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE , + .procname ="autoprobe" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +1 , + .procname ="autoprobe0" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +2 , + .procname ="autoprobe1" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +3 , + .procname ="autoprobe2" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, + { + .ctl_name =DEV_PARPORT_AUTOPROBE +4 , + .procname ="autoprobe3" , + .mode =0444 , + .proc_handler = &do_autoprobe, + }, #endif /* IEEE 1284 support */ - {0 } + { + .ctl_name =0 ,/* sentinel */ + } }, - { {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 }} + { + { + .ctl_name =DEV_PARPORT_DEVICES_ACTIVE , + .procname ="active" , + .mode =0444 , + .proc_handler = &do_active_device, + }, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { +PARPORT_PORT_DIR (NULL ), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { +PARPORT_PARPORT_DIR (NULL ), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { +PARPORT_DEV_DIR (NULL ), + { + .ctl_name =0 ,/* sentinel */ + } + } };struct parport_device_sysctl_table
@@ -323,17 +397,51 @@ parport_device_sysctl_template = { 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 }, - }, - { {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 = DEV_PARPORT_DEVICE_TIMESLICE, + .procname = "timeslice", + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_doulongvec_ms_jiffies_minmax, + .extra1 = (void *) &parport_min_timeslice_value, + .extra2 = (void *) &parport_max_timeslice_value + }, + { + ctl_name = 0, /* sentinel */ + } + }, + { + { + .mode = 0555, + }, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_DEVICES_ROOT_DIR, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_PORT_DIR(NULL), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_PARPORT_DIR(NULL), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_DEV_DIR(NULL), + { + .ctl_name = 0, /* sentinel */ + } + } };struct parport_default_sysctl_table
@@ -352,26 +460,53 @@ parport_default_sysctl_table = { NULL, { - { 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} - }, - { { 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}} + { + .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, + .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, + .extra1 = (void *) &parport_min_spintime_value, + .extra2 = (void *) &parport_max_spintime_value, + }, + { + .ctl_name = 0, /* sentinel */ + } + }, + { + { + .ctl_name = DEV_PARPORT_DEFAULT, + .procname = "default", + .mode = 0555, + .proc_handler = parport_default_sysctl_table.vars, + }, + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), + { + .ctl_name =0 ,/* sentinel */ + } + }, + { + PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir), + { + .ctl_name = 0, /* sentinel */ + } + } };
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]> GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
Quoted 6 lines · YOSHIFUJI Hideaki / ????
In article <[email protected]> (at Sun, 01 Feb 2004 22:56:19 +0900 (JST)), YOSHIFUJI Hideaki / ???? <[email protected]> says:
Quoted 1 line
Please use this instead.
Hmm... take 3...
(I don't understand why I didn't get errors while compiling before...)
[...]
Applayed on AMD64.
linux-2.6.2-rc3 + cset-200402_0305
And:
make[1]: `arch/x86_64/kernel/asm-offsets.s' is up to date.
CHK include/linux/compile.h
CC [M] drivers/parport/procfs.odrivers/parport/procfs.c:366: error: parse error before '(' tokendrivers/parport/procfs.c:372: error: parse error before '(' tokendrivers/parport/procfs.c:378: error: parse error before '(' tokendrivers/parport/procfs.c:410: error: ctl_name' undeclared here (not in a function) drivers/parport/procfs.c:410: error: initializer element is not constant drivers/parport/procfs.c:410: error: (near initialization for parport_device_sysctl_template.vars[1].ctl_name') drivers/parport/procfs.c:411: error: initializer element is not constant drivers/parport/procfs.c:411: error: (near initialization for parport_device_sysctl_template.vars[1]') drivers/parport/procfs.c:412: error: initializer element is not constant drivers/parport/procfs.c:412: error: (near initialization for parport_device_sysctl_template.vars') drivers/parport/procfs.c:416: error: initializer element is not constant drivers/parport/procfs.c:416: error: (near initialization for parport_device_sysctl_template.device_dir[0]') drivers/parport/procfs.c:419: error: initializer element is not constant drivers/parport/procfs.c:419: error: (near initialization for parport_device_sysctl_template.device_dir[1]') drivers/parport/procfs.c:420: error: initializer element is not constant drivers/parport/procfs.c:420: error: (near initialization for parport_device_sysctl_template.device_dir') drivers/parport/procfs.c:422: error: initializer element is not constant drivers/parport/procfs.c:422: error: (near initialization for parport_device_sysctl_template.devices_root_dir[0]') drivers/parport/procfs.c:425: error: initializer element is not constant drivers/parport/procfs.c:425: error: (near initialization for parport_device_sysctl_template.devices_root_dir[1]') drivers/parport/procfs.c:426: error: initializer element is not constant drivers/parport/procfs.c:426: error: (near initialization for parport_device_sysctl_template.devices_root_dir') drivers/parport/procfs.c:428: error: parse error before '(' tokendrivers/parport/procfs.c:428: error: initializer element is not constant drivers/parport/procfs.c:428: error: (near initialization for parport_device_sysctl_template.port_dir[0]') drivers/parport/procfs.c:431: error: initializer element is not constant drivers/parport/procfs.c:431: error: (near initialization for parport_device_sysctl_template.port_dir[1]') drivers/parport/procfs.c:432: error: initializer element is not constant drivers/parport/procfs.c:432: error: (near initialization for `parport_device_sysctl_template.port_dir') drivers/parport/procfs.c:434: error: parse error before '(' tokendrivers/parport/procfs.c:434: error: initializer element is not constant drivers/parport/procfs.c:434: error: (near initialization for parport_device_sysctl_template.parport_dir[0]') drivers/parport/procfs.c:437: error: initializer element is not constant drivers/parport/procfs.c:437: error: (near initialization for parport_device_sysctl_template.parport_dir[1]') drivers/parport/procfs.c:438: error: initializer element is not constant drivers/parport/procfs.c:438: error: (near initialization for `parport_device_sysctl_template.parport_dir') drivers/parport/procfs.c:440: error: parse error before '(' tokendrivers/parport/procfs.c:440: error: initializer element is not constant drivers/parport/procfs.c:440: error: (near initialization for parport_device_sysctl_template.dev_dir[0]') drivers/parport/procfs.c:443: error: initializer element is not constant drivers/parport/procfs.c:443: error: (near initialization for parport_device_sysctl_template.dev_dir[1]') drivers/parport/procfs.c:444: error: initializer element is not constant drivers/parport/procfs.c:444: error: (near initialization for `parport_device_sysctl_template.dev_dir') drivers/parport/procfs.c:466: error: wrong type argument to unary minus drivers/parport/procfs.c:466: error: initializer element is not constant drivers/parport/procfs.c:466: error: (near initialization for parport_default_sysctl_table.vars[0].data') drivers/parport/procfs.c:472: error: initializer element is not constant drivers/parport/procfs.c:472: error: (near initialization for parport_default_sysctl_table.vars[0]') drivers/parport/procfs.c:482: error: initializer element is not constant drivers/parport/procfs.c:482: error: (near initialization for parport_default_sysctl_table.vars[1]') drivers/parport/procfs.c:485: error: initializer element is not constant drivers/parport/procfs.c:485: error: (near initialization for parport_default_sysctl_table.vars[2]') drivers/parport/procfs.c:486: error: initializer element is not constant drivers/parport/procfs.c:486: error: (near initialization for `parport_default_sysctl_table.vars') drivers/parport/procfs.c:492: warning: initialization from incompatible pointer type drivers/parport/procfs.c:493: error: initializer element is not constant drivers/parport/procfs.c:493: error: (near initialization for parport_default_sysctl_table.default_dir[0]') drivers/parport/procfs.c:496: error: initializer element is not constant drivers/parport/procfs.c:496: error: (near initialization for parport_default_sysctl_table.default_dir[1]') drivers/parport/procfs.c:497: error: initializer element is not constant drivers/parport/procfs.c:497: error: (near initialization for parport_default_sysctl_table.default_dir') drivers/parport/procfs.c:499: error: unknown field parport_default_sysctl_table' specified in initializer drivers/parport/procfs.c:499: error: initializer element is not constant drivers/parport/procfs.c:499: error: (near initialization for parport_default_sysctl_table.parport_dir[0]') drivers/parport/procfs.c:502: error: initializer element is not constant drivers/parport/procfs.c:502: error: (near initialization for parport_default_sysctl_table.parport_dir[1]') drivers/parport/procfs.c:503: error: initializer element is not constant drivers/parport/procfs.c:503: error: (near initialization for parport_default_sysctl_table.parport_dir') drivers/parport/procfs.c:505: error: unknown field parport_default_sysctl_table' specified in initializer drivers/parport/procfs.c:505: error: initializer element is not constant drivers/parport/procfs.c:505: error: (near initialization for parport_default_sysctl_table.dev_dir[0]') drivers/parport/procfs.c:508: error: initializer element is not constant drivers/parport/procfs.c:508: error: (near initialization for parport_default_sysctl_table.dev_dir[1]') drivers/parport/procfs.c:509: error: initializer element is not constant drivers/parport/procfs.c:509: error: (near initialization for `parport_default_sysctl_table.dev_dir') make[2]: *** [drivers/parport/procfs.o] Error 1
make[1]: *** [drivers/parport] Error 2
make: *** [drivers] Error 2
Signature · 2 lines
{Wojciech 'Sas' Cieciwa} {Member of PLD Team }
{e-mail: [email protected], http://www2.zarz.agh.edu.pl/~cieciwa}drivers/parport/procfs.c line 236
Quoted 13 lines · On Sun, Feb 01, 2004 at 10:44:31PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
Hello.
D: convert
drivers/parport/procfs.cto C99 initializers.=====
drivers/parport/procfs.c1.2 vs edited =====drivers/parport/procfs.c +5
-0@@ -232,12 +232,29 @@ + .proc_handler = &do_autoprobe, + }, + {i + ^ .ctl_name = DEV_PARPORT_AUTOPROBE + 1, + | .procname = "autoprobe0",
| Oops :)