Re: [PATCH] PARPORT: C99 Initializers

From: B ($B5HF#1QL_at_(B)
Date: 02/01/04

  • Next message: Frodo Looijaard: "Re: PATCH to access old-style FAT fs"
    Date:	Sun, 01 Feb 2004 23:35:44 +0900 (JST)
    To: Philip.Blundell@pobox.com, tim@cyberelk.net, campbell@torque.net, andrea@e-mind.com
    
    

    In article <20040201.225619.67854403.yoshfuji@linux-ipv6.org> (at Sun, 01 Feb 2004 22:56:19 +0900 (JST)), YOSHIFUJI Hideaki / $B5HF#1QL@(B <yoshfuji@linux-ipv6.org> says:

    > 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 =====
    --- 1.2/drivers/parport/procfs.c Tue Feb 5 16:37:25 2002
    +++ edited/drivers/parport/procfs.c Sun Feb 1 22:54:02 2004
    @@ -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 */
    + }
    + }
     };
     
     

    -- 
    Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
    GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Frodo Looijaard: "Re: PATCH to access old-style FAT fs"

    Relevant Pages

    • Re: [RFC] Generalize prio_tree (1/3)
      ... Hmm, GET_INDEX/get_index grows and grows, and also generates a ... And what if we took the hit and moved the key into struct ... half of the key is free (in terms of storage - the key updates ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [RFC PATCH] explicitly mark recursion count
      ... Hmm. ... > only thing that cares about type of p. iterator itself doesn't care and ... If foo is of type "struct bar", ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: byte alignment/dynamic memory from heap x64
      ... I had seen the definition in the WDK header that uses ... declspec) and I was compiling with x64 compiler. ... struct and when my driver is loaded I dynamically allocate memory using these ... The documention for x64 states that SLIST_ENTRY and SLIST_HEADER must be 16 ...
      (microsoft.public.development.device.drivers)
    • Re: [patch 8/8] PCI Error Recovery: PPC64 core recovery routines
      ... this file is a little ball of ugliness that resulted from moving ... I attempted to remove all of the pci-related stuff from this struct, ... related to the flattening of the device ndode tree. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: ioctls, etc. (was Re: [PATCH 1/4] sas: add flag for locally attached PHYs)
      ... a downplay that I didn't include the same thing in struct sas_ha_struct. ... The host template _mixes_ hw, scsi core, and protocol knowlege into ... libata isn't without architectural problems. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)