devfs cleanups for 2.5.29

devfs cleanups for 2.5.29

Post by Greg K » Thu, 01 Aug 2002 08:00:20



Hi,

When devfs came alone, it created devfs_[un]register_chrdev and
devfs_[un]register_blkdev, which required that all drivers be changed to
be compatible with devfs. This change has been bothering a lot of people
for quite some time :)

These two small changesets (patches to follow this email) fix that
problem by removing these functions, and having the original
[un]register_chrdev and [un]register_blkdev ask devfs if the operation
should be performed _if_ devfs is currently compiled into the kernel.
No functionality is changed, but the kernel code base is reduced, and we
are back to a common API.

If people want me to, I'd be glad to make up a patch for 2.4 that does
this same thing.

Linus, please pull from:
        bk://linuxusb.bkbits.net/devfs-2.5

thanks,

greg k-h

 arch/m68k/atari/joystick.c              |    2
 arch/sparc64/solaris/socksys.c          |    4 -
 drivers/block/DAC960.c                  |    4 -
 drivers/block/acsi.c                    |    7 +-
 drivers/block/acsi_slm.c                |    6 +-
 drivers/block/floppy.c                  |   10 ++--
 drivers/block/loop.c                    |    4 -
 drivers/block/paride/pd.c               |    6 +-
 drivers/block/paride/pg.c               |    4 -
 drivers/block/paride/pt.c               |    4 -
 drivers/block/ps2esdi.c                 |    7 +-
 drivers/block/swim3.c                   |    2
 drivers/block/xd.c                      |    6 +-
 drivers/cdrom/aztcd.c                   |    4 -
 drivers/cdrom/cdu31a.c                  |    6 +-
 drivers/cdrom/cm206.c                   |    4 -
 drivers/cdrom/gscd.c                    |    4 -
 drivers/cdrom/mcd.c                     |    4 -
 drivers/cdrom/mcdx.c                    |    4 -
 drivers/cdrom/optcd.c                   |    5 --
 drivers/cdrom/sbpcd.c                   |    6 +-
 drivers/cdrom/sjcd.c                    |    4 -
 drivers/cdrom/sonycd535.c               |   14 ++---
 drivers/char/dsp56k.c                   |    4 -
 drivers/char/dtlk.c                     |    4 -
 drivers/char/ftape/zftape/zftape-init.c |    4 -
 drivers/char/ip2main.c                  |   14 -----
 drivers/char/istallion.c                |    4 -
 drivers/char/lp.c                       |    4 -
 drivers/char/mem.c                      |    2
 drivers/char/misc.c                     |    2
 drivers/char/ppdev.c                    |    4 -
 drivers/char/stallion.c                 |    4 -
 drivers/char/tpqic02.c                  |    4 -
 drivers/char/tty_io.c                   |    6 +-
 drivers/char/vc_screen.c                |    2
 drivers/i2c/i2c-dev.c                   |    8 ---
 drivers/ide/hd.c                        |    3 -
 drivers/ide/ide-tape.c                  |    6 +-
 drivers/ide/probe.c                     |    2
 drivers/input/input.c                   |    4 -
 drivers/isdn/capi/capi.c                |    6 +-
 drivers/isdn/i4l/isdn_common.c          |    8 +--
 drivers/macintosh/adb.c                 |    2
 drivers/md/lvm.c                        |   22 ++++----
 drivers/md/md.c                         |    5 --
 drivers/media/video/videodev.c          |    5 --
 drivers/mtd/mtdblock.c                  |   18 +------
 drivers/mtd/mtdchar.c                   |   17 +-----
 drivers/net/ppp_generic.c               |    4 -
 drivers/net/wan/cosa.c                  |    8 +--
 drivers/s390/block/dasd_genhd.c         |    5 --
 drivers/s390/block/xpram.c              |    4 -
 drivers/s390/char/tapeblock.c           |   12 ----
 drivers/s390/char/tapechar.c            |    8 ---
 drivers/s390/char/tubfs.c               |   11 ----
 drivers/sbus/audio/audio.c              |    4 -
 drivers/sbus/char/bpp.c                 |    4 -
 drivers/sbus/char/sunkbd.c              |    2
 drivers/sbus/char/vfc_dev.c             |    4 -
 drivers/scsi/osst.c                     |   16 ------
 drivers/scsi/sd.c                       |    7 +-
 drivers/scsi/sg.c                       |    5 --
 drivers/scsi/sr.c                       |   10 ++--
 drivers/scsi/st.c                       |    4 -
 drivers/sgi/char/shmiq.c                |    2
 drivers/usb/core/file.c                 |    4 -
 drivers/usb/misc/tiglusb.c              |    6 +-
 drivers/video/fbmem.c                   |    2
 fs/block_dev.c                          |    4 +
 fs/coda/psdev.c                         |    6 +-
 fs/devfs/base.c                         |   80 ++++++++++++--------------------
 fs/devices.c                            |    5 ++
 include/linux/devfs_fs_kernel.h         |   30 +++++-------
 net/netlink/netlink_dev.c               |    4 -
 sound/core/sound.c                      |    8 ---
 sound/sound_core.c                      |    5 --
 77 files changed, 218 insertions(+), 331 deletions(-)
------

