Re: create_proc_entry and !CONFIG_PROC_FS

From: Adrian Bunk (bunk_at_fs.tum.de)
Date: 08/31/03

  • Next message: Christian Guggenberger: "VIA IO-APIC/ACPI Success - Was: Fixing USB interrupt problems with ACPI enabled [Christian.Guggenberger@physik.uni-regensburg.de]"
    Date:	Sun, 31 Aug 2003 23:45:57 +0200
    To: Andrew Morton <akpm@osdl.org>
    
    

    On Sun, Aug 31, 2003 at 02:40:33PM -0700, Andrew Morton wrote:
    > Adrian Bunk <bunk@fs.tum.de> wrote:
    > >
    > > Hi,
    > >
    > > I've observed a possible problem with create_proc_entry and
    > > !CONFIG_PROC_FS.
    > >
    > > If !CONFIG_PROC_FS include/linux/proc_fs.h includes a dummy
    > > create_proc_entry that simply returns NULL.
    > >
    > > Unfortunately, many callers of this function do things like e.g.
    > >
    > > static int __init br2684_init(void)
    > > {
    > > struct proc_dir_entry *p;
    > > if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
    > > return -ENOMEM;
    > > p->proc_fops = &br2684_proc_operations;
    > > br2684_ioctl_set(br2684_ioctl);
    > > return 0;
    > > }
    > >
    > >
    > > IOW, the dummy create_proc_entry fixes the compilation but the init
    > > function always returns -ENOMEM if !CONFIG_PROC_FS.
    > >
    > > Is there any better solution than removing the dummy create_proc_entry
    > > and #ifdef'ing all places where it's used?
    >
    > The normal fix would be to sprinkle ifdefs throughout the driver itself.

    That's what I was thinking of when I wrote "#ifdef'ing all places where
    it's used"...

    > You need to lok at the driver and ask yourself "is anyone ever going to want
    > to use this in a no-procfs system". Probably, the answer is always "no".
    > In which case appropriate fixes would be to ignore the problem, or disable
    > the driver in config if !CONFIG_PROC_FS.

    The latter is IMHO the better solution, a driver that compiles but
    doesn't work (#if !CONFIG_PROC_FS) is simply useless.

    cu
    Adrian

    -- 
           "Is there not promise of rain?" Ling Tan asked suddenly out
            of the darkness. There had been need of rain for many days.
           "Only a promise," Lao Er said.
                                           Pearl S. Buck - Dragon Seed
    -
    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: Christian Guggenberger: "VIA IO-APIC/ACPI Success - Was: Fixing USB interrupt problems with ACPI enabled [Christian.Guggenberger@physik.uni-regensburg.de]"

    Relevant Pages

    • Re: 2.6.11-rc2-mm1: SuperIO scx200 breakage
      ... >> You are assuming the module support was in able to correctly handle two ... > Above symbols are defined in old scx200 driver, ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [2.6 patch] SCSI: misc possible cleanups
      ... > These were hard-fought additions, and required by our driver, which we should call for upstream approval in the near future. ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Linux 2.6.0-test3 (compile statistics)
      ... please move your driver to the new sysfs api" ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [2.6 patch] drivers/cdrom/gscd.c: kill dead code
      ... >> checker. ... This driver seems to be pretty unchanged for the last 10 years. ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [2.6 patch] kill EXPORT_NO_SYMBOLS from OSS swarm_cs4297a.c
      ... MODULE_DESCRIPTION("Cirrus Logic CS4297a Driver for Broadcom SWARM board"); ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)