Change...@1.545, 2002-07-30 15:40:49-07:00, g...@kroah.com
  Removed devfs_register_blkdev and devfs_unregister_blkdev.

  Use register_blkdev and unregister_blkdev as before, and everything will work just fine.

 drivers/block/DAC960.c          |    4 ++--
 drivers/block/acsi.c            |    7 +++----
 drivers/block/floppy.c          |   10 +++++-----
 drivers/block/loop.c            |    4 ++--
 drivers/block/paride/pd.c       |    6 +++---
 drivers/block/ps2esdi.c         |    7 +++----
 drivers/block/swim3.c           |    2 +-
 drivers/block/xd.c              |    6 +++---
 drivers/cdrom/aztcd.c           |    4 ++--
 drivers/cdrom/cdu31a.c          |    6 +++---
 drivers/cdrom/cm206.c           |    4 ++--
 drivers/cdrom/gscd.c            |    4 ++--
 drivers/cdrom/mcd.c             |    4 ++--
 drivers/cdrom/mcdx.c            |    4 ++--
 drivers/cdrom/optcd.c           |    5 ++---
 drivers/cdrom/sbpcd.c           |    6 +++---
 drivers/cdrom/sjcd.c            |    4 ++--
 drivers/cdrom/sonycd535.c       |   14 +++++++-------
 drivers/ide/hd.c                |    3 +--
 drivers/ide/probe.c             |    2 +-
 drivers/md/lvm.c                |   10 ++++------
 drivers/md/md.c                 |    5 ++---
 drivers/mtd/mtdblock.c          |   18 ++++--------------
 drivers/s390/block/dasd_genhd.c |    5 ++---
 drivers/s390/block/xpram.c      |    4 ++--
 drivers/s390/char/tapeblock.c   |   12 ------------
 drivers/scsi/sd.c               |    7 +++----
 drivers/scsi/sr.c               |   10 +++++-----
 fs/block_dev.c                  |    4 ++++
 fs/devfs/base.c                 |   40 ++++++++++++++++------------------------
 include/linux/devfs_fs_kernel.h |   16 +++++++---------
 31 files changed, 100 insertions(+), 137 deletions(-)
------

Change...@1.544, 2002-07-30 14:38:11-07:00, g...@kroah.com
  Removed devfs_register_chrdev and devfs_unregister_chrdev.

  Use register_chrdev and unregister_chrdev as before, and everything will work.

 arch/m68k/atari/joystick.c              |    2 -
 arch/sparc64/solaris/socksys.c          |    4 +--
 drivers/block/acsi_slm.c                |    6 ++--
 drivers/block/paride/pg.c               |    4 +--
 drivers/block/paride/pt.c               |    4 +--
 drivers/char/dsp56k.c                   |    4 +--
 drivers/char/dtlk.c                     |    4 +--
 drivers/char/ftape/zftape/zftape-init.c |    4 +--
 drivers/char/ip2main.c                  |   14 +----------
 drivers/char/istallion.c                |    4 +--
 drivers/char/lp.c                       |    4 +--
 drivers/char/mem.c                      |    2 -
 drivers/char/misc.c                     |    2 -
 drivers/char/ppdev.c                    |    4 +--
 drivers/char/stallion.c                 |    4 +--
 drivers/char/tpqic02.c                  |    4 +--
 drivers/char/tty_io.c                   |    6 ++--
 drivers/char/vc_screen.c                |    2 -
 drivers/i2c/i2c-dev.c                   |    8 ------
 drivers/ide/ide-tape.c                  |    6 ++--
 drivers/input/input.c                   |    4 +--
 drivers/isdn/capi/capi.c                |    6 ++--
 drivers/isdn/i4l/isdn_common.c          |    8 +++---
 drivers/macintosh/adb.c                 |    2 -
 drivers/md/lvm.c                        |   12 ++++-----
 drivers/media/video/videodev.c          |    5 +---
 drivers/mtd/mtdchar.c                   |   17 ++-----------
 drivers/net/ppp_generic.c               |    4 +--
 drivers/net/wan/cosa.c                  |    8 +++---
 drivers/s390/char/tapechar.c            |    8 ------
 drivers/s390/char/tubfs.c               |   11 +-------
 drivers/sbus/audio/audio.c              |    4 +--
 drivers/sbus/char/bpp.c                 |    4 +--
 drivers/sbus/char/sunkbd.c              |    2 -
 drivers/sbus/char/vfc_dev.c             |    4 +--
 drivers/scsi/osst.c                     |   16 ------------
 drivers/scsi/sg.c                       |    5 +---
 drivers/scsi/st.c                       |    4 +--
 drivers/sgi/char/shmiq.c                |    2 -
 drivers/usb/core/file.c                 |    4 +--
 drivers/usb/misc/tiglusb.c              |    6 ++--
 drivers/video/fbmem.c                   |    2 -
 fs/coda/psdev.c                         |    6 ++--
 fs/devfs/base.c                         |   40 +++++++++++---------------------
 fs/devices.c                            |    5 ++++
 include/linux/devfs_fs_kernel.h         |   14 ++++-------
 net/netlink/netlink_dev.c               |    4 +--
 sound/core/sound.c                      |    8 ------
 sound/sound_core.c                      |    5 +---
 49 files changed, 118 insertions(+), 194 deletions(-)
------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Greg K » Thu, 01 Aug 2002 08:10:07


# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.543   -> 1.544  
#       drivers/video/fbmem.c   1.24    -> 1.25  
#       drivers/sbus/audio/audio.c      1.9     -> 1.10  
#       drivers/block/acsi_slm.c        1.4     -> 1.5    
#       drivers/usb/misc/tiglusb.c      1.7     -> 1.8    
#          drivers/char/lp.c    1.19    -> 1.20  
#       arch/m68k/atari/joystick.c      1.4     -> 1.5    
#       drivers/net/wan/cosa.c  1.9     -> 1.10  
#       drivers/sbus/char/bpp.c 1.5     -> 1.6    
#       drivers/char/istallion.c        1.10    -> 1.11  
#       drivers/media/video/videodev.c  1.13    -> 1.14  
#         sound/core/sound.c    1.6     -> 1.7    
#       drivers/ide/ide-tape.c  1.51    -> 1.52  
#            fs/devfs/base.c    1.45    -> 1.46  
#       drivers/char/stallion.c 1.10    -> 1.11  
#       drivers/block/paride/pt.c       1.10    -> 1.11  
#       drivers/char/vc_screen.c        1.5     -> 1.6    
#       arch/sparc64/solaris/socksys.c  1.7     -> 1.8    
#       drivers/isdn/i4l/isdn_common.c  1.21    -> 1.22  
#        drivers/char/misc.c    1.10    -> 1.11  
#       drivers/char/ftape/zftape/zftape-init.c 1.8     -> 1.9    
#       net/netlink/netlink_dev.c       1.7     -> 1.8    
#        drivers/char/dtlk.c    1.8     -> 1.9    
#         sound/sound_core.c    1.10    -> 1.11  
#       drivers/s390/char/tapechar.c    1.7     -> 1.8    
#       drivers/char/ppdev.c    1.13    -> 1.14  
#          drivers/scsi/sg.c    1.18    -> 1.19  
#        drivers/scsi/osst.c    1.15    -> 1.16  
#       drivers/char/tpqic02.c  1.13    -> 1.14  
#       drivers/macintosh/adb.c 1.9     -> 1.10  
#         drivers/char/mem.c    1.21    -> 1.22  
#       drivers/char/dsp56k.c   1.9     -> 1.10  
#               fs/devices.c    1.7     -> 1.8    
#       drivers/input/input.c   1.11    -> 1.12  
#       drivers/sbus/char/vfc_dev.c     1.6     -> 1.7    
#       drivers/char/tty_io.c   1.35    -> 1.36  
#       drivers/s390/char/tubfs.c       1.5     -> 1.6    
#           drivers/md/lvm.c    1.29    -> 1.30  
#            fs/coda/psdev.c    1.11    -> 1.12  
#          drivers/scsi/st.c    1.20    -> 1.21  
#       drivers/mtd/mtdchar.c   1.8     -> 1.9    
#       drivers/sbus/char/sunkbd.c      1.6     -> 1.7    
#       include/linux/devfs_fs_kernel.h 1.12    -> 1.13  
#       drivers/sgi/char/shmiq.c        1.6     -> 1.7    
#       drivers/i2c/i2c-dev.c   1.11    -> 1.12  
#       drivers/block/paride/pg.c       1.10    -> 1.11  
#       drivers/net/ppp_generic.c       1.12    -> 1.13  
#       drivers/isdn/capi/capi.c        1.33    -> 1.34  
#       drivers/usb/core/file.c 1.3     -> 1.4    
#       drivers/char/ip2main.c  1.12    -> 1.13  
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/30      g...@kroah.com 1.544
# Removed devfs_register_chrdev and devfs_unregister_chrdev.
#
# Use register_chrdev and unregister_chrdev as before, and everything will work.
# --------------------------------------------
#
diff -Nru a/arch/m68k/atari/joystick.c b/arch/m68k/atari/joystick.c
--- a/arch/m68k/atari/joystick.c        Tue Jul 30 15:50:04 2002
+++ b/arch/m68k/atari/joystick.c        Tue Jul 30 15:50:04 2002
@@ -134,7 +134,7 @@
     init_waitqueue_head(&joystick[0].wait);
     init_waitqueue_head(&joystick[1].wait);

-    if (devfs_register_chrdev(MAJOR_NR, "Joystick", &atari_joystick_fops))
+    if (register_chrdev(MAJOR_NR, "Joystick", &atari_joystick_fops))
        printk("unable to get major %d for joystick devices\n", MAJOR_NR);
     devfs_register_series (NULL, "joysticks/digital%u", 2, DEVFS_FL_DEFAULT,
                           MAJOR_NR, 128, S_IFCHR | S_IRUSR | S_IWUSR,
diff -Nru a/arch/sparc64/solaris/socksys.c b/arch/sparc64/solaris/socksys.c
--- a/arch/sparc64/solaris/socksys.c    Tue Jul 30 15:50:04 2002
+++ b/arch/sparc64/solaris/socksys.c    Tue Jul 30 15:50:04 2002
@@ -181,7 +181,7 @@
        int (*sys_close)(unsigned int) =
                (int (*)(unsigned int))SYS(close);

-       ret = devfs_register_chrdev (30, "socksys", &socksys_fops);
+       ret = register_chrdev (30, "socksys", &socksys_fops);
        if (ret < 0) {
                printk ("Couldn't register socksys character device\n");
                return ret;
@@ -208,7 +208,7 @@
 void
 cleanup_socksys(void)
 {
-       if (devfs_unregister_chrdev(30, "socksys"))
+       if (unregister_chrdev(30, "socksys"))
                printk ("Couldn't unregister socksys character device\n");
        devfs_unregister (devfs_handle);
 }
diff -Nru a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c
--- a/drivers/block/acsi_slm.c  Tue Jul 30 15:50:04 2002
+++ b/drivers/block/acsi_slm.c  Tue Jul 30 15:50:04 2002
@@ -998,14 +998,14 @@
 int slm_init( void )

 {
-       if (devfs_register_chrdev( MAJOR_NR, "slm", &slm_fops )) {
+       if (register_chrdev( MAJOR_NR, "slm", &slm_fops )) {
                printk( KERN_ERR "Unable to get major %d for ACSI SLM\n", MAJOR_NR );
                return -EBUSY;
        }

        if (!(SLMBuffer = atari_stram_alloc( SLM_BUFFER_SIZE, NULL, "SLM" ))) {
                printk( KERN_ERR "Unable to get SLM ST-Ram buffer.\n" );
-               devfs_unregister_chrdev( MAJOR_NR, "slm" );
+               unregister_chrdev( MAJOR_NR, "slm" );
                return -ENOMEM;
        }
        BufferP = SLMBuffer;
@@ -1038,7 +1038,7 @@
 void cleanup_module(void)
 {
        devfs_unregister (devfs_handle);
-       if (devfs_unregister_chrdev( MAJOR_NR, "slm" ) != 0)
+       if (unregister_chrdev( MAJOR_NR, "slm" ) != 0)
                printk( KERN_ERR "acsi_slm: cleanup_module failed\n");
        atari_stram_free( SLMBuffer );
 }
diff -Nru a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
--- a/drivers/block/paride/pg.c Tue Jul 30 15:50:05 2002
+++ b/drivers/block/paride/pg.c Tue Jul 30 15:50:05 2002
@@ -637,7 +637,7 @@
        if (pg_detect())
                return -1;

-       if (devfs_register_chrdev(major,name,&pg_fops)) {
+       if (register_chrdev(major,name,&pg_fops)) {
                printk("pg_init: unable to get major number %d\n",
                        major);
                for (unit=0;unit<PG_UNITS;unit++)
@@ -656,7 +656,7 @@
        int unit;

        devfs_unregister (devfs_handle);
-       devfs_unregister_chrdev(major,name);
+       unregister_chrdev(major,name);

        for (unit=0;unit<PG_UNITS;unit++)
                if (PG.present) pi_release(PI);
diff -Nru a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
--- a/drivers/block/paride/pt.c Tue Jul 30 15:50:04 2002
+++ b/drivers/block/paride/pt.c Tue Jul 30 15:50:04 2002
@@ -907,7 +907,7 @@
        if (pt_detect())
                return -1;

-       if (devfs_register_chrdev(major,name,&pt_fops)) {
+       if (register_chrdev(major,name,&pt_fops)) {
                printk("pt_init: unable to get major number %d\n",
                        major);
                for (unit=0;unit<PT_UNITS;unit++)
@@ -929,7 +929,7 @@
 {
        int unit;
        devfs_unregister (devfs_handle);
-       devfs_unregister_chrdev(major,name);
+       unregister_chrdev(major,name);
        for (unit=0;unit<PT_UNITS;unit++)
                if (PT.present)
                        pi_release(PI);
diff -Nru a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
--- a/drivers/char/dsp56k.c     Tue Jul 30 15:50:05 2002
+++ b/drivers/char/dsp56k.c     Tue Jul 30 15:50:05 2002
@@ -510,7 +510,7 @@
                return -ENODEV;
        }

-       if(devfs_register_chrdev(DSP56K_MAJOR, "dsp56k", &dsp56k_fops)) {
+       if(register_chrdev(DSP56K_MAJOR, "dsp56k", &dsp56k_fops)) {
                printk("DSP56k driver: Unable to register driver\n");
                return -ENODEV;
        }
@@ -526,7 +526,7 @@

 static void __exit dsp56k_cleanup_driver(void)
 {
-       devfs_unregister_chrdev(DSP56K_MAJOR, "dsp56k");
+       unregister_chrdev(DSP56K_MAJOR, "dsp56k");
        devfs_unregister(devfs_handle);
 }
 module_exit(dsp56k_cleanup_driver);
diff -Nru a/drivers/char/dtlk.c b/drivers/char/dtlk.c
--- a/drivers/char/dtlk.c       Tue Jul 30 15:50:04 2002
+++ b/drivers/char/dtlk.c       Tue Jul 30 15:50:04 2002
@@ -340,7 +340,7 @@
        dtlk_port_lpc = 0;
        dtlk_port_tts = 0;
        dtlk_busy = 0;
-       dtlk_major = devfs_register_chrdev(0, "dtlk", &dtlk_fops);
+       dtlk_major = register_chrdev(0, "dtlk", &dtlk_fops);
        if (dtlk_major == 0) {
                printk(KERN_ERR "DoubleTalk PC - cannot register device\n");
                return 0;
@@ -369,7 +369,7 @@
                                                   signals... */

        dtlk_write_tts(DTLK_CLEAR);
-       devfs_unregister_chrdev(dtlk_major, "dtlk");
+       unregister_chrdev(dtlk_major, "dtlk");
        devfs_unregister(devfs_handle);
        release_region(dtlk_port_lpc, DTLK_IO_EXTENT);
 }
diff -Nru a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c
--- a/drivers/char/ftape/zftape/zftape-init.c   Tue Jul 30 15:50:04 2002
+++ b/drivers/char/ftape/zftape/zftape-init.c   Tue Jul 30 15:50:04 2002
@@ -345,7 +345,7 @@
        TRACE(ft_t_info, "zft_init @ 0x%p", zft_init);
        TRACE(ft_t_info,
              "installing zftape VFS interface for ftape driver ...");
-       TRACE_CATCH(devfs_register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),);
+       TRACE_CATCH(register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),);

        for (i = 0; i < 4; i++) {
                char devname[9];
@@ -419,7 +419,7 @@

        TRACE_FUN(ft_t_flow);

-       if (devfs_unregister_chrdev(QIC117_TAPE_MAJOR, "zft") != 0) {
+       if (unregister_chrdev(QIC117_TAPE_MAJOR, "zft") != 0) {
                TRACE(ft_t_warn, "failed");
        } else {
                TRACE(ft_t_info, "successful");
diff -Nru a/drivers/char/ip2main.c b/drivers/char/ip2main.c
--- a/drivers/char/ip2main.c    Tue Jul 30 15:50:05 2002
+++ b/drivers/char/ip2main.c    Tue Jul 30 15:50:05 2002
@@ -531,12 +531,7 @@
        if ( ( err = tty_unregister_driver ( &ip2_callout_driver ) ) ) {
                printk(KERN_ERR "IP2: failed to unregister callout driver (%d)\n", err);
        }
-#ifdef CONFIG_DEVFS_FS
-       if ( ( err = devfs_unregister_chrdev ( IP2_IPL_MAJOR, pcIpl ) ) )
-#else
-       if ( ( err = unregister_chrdev ( IP2_IPL_MAJOR, pcIpl ) ) )
-#endif
-       {
+       if ( ( err = unregister_chrdev ( IP2_IPL_MAJOR, pcIpl ) ) ) {
                printk(KERN_ERR "IP2: failed to unregister IPL driver (%d)\n", err);
        }
        remove_proc_entry("ip2mem", &proc_root);
@@ -866,12 +861,7 @@
                printk(KERN_ERR "IP2: failed to register callout driver (%d)\n", err);
        } else
        /* Register the IPL driver. */
-#ifdef CONFIG_DEVFS_FS
-       if (( err = devfs_register_chrdev ( IP2_IPL_MAJOR, pcIpl, &ip2_ipl )))
-#else
-       if ( ( err = register_chrdev ( IP2_IPL_MAJOR, pcIpl, &ip2_ipl ) ) )
-#endif
-       {
+       if ( ( err = register_chrdev ( IP2_IPL_MAJOR, pcIpl, &ip2_ipl ) ) ) {
                printk(KERN_ERR "IP2: failed to register IPL device (%d)\n", err );
        } else
        /* Register the read_procmem thing */
diff -Nru a/drivers/char/istallion.c b/drivers/char/istallion.c
--- a/drivers/char/istallion.c  Tue Jul
...

read more »

 
 
 

devfs cleanups for 2.5.29

Post by Greg K » Thu, 01 Aug 2002 08:10:08


# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.544   -> 1.545  
#        drivers/ide/probe.c    1.65    -> 1.66  
#       drivers/block/ps2esdi.c 1.39    -> 1.40  
#       drivers/cdrom/gscd.c    1.18    -> 1.19  
#       drivers/block/loop.c    1.52    -> 1.53  
#        drivers/cdrom/mcd.c    1.16    -> 1.17  
#           drivers/ide/hd.c    1.27    -> 1.28  
#       drivers/cdrom/cdu31a.c  1.20    -> 1.21  
#       drivers/block/floppy.c  1.33    -> 1.34  
#       drivers/cdrom/sbpcd.c   1.23    -> 1.24  
#            fs/devfs/base.c    1.46    -> 1.47  
#          drivers/scsi/sd.c    1.45    -> 1.46  
#       drivers/cdrom/optcd.c   1.14    -> 1.15  
#          drivers/scsi/sr.c    1.30    -> 1.31  
#         drivers/block/xd.c    1.30    -> 1.31  
#            drivers/md/md.c    1.89    -> 1.90  
#       drivers/cdrom/sonycd535.c       1.18    -> 1.19  
#       drivers/cdrom/cm206.c   1.17    -> 1.18  
#       drivers/block/swim3.c   1.13    -> 1.14  
#       drivers/mtd/mtdblock.c  1.20    -> 1.21  
#       drivers/cdrom/mcdx.c    1.17    -> 1.18  
#       drivers/block/acsi.c    1.27    -> 1.28  
#           drivers/md/lvm.c    1.30    -> 1.31  
#       drivers/cdrom/sjcd.c    1.14    -> 1.15  
#       include/linux/devfs_fs_kernel.h 1.13    -> 1.14  
#       drivers/s390/block/xpram.c      1.23    -> 1.24  
#       drivers/block/DAC960.c  1.32    -> 1.33  
#       drivers/s390/block/dasd_genhd.c 1.2     -> 1.3    
#       drivers/block/paride/pd.c       1.28    -> 1.29  
#       drivers/cdrom/aztcd.c   1.16    -> 1.17  
#       drivers/s390/char/tapeblock.c   1.12    -> 1.13  
#             fs/block_dev.c    1.75    -> 1.76  
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/30      g...@kroah.com 1.545
# Removed devfs_register_blkdev and devfs_unregister_blkdev.
#
# Use register_blkdev and unregister_blkdev as before, and everything will work just fine.
# --------------------------------------------
#
diff -Nru a/drivers/block/DAC960.c b/drivers/block/DAC960.c
--- a/drivers/block/DAC960.c    Tue Jul 30 15:50:01 2002
+++ b/drivers/block/DAC960.c    Tue Jul 30 15:50:01 2002
@@ -1934,7 +1934,7 @@
   /*
     Register the Block Device Major Number for this DAC960 Controller.
   */
-  if (devfs_register_blkdev(MajorNumber, "dac960",
+  if (register_blkdev(MajorNumber, "dac960",
                            &DAC960_BlockDeviceOperations) < 0)
     {
       DAC960_Error("UNABLE TO ACQUIRE MAJOR NUMBER %d - DETACHING\n",
@@ -1993,7 +1993,7 @@
   /*
     Unregister the Block Device Major Number for this DAC960 Controller.
   */
-  devfs_unregister_blkdev(MajorNumber, "dac960");
+  unregister_blkdev(MajorNumber, "dac960");
   /*
     Remove the I/O Request Queue.
   */
diff -Nru a/drivers/block/acsi.c b/drivers/block/acsi.c
--- a/drivers/block/acsi.c      Tue Jul 30 15:50:01 2002
+++ b/drivers/block/acsi.c      Tue Jul 30 15:50:01 2002
@@ -56,7 +56,6 @@
 #include <linux/fs.h>
 #include <linux/kernel.h>
 #include <linux/genhd.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
 #include <linux/major.h>
@@ -1741,14 +1740,14 @@
        int err = 0;
        if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ACSI))
                return 0;
-       if (devfs_register_blkdev( MAJOR_NR, "ad", &acsi_fops )) {
+       if (register_blkdev( MAJOR_NR, "ad", &acsi_fops )) {
                printk( KERN_ERR "Unable to get major %d for ACSI\n", MAJOR_NR );
                return -EBUSY;
        }
        if (!(acsi_buffer =
                  (char *)atari_stram_alloc(ACSI_BUFFER_SIZE, "acsi"))) {
                printk( KERN_ERR "Unable to get ACSI ST-Ram buffer.\n" );
-               devfs_unregister_blkdev( MAJOR_NR, "ad" );
+               unregister_blkdev( MAJOR_NR, "ad" );
                return -ENOMEM;
        }
        phys_acsi_buffer = virt_to_phys( acsi_buffer );
@@ -1786,7 +1785,7 @@
        blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
        atari_stram_free( acsi_buffer );

-       if (devfs_unregister_blkdev( MAJOR_NR, "ad" ) != 0)
+       if (unregister_blkdev( MAJOR_NR, "ad" ) != 0)
                printk( KERN_ERR "acsi: cleanup_module failed\n");

        del_gendisk(&acsi_gendisk);
diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c
--- a/drivers/block/floppy.c    Tue Jul 30 15:50:01 2002
+++ b/drivers/block/floppy.c    Tue Jul 30 15:50:01 2002
@@ -4233,7 +4233,7 @@
        raw_cmd = NULL;

        devfs_handle = devfs_mk_dir (NULL, "floppy", NULL);
-       if (devfs_register_blkdev(MAJOR_NR,"fd",&floppy_fops)) {
+       if (register_blkdev(MAJOR_NR,"fd",&floppy_fops)) {
                printk("Unable to get major %d for floppy\n",MAJOR_NR);
                return -EBUSY;
        }
@@ -4266,7 +4266,7 @@
        use_virtual_dma = can_use_virtual_dma & 1;
        fdc_state[0].address = FDC1;
        if (fdc_state[0].address == -1) {
-               devfs_unregister_blkdev(MAJOR_NR,"fd");
+               unregister_blkdev(MAJOR_NR,"fd");
                del_timer(&fd_timeout);
                blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
                return -ENODEV;
@@ -4279,7 +4279,7 @@
        if (floppy_grab_irq_and_dma()){
                del_timer(&fd_timeout);
                blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
-               devfs_unregister_blkdev(MAJOR_NR,"fd");
+               unregister_blkdev(MAJOR_NR,"fd");
                return -EBUSY;
        }

@@ -4342,7 +4342,7 @@
                if (usage_count)
                        floppy_release_irq_and_dma();
                blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
-               devfs_unregister_blkdev(MAJOR_NR,"fd");
+               unregister_blkdev(MAJOR_NR,"fd");
        }

        for (drive = 0; drive < N_DRIVE; drive++) {
@@ -4539,7 +4539,7 @@
        int dummy;

        devfs_unregister (devfs_handle);
-       devfs_unregister_blkdev(MAJOR_NR, "fd");
+       unregister_blkdev(MAJOR_NR, "fd");

        blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
        /* eject disk, if any */
diff -Nru a/drivers/block/loop.c b/drivers/block/loop.c
--- a/drivers/block/loop.c      Tue Jul 30 15:50:01 2002
+++ b/drivers/block/loop.c      Tue Jul 30 15:50:01 2002
@@ -1027,7 +1027,7 @@
                max_loop = 8;
        }

-       if (devfs_register_blkdev(MAJOR_NR, "loop", &lo_fops)) {
+       if (register_blkdev(MAJOR_NR, "loop", &lo_fops)) {
                printk(KERN_WARNING "Unable to get major number %d for loop"
                                    " device\n", MAJOR_NR);
                return -EIO;
@@ -1078,7 +1078,7 @@
 void loop_exit(void)
 {
        devfs_unregister(devfs_handle);
-       if (devfs_unregister_blkdev(MAJOR_NR, "loop"))
+       if (unregister_blkdev(MAJOR_NR, "loop"))
                printk(KERN_WARNING "loop: cannot unregister blkdev\n");

        kfree(loop_dev);
diff -Nru a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
--- a/drivers/block/paride/pd.c Tue Jul 30 15:50:01 2002
+++ b/drivers/block/paride/pd.c Tue Jul 30 15:50:01 2002
@@ -940,7 +940,7 @@
        int unit;

        if (disable) return -1;
-        if (devfs_register_blkdev(MAJOR_NR,name,&pd_fops)) {
+        if (register_blkdev(MAJOR_NR,name,&pd_fops)) {
                 printk("%s: unable to get major number %d\n",
                         name,major);
                 return -1;
@@ -958,7 +958,7 @@
        pd_init_units();
        pd_gendisk.nr_real = pd_detect();
         if (!pd_gendisk.nr_real) {
-               devfs_unregister_blkdev(MAJOR_NR, name);
+               unregister_blkdev(MAJOR_NR, name);
                del_gendisk(&pd_gendisk);
                for (unit=0; unit<PD_UNITS; unit++)
                        if (PD.present)
@@ -971,7 +971,7 @@
 static void __exit pd_exit(void)
 {
        int unit;
-       devfs_unregister_blkdev(MAJOR_NR, name);
+       unregister_blkdev(MAJOR_NR, name);
        del_gendisk(&pd_gendisk);
        for (unit=0; unit<PD_UNITS; unit++)
                if (PD.present)
diff -Nru a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c
--- a/drivers/block/ps2esdi.c   Tue Jul 30 15:50:01 2002
+++ b/drivers/block/ps2esdi.c   Tue Jul 30 15:50:01 2002
@@ -43,7 +43,6 @@
 #include <linux/kernel.h>
 #include <linux/genhd.h>
 #include <linux/ps2esdi.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/blk.h>
 #include <linux/blkpg.h>
 #include <linux/mca.h>
@@ -168,7 +167,7 @@

        /* register the device - pass the name, major number and operations
           vector .                                                 */
-       if (devfs_register_blkdev(MAJOR_NR, "ed", &ps2esdi_fops)) {
+       if (register_blkdev(MAJOR_NR, "ed", &ps2esdi_fops)) {
                printk("%s: Unable to get major number %d\n", DEVICE_NAME, MAJOR_NR);
                return -1;
        }
@@ -182,7 +181,7 @@
        if (error) {
                printk(KERN_WARNING "PS2ESDI: error initialising"
                        " device, releasing resources\n");
-               devfs_unregister_blkdev(MAJOR_NR, "ed");
+               unregister_blkdev(MAJOR_NR, "ed");
                blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
                del_gendisk(&ps2esdi_gendisk);
                blk_clear(MAJOR_NR);
@@ -233,7 +232,7 @@
        release_region(io_base, 4);
        free_dma(dma_arb_level);
        free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk);
-       devfs_unregister_blkdev(MAJOR_NR, "ed");
+       unregister_blkdev(MAJOR_NR, "ed");
        blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
        del_gendisk(&ps2esdi_gendisk);
        blk_clear(MAJOR_NR);
diff -Nru a/drivers/block/swim3.c b/drivers/block/swim3.c
--- a/drivers/block/swim3.c     Tue Jul 30 15:50:01 2002
+++ b/drivers/block/swim3.c     Tue Jul 30 15:50:01 2002
@@ -1034,7 +1034,7 @@

        if (floppy_count > 0)
        {
-               if (devfs_register_blkdev(MAJOR_NR, "fd", &floppy_fops)) {
+               if (register_blkdev(MAJOR_NR, "fd", &floppy_fops)) {
                        printk(KERN_ERR "Unable to get major %d for floppy\n",
                               MAJOR_NR);
                        return -EBUSY;
diff -Nru a/drivers/block/xd.c b/drivers/block/xd.c
--- a/drivers/block/xd.c        Tue Jul 30 15:50:01 2002
+++ b/drivers/block/xd.c        Tue Jul 30 15:50:01 2002
@@ -164,7 +164,7 @@
        init_timer (&xd_timer); xd_timer.function = xd_wakeup;
        init_timer (&xd_watchdog_int); xd_watchdog_int.function = xd_watchdog;

-       if (devfs_register_blkdev(MAJOR_NR,"xd",&xd_fops)) {
+       if (register_blkdev(MAJOR_NR,"xd",&xd_fops)) {
                printk("xd: Unable to get major number %d\n",MAJOR_NR);
                return -1;
        }
@@ -1085,7 +1085,7 @@
        printk(KERN_INFO "XD: Loaded as a module.\n");
        if (!xd_drives) {
                /* no drives detected - unload module */
-               devfs_unregister_blkdev(MAJOR_NR, "xd");
+               unregister_blkdev(MAJOR_NR, "xd");
                xd_done();
                return (-1);
        }
@@ -1095,7 +1095,7 @@

 void cleanup_module(void)
 {
-       devfs_unregister_blkdev(MAJOR_NR, "xd");
+       unregister_blkdev(MAJOR_NR, "xd");
        xd_done();
        devfs_unregister (devfs_handle);
        if (xd_drives) {
diff -Nru a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c
--- a/drivers/cdrom/aztcd.c     Tue Jul
...

read more »

 
 
 

devfs cleanups for 2.5.29

Post by Richard Gooc » Thu, 01 Aug 2002 08:20:07


Quote:Greg KH writes:
> Hi,

> When devfs came alone, it created devfs_[un]register_chrdev and
> devfs_[un]register_blkdev, which required that all drivers be changed to
> be compatible with devfs. This change has been bothering a lot of people
> for quite some time :)

> These two small changesets (patches to follow this email) fix that
> problem by removing these functions, and having the original
> [un]register_chrdev and [un]register_blkdev ask devfs if the operation
> should be performed _if_ devfs is currently compiled into the kernel.
> No functionality is changed, but the kernel code base is reduced, and we
> are back to a common API.

Your patch misses the reason why I created those functions: some
drivers had to always register with the major table. With your
"fixups", those drivers will break when "devfs=only" is passed in. If
you first fix the drivers so that they work without an entry in the
major table, then your patch is safe to apply.

Quote:> Linus, please pull from:
>    bk://linuxusb.bkbits.net/devfs-2.5

Linus, please don't.

                                Regards,

                                        Richard....


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Greg K » Thu, 01 Aug 2002 08:30:07



> Greg KH writes:
> > Hi,

> > When devfs came alone, it created devfs_[un]register_chrdev and
> > devfs_[un]register_blkdev, which required that all drivers be changed to
> > be compatible with devfs. This change has been bothering a lot of people
> > for quite some time :)

> > These two small changesets (patches to follow this email) fix that
> > problem by removing these functions, and having the original
> > [un]register_chrdev and [un]register_blkdev ask devfs if the operation
> > should be performed _if_ devfs is currently compiled into the kernel.
> > No functionality is changed, but the kernel code base is reduced, and we
> > are back to a common API.

> Your patch misses the reason why I created those functions: some
> drivers had to always register with the major table. With your
> "fixups", those drivers will break when "devfs=only" is passed in. If
> you first fix the drivers so that they work without an entry in the
> major table, then your patch is safe to apply.

Ah, then this "feature" should be written down somewhere.  Which drivers
does this happen for?  And why penalize _all_ of the kernel drivers for
only the few that need this?

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Roman Zippe » Thu, 01 Aug 2002 08:40:08


Hi,


> With your
> "fixups", those drivers will break when "devfs=only" is passed in.

That feature is broken by design already anyway. devfs has absolutely no
business managing that device pointer. You're duplicating code and it only
makes it harder to properly protect it. As far as I can see it's still
broken wrt to module unloading.

bye, Roman

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Greg K » Thu, 01 Aug 2002 08:50:09




> > Your patch misses the reason why I created those functions: some
> > drivers had to always register with the major table. With your
> > "fixups", those drivers will break when "devfs=only" is passed in. If
> > you first fix the drivers so that they work without an entry in the
> > major table, then your patch is safe to apply.

> Ah, then this "feature" should be written down somewhere.  Which drivers
> does this happen for?  And why penalize _all_ of the kernel drivers for
> only the few that need this?

Actually, in reading through the devfs documentation some more about the
"devfs=only" option, I think this patch should be accepted.  Just
because you have not fixed up some remaining drivers for the (to quote
you) "dedicated souls" who want to use this option.

Don't force such a large and intrusive API change into loads of drivers
that do not want anything to do with devfs, just because your feature is
not yet complete.

If nothing else, it would force you (or people who actually use
"devfs=only") to fix those remaining drivers, which I would expect you
to view as a good thing :)

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Richard Gooc » Thu, 01 Aug 2002 08:50:08


Roman Zippel writes:
> Hi,


> > With your
> > "fixups", those drivers will break when "devfs=only" is passed in.

> That feature is broken by design already anyway. devfs has
> absolutely no business managing that device pointer. You're
> duplicating code and it only makes it harder to properly protect
> it. As far as I can see it's still broken wrt to module unloading.

No, it's not. Look more closely.

                                Regards,

                                        Richard....


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Roman Zippe » Thu, 01 Aug 2002 09:40:07


Hi,


> > As far as I can see it's still broken wrt to module unloading.

> No, it's not. Look more closely.

Are you sure it's save in devfs_open() too?
Even if it's save/fixed, it's still code duplication.

bye, Roman

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Richard Gooc » Thu, 01 Aug 2002 09:40:08


Roman Zippel writes:
> Hi,


> > > As far as I can see it's still broken wrt to module unloading.

> > No, it's not. Look more closely.

> Are you sure it's save in devfs_open() too?

Yes. RTFS.

Quote:> Even if it's save/fixed, it's still code duplication.

No. I leverage fops_get(), a common function.

                                Regards,

                                        Richard....


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Roman Zippe » Thu, 01 Aug 2002 18:40:08


Hi,


> > Are you sure it's save in devfs_open() too?

> Yes. RTFS.

I'm trying - without getting headache.
In the "devfs=only" case, where is the module count incremented, when a
block device is opened?

Quote:> > Even if it's save/fixed, it's still code duplication.

> No. I leverage fops_get(), a common function.

Which is also insufficiently protected.
Why do you insist on storing the ops pointer in devfs? As long as devfs is
an option, that pointer must be managed at two places.

bye, Roman

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Marcin Daleck » Fri, 02 Aug 2002 19:00:08



> Hi,

> When devfs came alone, it created devfs_[un]register_chrdev and
> devfs_[un]register_blkdev, which required that all drivers be changed to
> be compatible with devfs. This change has been bothering a lot of people
> for quite some time :)

Thanks! Finally someone got annoyed enough.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Jens Axbo » Fri, 02 Aug 2002 19:00:13




> >Hi,

> >When devfs came alone, it created devfs_[un]register_chrdev and
> >devfs_[un]register_blkdev, which required that all drivers be changed to
> >be compatible with devfs. This change has been bothering a lot of people
> >for quite some time :)

> Thanks! Finally someone got annoyed enough.

Yeah, let me add a big me too to that statement.

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Richard Gooc » Wed, 07 Aug 2002 07:20:06


Roman Zippel writes:
> Hi,


> > > Are you sure it's save in devfs_open() too?

> > Yes. RTFS.

> I'm trying - without getting headache.

Take a valium.

Quote:> In the "devfs=only" case, where is the module count incremented, when a
> block device is opened?

The module count is incremented when the device is opened,
irrespective of whether it's a character or block device, or even a
"regular" file.

Quote:> > > Even if it's save/fixed, it's still code duplication.

> > No. I leverage fops_get(), a common function.

> Which is also insufficiently protected.

Incorrect.

                                Regards,

                                        Richard....


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

devfs cleanups for 2.5.29

Post by Roman Zippe » Wed, 07 Aug 2002 07:50:07


Hi,


> > > Yes. RTFS.

> > I'm trying - without getting headache.

> Take a valium.

Staying away from devfs sources is cheaper.

Quote:> > In the "devfs=only" case, where is the module count incremented, when a
> > block device is opened?

> The module count is incremented when the device is opened,
> irrespective of whether it's a character or block device, or even a
> "regular" file.

Would you please answer my question and tell me where that exactly
happens in that case?

Quote:> > > No. I leverage fops_get(), a common function.

> > Which is also insufficiently protected.

> Incorrect.

What protects the module from unloading from getting the ops pointer until
try_inc_mod_count()?

bye, Roman

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/