From: Christoph Hellwig This is a pretty huge patch, but splitting it doesn't make a lot of sense.. arch/sparc64/solaris/socksys.c | 7 +- arch/um/drivers/mmapper_kern.c | 4 - drivers/block/acsi_slm.c | 7 -- drivers/block/paride/pg.c | 7 -- drivers/block/paride/pt.c | 15 ++---- drivers/char/dsp56k.c | 7 +- drivers/char/dtlk.c | 7 +- drivers/char/ftape/zftape/zftape-init.c | 48 ++++++------------- drivers/char/ip2main.c | 18 +------ drivers/char/ipmi/ipmi_devintf.c | 21 ++------ drivers/char/istallion.c | 7 -- drivers/char/lp.c | 9 --- drivers/char/mem.c | 42 +++++++---------- drivers/char/misc.c | 4 - drivers/char/ppdev.c | 6 -- drivers/char/stallion.c | 10 +--- drivers/char/tipar.c | 12 +--- drivers/char/tpqic02.c | 53 ++++++++------------- drivers/char/tty_io.c | 20 ++------ drivers/char/vc_screen.c | 47 ++++++------------- drivers/char/vt.c | 31 ++---------- drivers/i2c/i2c-dev.c | 9 --- drivers/ide/ide-tape.c | 2 drivers/ieee1394/amdtp.c | 7 -- drivers/ieee1394/dv1394.c | 40 ++-------------- drivers/ieee1394/raw1394.c | 5 -- drivers/ieee1394/video1394.c | 11 +--- drivers/isdn/capi/capi.c | 6 +- drivers/isdn/hardware/eicon/divamnt.c | 4 - drivers/isdn/hardware/eicon/divasi.c | 4 - drivers/isdn/hardware/eicon/divasmain.c | 3 - drivers/isdn/i4l/isdn_common.c | 79 +++++--------------------------- drivers/macintosh/adb.c | 6 -- drivers/media/dvb/dvb-core/dvbdev.c | 17 ++---- drivers/media/video/videodev.c | 4 - drivers/mtd/mtdchar.c | 18 +------ drivers/net/ppp_generic.c | 11 ++-- drivers/net/wan/cosa.c | 9 +-- drivers/s390/char/tuball.c | 9 +-- drivers/s390/char/tubfs.c | 29 ----------- drivers/s390/char/tubio.h | 4 - drivers/s390/char/tubtty.c | 2 drivers/sbus/char/bpp.c | 7 -- drivers/sbus/char/vfc_dev.c | 10 +--- drivers/scsi/osst.c | 21 ++++---- drivers/scsi/sg.c | 7 -- drivers/scsi/st.c | 15 ++---- drivers/sgi/char/shmiq.c | 5 -- drivers/usb/class/usblp.c | 9 +-- drivers/usb/image/scanner.c | 14 +---- drivers/usb/input/hiddev.c | 10 +--- drivers/usb/misc/auerswald.c | 6 -- drivers/usb/misc/brlvger.c | 10 +--- drivers/usb/misc/rio500.c | 8 +-- drivers/usb/misc/tiglusb.c | 14 +---- drivers/usb/usb-skeleton.c | 12 +--- drivers/video/fbmem.c | 8 +-- fs/coda/psdev.c | 10 ---- net/netlink/netlink_dev.c | 22 +++----- sound/core/info.c | 12 +--- sound/core/sound.c | 19 ++----- sound/oss/soundcard.c | 20 +++----- sound/sound_core.c | 4 - 63 files changed, 282 insertions(+), 622 deletions(-) diff -puN arch/sparc64/solaris/socksys.c~switch-to-devfs_mk_bdev arch/sparc64/solaris/socksys.c --- 25/arch/sparc64/solaris/socksys.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/arch/sparc64/solaris/socksys.c 2003-05-06 22:57:29.000000000 -0700 @@ -191,10 +191,9 @@ init_socksys(void) printk ("Couldn't create socket\n"); return ret; } - devfs_register (NULL, "socksys", DEVFS_FL_DEFAULT, - 30, 0, - S_IFCHR | S_IRUSR | S_IWUSR, - &socksys_fops, NULL); + + devfs_mk_cdev(MKDEV(30, 0), S_IFCHR|S_IRUSR|S_IWUSR, "socksys"); + file = fcheck(ret); /* N.B. Is this valid? Suppose the f_ops are in a module ... */ socksys_file_ops = *file->f_op; diff -puN arch/um/drivers/mmapper_kern.c~switch-to-devfs_mk_bdev arch/um/drivers/mmapper_kern.c --- 25/arch/um/drivers/mmapper_kern.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/arch/um/drivers/mmapper_kern.c 2003-05-06 22:57:29.000000000 -0700 @@ -124,9 +124,7 @@ static int __init mmapper_init(void) p_buf = __pa(v_buf); - devfs_register (NULL, "mmapper", DEVFS_FL_DEFAULT, - 30, 0, S_IFCHR | S_IRUGO | S_IWUGO, - &mmapper_fops, NULL); + devfs_mk_cdev(MKDEV(30, 0), S_IFCHR|S_IRUGO|S_IWUGO, "mmapper"); devfs_mk_symlink("mmapper0", "mmapper"); return(0); } diff -puN drivers/block/acsi_slm.c~switch-to-devfs_mk_bdev drivers/block/acsi_slm.c --- 25/drivers/block/acsi_slm.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/block/acsi_slm.c 2003-05-06 22:57:29.000000000 -0700 @@ -1008,11 +1008,8 @@ int slm_init( void ) devfs_mk_dir("slm"); for (i = 0; i < MAX_SLM; i++) { - char name[16]; - sprintf(name, "slm/%d", i); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, - ACSI_MAJOR, i, S_IFCHR | S_IRUSR | S_IWUSR, - &slm_fops, NULL); + devfs_mk_cdev(MKDEV(ACSI_MAJOR, i), + S_IFCHR|S_IRUSR|S_IWUSR, "slm/%d", i); } return 0; } diff -puN drivers/block/paride/pg.c~switch-to-devfs_mk_bdev drivers/block/paride/pg.c --- 25/drivers/block/paride/pg.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/block/paride/pg.c 2003-05-06 22:57:29.000000000 -0700 @@ -652,11 +652,8 @@ static int __init pg_init(void) devfs_mk_dir ("pg"); for (unit=0; unit MAX_DEVICES) - return; - - snprintf(name, sizeof(name), "ipmidev/%d", if_num); - - devfs_register(NULL, name, 0, ipmi_major, if_num, - S_IFCHR | S_IRUSR | S_IWUSR, - &ipmi_fops, NULL); + if (if_num <= MAX_DEVICES) { + devfs_mk_cdev(MKDEV(ipmi_major, if_num), + S_IFCHR | S_IRUSR | S_IWUSR, + "ipmidev/%d", if_num); + } } static void ipmi_smi_gone(int if_num) { - if (if_num > MAX_DEVICES) - return; - - devfs_remove("ipmidev/%d", if_num); + if (if_num <= MAX_DEVICES) + devfs_remove("ipmidev/%d", if_num); } static struct ipmi_smi_watcher smi_watcher = diff -puN drivers/char/istallion.c~switch-to-devfs_mk_bdev drivers/char/istallion.c --- 25/drivers/char/istallion.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/istallion.c 2003-05-06 22:57:29.000000000 -0700 @@ -5336,12 +5336,9 @@ int __init stli_init(void) devfs_mk_dir("staliomem"); for (i = 0; i < 4; i++) { - char name[16]; - sprintf(name, "staliomem/%d", i); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, - STL_SIOMEMMAJOR, i, + devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), S_IFCHR | S_IRUSR | S_IWUSR, - &stli_fsiomem, NULL); + "staliomem/%d", i); } /* diff -puN drivers/char/lp.c~switch-to-devfs_mk_bdev drivers/char/lp.c --- 25/drivers/char/lp.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/lp.c 2003-05-06 22:57:29.000000000 -0700 @@ -784,8 +784,6 @@ static int __init lp_setup (char *str) static int lp_register(int nr, struct parport *port) { - char name[16]; - lp_table[nr].dev = parport_register_device(port, "lp", lp_preempt, NULL, NULL, 0, (void *) &lp_table[nr]); @@ -796,11 +794,8 @@ static int lp_register(int nr, struct pa if (reset) lp_reset(nr); - sprintf (name, "printers/%d", nr); - devfs_register (NULL, name, - DEVFS_FL_DEFAULT, LP_MAJOR, nr, - S_IFCHR | S_IRUGO | S_IWUGO, - &lp_fops, NULL); + devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO, + "printers/%d", nr); printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); diff -puN drivers/char/mem.c~switch-to-devfs_mk_bdev drivers/char/mem.c --- 25/drivers/char/mem.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/mem.c 2003-05-06 22:57:29.000000000 -0700 @@ -660,15 +660,16 @@ static int memory_open(struct inode * in return 0; } -void __init memory_devfs_register (void) -{ - /* These are never unregistered */ - static const struct { - unsigned short minor; - char *name; - umode_t mode; - struct file_operations *fops; - } list[] = { /* list of minor devices */ +static struct file_operations memory_fops = { + .open = memory_open, /* just a selector for the real open */ +}; + +static const struct { + unsigned int minor; + char *name; + umode_t mode; + struct file_operations *fops; +} devlist[] = { /* list of minor devices */ {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops}, {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops}, {3, "null", S_IRUGO | S_IWUGO, &null_fops}, @@ -680,25 +681,20 @@ void __init memory_devfs_register (void) {8, "random", S_IRUGO | S_IWUSR, &random_fops}, {9, "urandom", S_IRUGO | S_IWUSR, &urandom_fops}, {11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops}, - }; - int i; - - for (i=0; i<(sizeof(list)/sizeof(*list)); i++) - devfs_register (NULL, list[i].name, DEVFS_FL_NONE, - MEM_MAJOR, list[i].minor, - list[i].mode | S_IFCHR, - list[i].fops, NULL); -} - -static struct file_operations memory_fops = { - .open = memory_open, /* just a selector for the real open */ }; -int __init chr_dev_init(void) +static int __init chr_dev_init(void) { + int i; + if (register_chrdev(MEM_MAJOR,"mem",&memory_fops)) printk("unable to get major %d for memory devs\n", MEM_MAJOR); - memory_devfs_register(); + + for (i = 0; i < ARRAY_SIZE(devlist); i++) { + devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor), + S_IFCHR | devlist[i].mode, devlist[i].name); + } + rand_initialize(); #if defined (CONFIG_FB) fbmem_init(); diff -puN drivers/char/misc.c~switch-to-devfs_mk_bdev drivers/char/misc.c --- 25/drivers/char/misc.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/misc.c 2003-05-06 22:57:29.000000000 -0700 @@ -200,8 +200,8 @@ int misc_register(struct miscdevice * mi "misc/%s", misc->name); } - devfs_register(NULL, misc->devfs_name, 0, MISC_MAJOR, misc->minor, - S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, misc->fops, NULL); + devfs_mk_cdev(MKDEV(MISC_MAJOR, misc->minor), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, misc->devfs_name); /* * Add it to the front, so that later devices can "override" diff -puN drivers/char/ppdev.c~switch-to-devfs_mk_bdev drivers/char/ppdev.c --- 25/drivers/char/ppdev.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/ppdev.c 2003-05-06 22:57:29.000000000 -0700 @@ -760,10 +760,8 @@ static int __init ppdev_init (void) } devfs_mk_dir("parports"); for (i = 0; i < PARPORT_MAX; i++) { - char name[16]; - sprintf(name, "parports/%d", i); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, PP_MAJOR, i, - S_IFCHR | S_IRUGO | S_IWUGO, &pp_fops, NULL); + devfs_mk_cdev(MKDEV(PP_MAJOR, i), + S_IFCHR | S_IRUGO | S_IWUGO, "parports/%d", i); } printk (KERN_INFO PP_VERSION "\n"); diff -puN drivers/char/stallion.c~switch-to-devfs_mk_bdev drivers/char/stallion.c --- 25/drivers/char/stallion.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/stallion.c 2003-05-06 22:57:29.000000000 -0700 @@ -3216,13 +3216,11 @@ int __init stl_init(void) if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem)) printk("STALLION: failed to register serial board device\n"); devfs_mk_dir("staliomem"); + for (i = 0; i < 4; i++) { - char name[16]; - sprintf(name, "staliomem/%d", i); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, - STL_SIOMEMMAJOR, i, - S_IFCHR | S_IRUSR | S_IWUSR, - &stl_fsiomem, NULL); + devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), + S_IFCHR|S_IRUSR|S_IWUSR, + &stl_fsiomem, NULL, "staliomem/%d", i); } /* diff -puN drivers/char/tipar.c~switch-to-devfs_mk_bdev drivers/char/tipar.c --- 25/drivers/char/tipar.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/tipar.c 2003-05-06 22:57:29.000000000 -0700 @@ -421,8 +421,6 @@ tipar_setup(char *str) static int tipar_register(int nr, struct parport *port) { - char name[32]; - /* Register our module into parport */ table[nr].dev = parport_register_device(port, "tipar", NULL, NULL, NULL, 0, @@ -432,13 +430,9 @@ tipar_register(int nr, struct parport *p return 1; /* Use devfs, tree: /dev/ticables/par/[0..2] */ - sprintf(name, "ticables/par/%d", nr); - printk - ("tipar: registering to devfs : major = %d, minor = %d, node = %s\n", - TISER_MAJOR, (TIPAR_MINOR + nr), name); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, TIPAR_MAJOR, - TIPAR_MINOR + nr, S_IFCHR | S_IRUGO | S_IWUGO, - &tipar_fops, NULL); + devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr), + S_IFCHR | S_IRUGO | S_IWUGO, + "ticables/par/%d", nr); /* Display informations */ printk(KERN_INFO "tipar%d: using %s (%s).\n", nr, port->name, diff -puN drivers/char/tpqic02.c~switch-to-devfs_mk_bdev drivers/char/tpqic02.c --- 25/drivers/char/tpqic02.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/tpqic02.c 2003-05-06 22:57:29.000000000 -0700 @@ -2694,38 +2694,27 @@ int __init qic02_tape_init(void) #endif return -ENODEV; } - devfs_register(NULL, "ntpqic11", DEVFS_FL_DEFAULT, - QIC02_TAPE_MAJOR, 2, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, - &qic02_tape_fops, NULL); - devfs_register(NULL, "tpqic11", DEVFS_FL_DEFAULT, - QIC02_TAPE_MAJOR, 3, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, - &qic02_tape_fops, NULL); - devfs_register(NULL, "ntpqic24", DEVFS_FL_DEFAULT, - QIC02_TAPE_MAJOR, 4, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, - &qic02_tape_fops, NULL); - devfs_register(NULL, "tpqic24", DEVFS_FL_DEFAULT, - QIC02_TAPE_MAJOR, 5, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, - &qic02_tape_fops, NULL); - devfs_register(NULL, "ntpqic120", DEVFS_FL_DEFAULT, - QIC02_TAPE_MAJOR, 6, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, - &qic02_tape_fops, NULL); - devfs_register(NULL, "tpqic120", DEVFS_FL_DEFAULT, - QIC02_TAPE_MAJOR, 7, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, - &qic02_tape_fops, NULL); - devfs_register(NULL, "ntpqic150", DEVFS_FL_DEFAULT, - QIC02_TAPE_MAJOR, 8, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, - &qic02_tape_fops, NULL); - devfs_register(NULL, "tpqic150", DEVFS_FL_DEFAULT, - QIC02_TAPE_MAJOR, 9, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, - &qic02_tape_fops, NULL); + + devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 2), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic11"); + devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 3), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic11"); + + devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 4), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic24"); + devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 5), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic24"); + + devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 6), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic120"); + devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 7), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic120"); + + devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 8), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic150"); + devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 9), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic150"); + init_waitqueue_head(&qic02_tape_transfer); /* prepare timer */ TIMEROFF; diff -puN drivers/char/tty_io.c~switch-to-devfs_mk_bdev drivers/char/tty_io.c --- 25/drivers/char/tty_io.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/tty_io.c 2003-05-06 22:57:29.000000000 -0700 @@ -2100,8 +2100,7 @@ static void tty_register_devfs(struct tt } tty_line_name(driver, index, buf); - devfs_register(NULL, buf, 0, MAJOR(dev), MINOR(dev), - S_IFCHR | S_IRUSR | S_IWUSR, &tty_fops, NULL); + devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR, buf); } static void tty_unregister_devfs(struct tty_driver *driver, int index) @@ -2308,34 +2307,25 @@ void __init tty_init(void) if (register_chrdev_region(TTYAUX_MAJOR, 0, 1, "/dev/tty", &tty_fops) < 0) panic("Couldn't register /dev/tty driver\n"); - - devfs_register (NULL, "tty", 0, TTYAUX_MAJOR, 0, - S_IFCHR | S_IRUGO | S_IWUGO, &tty_fops, NULL); + devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty"); if (register_chrdev_region(TTYAUX_MAJOR, 1, 1, "/dev/console", &tty_fops) < 0) panic("Couldn't register /dev/console driver\n"); - - devfs_register (NULL, "console", 0, TTYAUX_MAJOR, 1, - S_IFCHR | S_IRUSR | S_IWUSR, &tty_fops, NULL); + devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console"); #ifdef CONFIG_UNIX98_PTYS if (register_chrdev_region(TTYAUX_MAJOR, 2, 1, "/dev/ptmx", &tty_fops) < 0) panic("Couldn't register /dev/ptmx driver\n"); - - devfs_register (NULL, "ptmx", 0, TTYAUX_MAJOR, 2, - S_IFCHR | S_IRUGO | S_IWUGO, &tty_fops, NULL); + devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 2), S_IFCHR|S_IRUGO|S_IWUGO, "ptmx"); #endif #ifdef CONFIG_VT if (register_chrdev_region(TTY_MAJOR, 0, 1, "/dev/vc/0", &tty_fops) < 0) panic("Couldn't register /dev/tty0 driver\n"); - - devfs_register (NULL, "vc/0", 0, TTY_MAJOR, 0, - S_IFCHR | S_IRUSR | S_IWUSR, &tty_fops, NULL); - + devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0"); vty_init(); #endif diff -puN drivers/char/vc_screen.c~switch-to-devfs_mk_bdev drivers/char/vc_screen.c --- 25/drivers/char/vc_screen.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/vc_screen.c 2003-05-06 22:57:29.000000000 -0700 @@ -469,40 +469,27 @@ static struct file_operations vcs_fops = .open = vcs_open, }; -void vcs_make_devfs (unsigned int index, int unregister) +void vcs_make_devfs(struct tty_struct *tty) { -#ifdef CONFIG_DEVFS_FS - - if (unregister) { - devfs_remove("vcc/%u", index + 1); - devfs_remove("vcc/a%u", index + 1); - } else { - char name[16]; - sprintf(name, "vcc/%u", index + 1); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, - VCS_MAJOR, index + 1, - S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); - sprintf(name, "vcc/a%u", index + 1); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, - VCS_MAJOR, index + 129, - S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); - } -#endif /* CONFIG_DEVFS_FS */ + devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 1), + S_IFCHR|S_IRUSR|S_IWUSR, + "vcc/%u", tty->index + 1); + devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 129), + S_IFCHR|S_IRUSR|S_IWUSR, + "vcc/a%u", tty->index + 1); +} +void vcs_remove_devfs(struct tty_struct *tty) +{ + devfs_remove("vcc/%u", tty->index + 1); + devfs_remove("vcc/a%u", tty->index + 1); } int __init vcs_init(void) { - int error; - - error = register_chrdev(VCS_MAJOR, "vcs", &vcs_fops); - - if (error) - printk("unable to get major %d for vcs device", VCS_MAJOR); - - devfs_register(NULL, "vcc/0", DEVFS_FL_DEFAULT, VCS_MAJOR, 0, - S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); - devfs_register(NULL, "vcc/a", DEVFS_FL_DEFAULT, VCS_MAJOR, 128, - S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); + if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops)) + panic("unable to get major %d for vcs device", VCS_MAJOR); - return error; + devfs_mk_cdev(MKDEV(VCS_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/0"); + devfs_mk_cdev(MKDEV(VCS_MAJOR, 128), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a0"); + return 0; } diff -puN drivers/char/vt.c~switch-to-devfs_mk_bdev drivers/char/vt.c --- 25/drivers/char/vt.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/char/vt.c 2003-05-06 22:57:29.000000000 -0700 @@ -124,7 +124,9 @@ const struct consw *conswitchp; #define DEFAULT_BELL_PITCH 750 #define DEFAULT_BELL_DURATION (HZ/8) -extern void vcs_make_devfs (unsigned int index, int unregister); +extern void vcs_make_devfs(struct tty_struct *tty); +extern void vcs_remove_devfs(struct tty_struct *tty); + extern void console_map_init(void); #ifdef CONFIG_PROM_CONSOLE extern void prom_con_init(void); @@ -158,7 +160,6 @@ static void set_cursor(int currcons); static void hide_cursor(int currcons); static void unblank_screen_t(unsigned long dummy); static void console_callback(void *ignored); -static void __init con_init_devfs (void); static int printable; /* Is console ready for printing? */ @@ -2410,7 +2411,7 @@ static int con_open(struct tty_struct *t tty->winsize.ws_col = video_num_columns; } if (tty->count == 1) - vcs_make_devfs (currcons, 0); + vcs_make_devfs(tty); return 0; } @@ -2418,10 +2419,10 @@ static void con_close(struct tty_struct { struct vt_struct *vt; - if (!tty) + if (!tty || tty->count != 1) return; - if (tty->count != 1) return; - vcs_make_devfs (tty->index, 1); + + vcs_remove_devfs(tty); vt = (struct vt_struct*)tty->driver_data; if (vt) vc_cons[vt->vc_num].d->vc_tty = NULL; @@ -2525,11 +2526,6 @@ int __init vty_init(void) console_driver.type = TTY_DRIVER_TYPE_CONSOLE; console_driver.init_termios = tty_std_termios; console_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS; - /* Tell tty_register_driver() to skip consoles because they are - * registered before kmalloc() is ready. We'll patch them in later. - * See comments at console_init(); see also con_init_devfs(). - */ - console_driver.flags |= TTY_DRIVER_NO_DEVFS; console_driver.refcount = &console_refcount; console_driver.table = console_table; console_driver.termios = console_termios; @@ -2562,7 +2558,6 @@ int __init vty_init(void) #ifdef CONFIG_FRAMEBUFFER_CONSOLE fb_console_init(); #endif - con_init_devfs(); vcs_init(); return 0; } @@ -2657,18 +2652,6 @@ static void set_vesa_blanking(unsigned l vesa_blank_mode = (mode < 4) ? mode : 0; } -/* We can't register the console with devfs during con_init(), because it - * is called before kmalloc() works. This function is called later to - * do the registration. - */ -static void __init con_init_devfs (void) -{ - int i; - - for (i = 0; i < console_driver.num; i++) - tty_register_device (&console_driver, i); -} - /* * This is called by a timer handler */ diff -puN drivers/i2c/i2c-dev.c~switch-to-devfs_mk_bdev drivers/i2c/i2c-dev.c --- 25/drivers/i2c/i2c-dev.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/i2c/i2c-dev.c 2003-05-06 22:59:32.000000000 -0700 @@ -372,16 +372,11 @@ static int i2cdev_release(struct inode * int i2cdev_attach_adapter(struct i2c_adapter *adap) { - char name[12]; int i; i = i2c_adapter_id(adap); - sprintf (name, "i2c/%d", i); - - devfs_register (NULL, name, - DEVFS_FL_DEFAULT, I2C_MAJOR, i, - S_IFCHR | S_IRUSR | S_IWUSR, - &i2cdev_fops, NULL); + devfs_mk_cdev(MKDEV(I2C_MAJOR, i), + S_IFCHR|S_IRUSR|S_IWUSR, "i2c/%d", i); dev_dbg(&adap->dev, "Registered as minor %d\n", i); return 0; } diff -puN drivers/ide/ide-tape.c~switch-to-devfs_mk_bdev drivers/ide/ide-tape.c --- 25/drivers/ide/ide-tape.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/ide/ide-tape.c 2003-05-06 22:57:33.000000000 -0700 @@ -6292,11 +6292,9 @@ static int idetape_attach (ide_drive_t * devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor) S_IFCHR | S_IRUGO | S_IWUGO, - &idetape_fops, NULL, "%s/mt", drive->devfs_name); devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor + 128), S_IFCHR | S_IRUGO | S_IWUGO, - &idetape_fops, NULL, "%s/mtn", drive->devfs_name); drive->disk->number = devfs_register_tape(drive->devfs_name); diff -puN drivers/ieee1394/amdtp.c~switch-to-devfs_mk_bdev drivers/ieee1394/amdtp.c --- 25/drivers/ieee1394/amdtp.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/ieee1394/amdtp.c 2003-05-06 22:57:33.000000000 -0700 @@ -1205,7 +1205,6 @@ static void amdtp_add_host(struct hpsb_h { struct amdtp_host *ah; int minor; - char name[16]; if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME) != 0) return; @@ -1223,13 +1222,11 @@ static void amdtp_add_host(struct hpsb_h minor = IEEE1394_MINOR_BLOCK_AMDTP * 16 + ah->ohci->id; - sprintf(name, "amdtp/%d", ah->ohci->id); - INIT_LIST_HEAD(&ah->stream_list); spin_lock_init(&ah->stream_list_lock); - devfs_register(NULL, name, 0, IEEE1394_MAJOR, minor, - S_IFCHR | S_IRUSR | S_IWUSR, &amdtp_fops, NULL); + devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor), + S_IFCHR|S_IRUSR|S_IWUSR, "amdtp/%d", ah->ohci->id); } static void amdtp_remove_host(struct hpsb_host *host) diff -puN drivers/ieee1394/dv1394.c~switch-to-devfs_mk_bdev drivers/ieee1394/dv1394.c --- 25/drivers/ieee1394/dv1394.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/ieee1394/dv1394.c 2003-05-06 22:57:33.000000000 -0700 @@ -2420,24 +2420,6 @@ static struct file_operations dv1394_fop }; -#ifdef CONFIG_DEVFS_FS -static int dv1394_devfs_add_entry(struct video_card *video) -{ - char buf[64]; - - snprintf(buf, sizeof(buf), "ieee1394/dv/host%d/%s/%s", - (video->id>>2), - (video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"), - (video->mode == MODE_RECEIVE ? "in" : "out")); - - devfs_register(NULL, buf, 0, IEEE1394_MAJOR, - IEEE1394_MINOR_BLOCK_DV1394*16 + video->id, - S_IFCHR | S_IRUGO | S_IWUGO, &dv1394_fops, video); - return 0; -} -#endif /* CONFIG_DEVFS_FS */ - - /*** HOTPLUG STUFF **********************************************************/ /* * Export information about protocols/devices supported by this driver. @@ -2536,10 +2518,14 @@ static int dv1394_init(struct ti_ohci *o list_add_tail(&video->list, &dv1394_cards); spin_unlock_irqrestore(&dv1394_cards_lock, flags); -#ifdef CONFIG_DEVFS_FS - if (dv1394_devfs_add_entry(video) < 0) + if (devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, + IEEE1394_MINOR_BLOCK_DV1394*16 + video->id), + S_IFCHR|S_IRUGO|S_IWUGO, + "ieee1394/dv/host%d/%s/%s", + (video->id>>2), + (video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"), + (video->mode == MODE_RECEIVE ? "in" : "out")) < 0) goto err_free; -#endif debug_printk("dv1394: dv1394_init() OK on ID %d\n", video->id); @@ -2562,9 +2548,7 @@ static void dv1394_un_init(struct video_ (video->mode == MODE_RECEIVE ? "in" : "out") ); -#ifdef CONFIG_DEVFS_FS devfs_remove("ieee1394/%s", buf); -#endif #ifdef CONFIG_PROC_FS dv1394_procfs_del(buf); #endif @@ -2602,11 +2586,9 @@ static void dv1394_remove_host (struct h n = (video->id >> 2); -#ifdef CONFIG_DEVFS_FS devfs_remove("ieee1394/dv/host%d/NTSC", n); devfs_remove("ieee1394/dv/host%d/PAL", n); devfs_remove("ieee1394/dv/host%d", n); -#endif #ifdef CONFIG_PROC_FS snprintf(buf, sizeof(buf), "dv/host%d/NTSC", n); @@ -2642,11 +2624,9 @@ static void dv1394_add_host (struct hpsb } #endif -#ifdef CONFIG_DEVFS_FS devfs_mk_dir("ieee1394/dv/host%d", ohci->id); devfs_mk_dir("ieee1394/dv/host%d/NTSC", ohci->id); devfs_mk_dir("ieee1394/dv/host%d/PAL", ohci->id); -#endif dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE); dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT); @@ -2901,9 +2881,7 @@ static void __exit dv1394_exit_module(vo hpsb_unregister_highlevel(&dv1394_highlevel); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_DV1394); -#ifdef CONFIG_DEVFS_FS devfs_remove("ieee1394/dv"); -#endif #ifdef CONFIG_PROC_FS dv1394_procfs_del("dv"); #endif @@ -2920,18 +2898,14 @@ static int __init dv1394_init_module(voi return -EIO; } -#ifdef CONFIG_DEVFS_FS devfs_mk_dir("ieee1394/dv"); -#endif #ifdef CONFIG_PROC_FS ret = dv1394_procfs_add_dir("dv",NULL,NULL); if (ret < 0) { printk(KERN_ERR "dv1394: unable to create /proc/bus/ieee1394/dv\n"); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_DV1394); -#ifdef CONFIG_DEVFS_FS devfs_remove("ieee1394/dv"); -#endif return -ENOMEM; } #endif diff -puN drivers/ieee1394/raw1394.c~switch-to-devfs_mk_bdev drivers/ieee1394/raw1394.c --- 25/drivers/ieee1394/raw1394.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/ieee1394/raw1394.c 2003-05-06 22:57:33.000000000 -0700 @@ -2531,9 +2531,8 @@ static int __init init_raw1394(void) { hpsb_register_highlevel(&raw1394_highlevel); - devfs_register(NULL, RAW1394_DEVICE_NAME, 0, - IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16, - S_IFCHR | S_IRUSR | S_IWUSR, &file_ops, NULL); + devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), + S_IFCHR | S_IRUSR | S_IWUSR, RAW1394_DEVICE_NAME); if (ieee1394_register_chardev(IEEE1394_MINOR_BLOCK_RAW1394, THIS_MODULE, &file_ops)) { diff -puN drivers/ieee1394/video1394.c~switch-to-devfs_mk_bdev drivers/ieee1394/video1394.c --- 25/drivers/ieee1394/video1394.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/ieee1394/video1394.c 2003-05-06 22:57:33.000000000 -0700 @@ -1257,7 +1257,6 @@ static struct hpsb_protocol_driver video static void video1394_add_host (struct hpsb_host *host) { struct ti_ohci *ohci; - char name[16]; int minor; /* We only work with the OHCI-1394 driver */ @@ -1274,12 +1273,10 @@ static void video1394_add_host (struct h hpsb_set_hostinfo(&video1394_highlevel, host, ohci); hpsb_set_hostinfo_key(&video1394_highlevel, host, ohci->id); - sprintf(name, "%s/%d", VIDEO1394_DRIVER_NAME, ohci->id); - minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->id; - devfs_register(NULL, name, 0, IEEE1394_MAJOR, minor, - S_IFCHR | S_IRUSR | S_IWUSR, &video1394_fops, NULL); - - return; + minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->id; + devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor), + S_IFCHR | S_IRUSR | S_IWUSR, + "%s/%d", VIDEO1394_DRIVER_NAME, ohci->id); } diff -puN drivers/isdn/capi/capi.c~switch-to-devfs_mk_bdev drivers/isdn/capi/capi.c --- 25/drivers/isdn/capi/capi.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/isdn/capi/capi.c 2003-05-06 22:57:33.000000000 -0700 @@ -1476,9 +1476,9 @@ static int __init capi_init(void) return -EIO; } - devfs_register (NULL, "isdn/capi20", DEVFS_FL_DEFAULT, - capi_major, 0, S_IFCHR | S_IRUSR | S_IWUSR, - &capi_fops, NULL); + devfs_mk_cdev(MKDEV(capi_major, 0), S_IFCHR | S_IRUSR | S_IWUSR, + "isdn/capi20"); + printk(KERN_NOTICE "capi20: started up with major %d\n", capi_major); #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE diff -puN drivers/isdn/hardware/eicon/divamnt.c~switch-to-devfs_mk_bdev drivers/isdn/hardware/eicon/divamnt.c --- 25/drivers/isdn/hardware/eicon/divamnt.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/isdn/hardware/eicon/divamnt.c 2003-05-06 22:57:33.000000000 -0700 @@ -420,10 +420,8 @@ static int DIVA_INIT_FUNCTION divas_main DRIVERLNAME); return (0); } - devfs_register(NULL, "DivasMAINT", DEVFS_FL_DEFAULT, major, 0, - S_IFCHR | S_IRUSR | S_IWUSR, &divas_maint_fops, - NULL); + devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DivasMAINT); return (1); } diff -puN drivers/isdn/hardware/eicon/divasi.c~switch-to-devfs_mk_bdev drivers/isdn/hardware/eicon/divasi.c --- 25/drivers/isdn/hardware/eicon/divasi.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/isdn/hardware/eicon/divasi.c 2003-05-06 22:57:33.000000000 -0700 @@ -179,10 +179,8 @@ static int DIVA_INIT_FUNCTION divas_idi_ DRIVERLNAME); return (0); } - devfs_register(NULL, "DivasIDI", DEVFS_FL_DEFAULT, major, 0, - S_IFCHR | S_IRUSR | S_IWUSR, &divas_idi_fops, - NULL); + devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, "DivasIDI"); return (1); } diff -puN drivers/isdn/hardware/eicon/divasmain.c~switch-to-devfs_mk_bdev drivers/isdn/hardware/eicon/divasmain.c --- 25/drivers/isdn/hardware/eicon/divasmain.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/isdn/hardware/eicon/divasmain.c 2003-05-06 22:57:33.000000000 -0700 @@ -788,9 +788,8 @@ static int DIVA_INIT_FUNCTION divas_regi DRIVERLNAME); return (0); } - devfs_register(NULL, "Divas", DEVFS_FL_DEFAULT, major, 0, - S_IFCHR | S_IRUSR | S_IWUSR, &divas_fops, NULL); + devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, "Divas"); return (1); } diff -puN drivers/isdn/i4l/isdn_common.c~switch-to-devfs_mk_bdev drivers/isdn/i4l/isdn_common.c --- 25/drivers/isdn/i4l/isdn_common.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/isdn/i4l/isdn_common.c 2003-05-06 22:57:33.000000000 -0700 @@ -37,9 +37,6 @@ isdn_dev *dev; static void isdn_lock_driver(struct isdn_driver *drv); static void isdn_unlock_driver(struct isdn_driver *drv); -static void isdn_register_devfs(int); -static void isdn_unregister_devfs(int); - /* ====================================================================== */ /* Description of hardware-level-driver */ @@ -2157,86 +2154,38 @@ isdn_hard_header_len(void) return max; } -/* - ***************************************************************************** - * And now the modules code. - ***************************************************************************** - */ - -#ifdef CONFIG_DEVFS_FS - -static void isdn_register_devfs(int k) -{ - char buf[16]; - - sprintf (buf, "isdn/isdnctrl%d", k); - devfs_register(NULL, buf, DEVFS_FL_DEFAULT, - ISDN_MAJOR, ISDN_MINOR_CTRL + k, 0600 | S_IFCHR, - &isdn_fops, NULL); -} - -static void isdn_unregister_devfs(int k) +static void isdn_init_devfs(void) { - devfs_remove("isdn/isdnctrl%d", k); -} + devfs_mk_dir("isdn"); -static void isdn_init_devfs(void) +#ifdef CONFIG_ISDN_PPP { -# ifdef CONFIG_ISDN_PPP int i; -# endif - devfs_mk_dir("isdn"); -# ifdef CONFIG_ISDN_PPP - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - char buf[16]; + for (i = 0; i < ISDN_MAX_CHANNELS; i++) + devfs_mk_cdev(MKDEV(ISDN_MAJOR, ISDN_MINOR_PPP + i), + 0600 | S_IFCHR, "isdn/ippp%d", i); +} +#endif - sprintf (buf, "isdn/ippp%d", i); - devfs_register(NULL, buf, DEVFS_FL_DEFAULT, - ISDN_MAJOR, ISDN_MINOR_PPP + i, - 0600 | S_IFCHR, &isdn_fops, NULL); - } -# endif - - devfs_register(NULL, "isdn/isdninfo", DEVFS_FL_DEFAULT, - ISDN_MAJOR, ISDN_MINOR_STATUS, 0600 | S_IFCHR, - &isdn_fops, NULL); - devfs_register(NULL, "isdn/isdnctrl", DEVFS_FL_DEFAULT, - ISDN_MAJOR, ISDN_MINOR_CTRL, 0600 | S_IFCHR, - &isdn_fops, NULL); + devfs_mk_cdev(MKDEV(ISDN_MAJOR, ISDN_MINOR_STATUS), + 0600 | S_IFCHR, "isdn/isdninfo"); + devfs_mk_cdev(MKDEV(ISDN_MAJOR, ISDN_MINOR_CTRL), + 0600 | S_IFCHR, "isdn/isdnctrl"); } static void isdn_cleanup_devfs(void) { -# ifdef CONFIG_ISDN_PPP +#ifdef CONFIG_ISDN_PPP int i; for (i = 0; i < ISDN_MAX_CHANNELS; i++) devfs_remove("isdn/ippp%d", i); -# endif +#endif devfs_remove("isdn/isdninfo"); devfs_remove("isdn/isdnctrl"); devfs_remove("isdn"); } -#else /* CONFIG_DEVFS_FS */ -static void isdn_register_devfs(int dummy) -{ -} - -static void isdn_unregister_devfs(int dummy) -{ -} - -static void isdn_init_devfs(void) -{ -} - -static void isdn_cleanup_devfs(void) -{ -} - -#endif /* CONFIG_DEVFS_FS */ - /* * Allocate and initialize all data, register modem-devices */ diff -puN drivers/macintosh/adb.c~switch-to-devfs_mk_bdev drivers/macintosh/adb.c --- 25/drivers/macintosh/adb.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/macintosh/adb.c 2003-05-06 22:57:33.000000000 -0700 @@ -896,8 +896,6 @@ adbdev_init(void) if (register_chrdev(ADB_MAJOR, "adb", &adb_fops)) printk(KERN_ERR "adb: unable to get major %d\n", ADB_MAJOR); else - devfs_register (NULL, "adb", DEVFS_FL_DEFAULT, - ADB_MAJOR, 0, - S_IFCHR | S_IRUSR | S_IWUSR, - &adb_fops, NULL); + devfs_mk_cdev(MKDEV(ADB_MAJOR, 0), + S_IFCHR | S_IRUSR | S_IWUSR, "adb"); } diff -puN drivers/media/dvb/dvb-core/dvbdev.c~switch-to-devfs_mk_bdev drivers/media/dvb/dvb-core/dvbdev.c --- 25/drivers/media/dvb/dvb-core/dvbdev.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/media/dvb/dvb-core/dvbdev.c 2003-05-06 22:57:33.000000000 -0700 @@ -189,7 +189,6 @@ int dvb_register_device(struct dvb_adapt const struct dvb_device *template, void *priv, int type) { u32 id; - char name [20]; struct dvb_device *dvbdev; if (down_interruptible (&dvbdev_register_lock)) @@ -219,12 +218,12 @@ int dvb_register_device(struct dvb_adapt list_add_tail (&dvbdev->list_head, &adap->device_list); - sprintf(name, "dvb/adapter%d%s%d", adap->num, dnames[type], id); - devfs_register(NULL, name, 0, DVB_MAJOR, nums2minor(adap->num, type, id), - S_IFCHR | S_IRUSR | S_IWUSR, dvbdev->fops, dvbdev); + devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), + S_IFCHR | S_IRUSR | S_IWUSR, + "dvb/adapter%d%s%d", adap->num, dnames[type], id); - dprintk("DVB: register adapter%d/%s @ minor: %i (0x%02x)\n", - adap->num, name, nums2minor(adap->num, type, id), + dprintk("DVB: register adapter%d%s%d @ minor: %i (0x%02x)\n", + adap->num, dnames[type], id, nums2minor(adap->num, type, id), nums2minor(adap->num, type, id)); return 0; @@ -322,12 +321,12 @@ static int __init init_dvbdev(void) { devfs_mk_dir("dvb"); -#ifndef CONFIG_DVB_DEVFS_ONLY + if(register_chrdev(DVB_MAJOR,"DVB", &dvb_device_fops)) { printk("video_dev: unable to get major %d\n", DVB_MAJOR); return -EIO; } -#endif + return 0; } @@ -335,9 +334,7 @@ int __init init_dvbdev(void) static void __exit exit_dvbdev(void) { -#ifndef CONFIG_DVB_DEVFS_ONLY unregister_chrdev(DVB_MAJOR, "DVB"); -#endif devfs_remove("dvb"); } diff -puN drivers/media/video/videodev.c~switch-to-devfs_mk_bdev drivers/media/video/videodev.c --- 25/drivers/media/video/videodev.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/media/video/videodev.c 2003-05-06 22:57:33.000000000 -0700 @@ -427,8 +427,8 @@ int video_register_device(struct video_d up(&videodev_lock); sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base); - devfs_register(NULL, vfd->devfs_name, 0, VIDEO_MAJOR, vfd->minor, - S_IFCHR | S_IRUSR | S_IWUSR, &video_fops, NULL); + devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor), + S_IFCHR | S_IRUSR | S_IWUSR, vfd->devfs_name); init_MUTEX(&vfd->lock); #ifdef CONFIG_VIDEO_PROC_FS diff -puN drivers/mtd/mtdchar.c~switch-to-devfs_mk_bdev drivers/mtd/mtdchar.c --- 25/drivers/mtd/mtdchar.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/mtd/mtdchar.c 2003-05-06 22:57:33.000000000 -0700 @@ -461,22 +461,12 @@ static struct file_operations mtd_fops = static void mtd_notify_add(struct mtd_info* mtd) { - char name[16]; - if (!mtd) return; - - sprintf(name, "mtd/%d", mtd->index); - devfs_register(NULL, name, - DEVFS_FL_DEFAULT, MTD_CHAR_MAJOR, mtd->index*2, - S_IFCHR | S_IRUGO | S_IWUGO, - &mtd_fops, NULL); - - sprintf(name, "mtd/%dro", mtd->index); - devfs_register(NULL, name, - DEVFS_FL_DEFAULT, MTD_CHAR_MAJOR, mtd->index*2+1, - S_IFCHR | S_IRUGO | S_IWUGO, - &mtd_fops, NULL); + devfs_mk_cdev(MKDEV(MTD_CHAR_MAJOR, mtd->index*2), + S_IFCHR | S_IRUGO | S_IWUGO, "mtd/%d", mtd->index); + devfs_mk_cdev(MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1), + S_IFCHR | S_IRUGO | S_IWUGO, "mtd/%dro", mtd->index); } static void mtd_notify_remove(struct mtd_info* mtd) diff -puN drivers/net/ppp_generic.c~switch-to-devfs_mk_bdev drivers/net/ppp_generic.c --- 25/drivers/net/ppp_generic.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/net/ppp_generic.c 2003-05-06 22:57:33.000000000 -0700 @@ -784,11 +784,14 @@ int __init ppp_init(void) printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n"); err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops); - if (err) + if (!err) { + err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0), + S_IFCHR|S_IRUSR|S_IWUSR, "ppp"); + } + + if (!err) printk(KERN_ERR "failed to register PPP device (%d)\n", err); - devfs_register(NULL, "ppp", DEVFS_FL_DEFAULT, PPP_MAJOR, 0, - S_IFCHR | S_IRUSR | S_IWUSR, &ppp_device_fops, NULL); - return 0; + return err; } /* diff -puN drivers/net/wan/cosa.c~switch-to-devfs_mk_bdev drivers/net/wan/cosa.c --- 25/drivers/net/wan/cosa.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/net/wan/cosa.c 2003-05-06 22:57:33.000000000 -0700 @@ -392,12 +392,9 @@ static int __init cosa_init(void) } devfs_mk_dir("cosa"); for (i=0; iminor), + S_IFCHR|S_IRUSR|S_IWUSR, "3270/tub%.4x"); TUBUNLOCK(tubp->irq, flags); return minor; @@ -492,9 +491,7 @@ tubfiniminors(void) for (i = 0; i < TUBMAXMINS; i++) { tubpp = &(*tubminors)[i]; if ((tubp = *tubpp)) { -#ifdef CONFIG_DEVFS_FS - fs3270_devfs_unregister(tubp); -#endif + devfs_remove("3270/tub%.4x", tubp->devno); tubdelbyirq(tubp, tubp->irq); tty3270_rcl_fini(tubp); kfree(tubp->tty_bcb.bc_buf); diff -puN drivers/s390/char/tubfs.c~switch-to-devfs_mk_bdev drivers/s390/char/tubfs.c --- 25/drivers/s390/char/tubfs.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/s390/char/tubfs.c 2003-05-06 22:57:33.000000000 -0700 @@ -23,9 +23,7 @@ static void fs3270_int(tub_t *tubp, devs extern void tty3270_refresh(tub_t *); static struct file_operations fs3270_fops = { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)) .owner = THIS_MODULE, /* owner */ -#endif .read = fs3270_read, /* read */ .write = fs3270_write, /* write */ .ioctl = fs3270_ioctl, /* ioctl */ @@ -33,27 +31,6 @@ static struct file_operations fs3270_fop .release = fs3270_close, /* release */ }; -#ifdef CONFIG_DEVFS_FS -void fs3270_devfs_register(tub_t *tubp) -{ - char name[16]; - - sprintf(name, "3270/tub%.4x", tubp->devno); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, - IBM_FS3270_MAJOR, tubp->minor, - S_IFCHR | S_IRUSR | S_IWUSR, &fs3270_fops, NULL); - sprintf(name, "tty%.4x", tubp->devno); - tty_register_devfs_name(&tty3270_driver, 0, tubp->minor, - NULL, name); -} - -void fs3270_devfs_unregister(tub_t *tubp) -{ - devfs_remove("3270/tub%.4x", tubp->devno); - devfs_remove("3270/tty%.4x", tubp->devno); -} -#endif - /* * fs3270_init() -- Initialize fullscreen tubes */ @@ -69,10 +46,8 @@ fs3270_init(void) return -1; } devfs_mk_dir("3270"); - devfs_register(NULL, "3270/tub", 0, - IBM_FS3270_MAJOR, 0, - S_IFCHR | S_IRUGO | S_IWUGO, - &fs3270_fops, NULL); + devfs_mk_cdev(MKDEV(IBM_FS3270_MAJOR, 0), + S_IFCHR|S_IRUGO|S_IWUGO, "3270/tub"); fs3270_major = IBM_FS3270_MAJOR; return 0; } diff -puN drivers/s390/char/tubio.h~switch-to-devfs_mk_bdev drivers/s390/char/tubio.h --- 25/drivers/s390/char/tubio.h~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/s390/char/tubio.h 2003-05-06 22:57:33.000000000 -0700 @@ -337,10 +337,6 @@ extern int tty3270_major; extern int tty3270_proc_misc; extern enum tubwhat tty3270_proc_what; extern struct tty_driver tty3270_driver; -#ifdef CONFIG_DEVFS_FS -extern void fs3270_devfs_register(tub_t *); -extern void fs3270_devfs_unregister(tub_t *); -#endif #ifndef spin_trylock_irqsave #define spin_trylock_irqsave(lock, flags) \ diff -puN drivers/s390/char/tubtty.c~switch-to-devfs_mk_bdev drivers/s390/char/tubtty.c --- 25/drivers/s390/char/tubtty.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/s390/char/tubtty.c 2003-05-06 22:57:33.000000000 -0700 @@ -90,9 +90,7 @@ tty3270_init(void) td->subtype = SYSTEM_TYPE_TTY; td->init_termios = tty_std_termios; td->flags = TTY_DRIVER_RESET_TERMIOS; -#ifdef CONFIG_DEVFS_FS td->flags |= TTY_DRIVER_NO_DEVFS; -#endif td->refcount = &tty3270_refcount; td->table = tty3270_table; td->termios = tty3270_termios; diff -puN drivers/sbus/char/bpp.c~switch-to-devfs_mk_bdev drivers/sbus/char/bpp.c --- 25/drivers/sbus/char/bpp.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/sbus/char/bpp.c 2003-05-06 22:57:33.000000000 -0700 @@ -1051,11 +1051,8 @@ static int __init bpp_init(void) } devfs_mk_dir("bpp"); for (idx = 0; idx < BPP_NO; idx++) { - char name[16]; - sprintf(name, "bpp/%d", idx); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, - BPP_MAJOR, idx, S_IFCHR | S_IRUSR | S_IWUSR, - &bpp_fops, NULL); + devfs_mk_cdev(MKDEV(BPP_MAJOR, idx), + S_IFCHR | S_IRUSR | S_IWUSR, "bpp/%d", idx); } return 0; diff -puN drivers/sbus/char/vfc_dev.c~switch-to-devfs_mk_bdev drivers/sbus/char/vfc_dev.c --- 25/drivers/sbus/char/vfc_dev.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/sbus/char/vfc_dev.c 2003-05-06 22:57:33.000000000 -0700 @@ -143,8 +143,6 @@ int init_vfc_devstruct(struct vfc_dev *d int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance) { - char devname[16]; - if(dev == NULL) { printk(KERN_ERR "VFC: Bogus pointer passed\n"); return -ENOMEM; @@ -167,11 +165,9 @@ int init_vfc_device(struct sbus_dev *sde if (init_vfc_hw(dev)) return -EIO; - sprintf (devname, "vfc/%d", instance); - dev->de = devfs_register (NULL, devname, DEVFS_FL_DEFAULT, - VFC_MAJOR, instance, - S_IFCHR | S_IRUSR | S_IWUSR, - &vfc_fops, NULL); + devfs_mk_cdev(MKDEV(VFC_MAJOR, instance), + S_IFCHR | S_IRUSR | S_IWUSR, + "vfc/%d", instance); return 0; } diff -puN drivers/scsi/osst.c~switch-to-devfs_mk_bdev drivers/scsi/osst.c --- 25/drivers/scsi/osst.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/scsi/osst.c 2003-05-06 22:57:33.000000000 -0700 @@ -5527,11 +5527,10 @@ static int osst_attach(Scsi_Device * SDp write_unlock(&os_scsi_tapes_lock); for (mode = 0; mode < ST_NBR_MODES; ++mode) { - char name[8], devfs_name[64]; + char name[8]; /* Rewind entry */ sprintf(name, "ot%s", osst_formats[mode]); - sprintf(devfs_name, "%s/ot%s", SDp->devfs_name, osst_formats[mode]); sprintf(tpnt->driverfs_dev_r[mode].bus_id, "%s:%s", SDp->sdev_driverfs_dev.bus_id, name); @@ -5545,13 +5544,13 @@ static int osst_attach(Scsi_Device * SDp device_create_file(&tpnt->driverfs_dev_r[mode], &dev_attr_type); device_create_file(&tpnt->driverfs_dev_r[mode], &dev_attr_kdev); - devfs_register(NULL, devfs_name, 0, - OSST_MAJOR, dev_num + (mode << 5), - S_IFCHR | S_IRUGO | S_IWUGO, - &osst_fops, NULL); + + devfs_mk_cdev(MKDEV(OSST_MAJOR, dev_num + (mode << 5)), + S_IFCHR | S_IRUGO | S_IWUGO, + "%s/ot%s", SDp->devfs_name, osst_formats[mode]); + /* No-rewind entry */ sprintf (name, "ot%sn", osst_formats[mode]); - sprintf(devfs_name, "%s/ot%sn", SDp->devfs_name, osst_formats[mode]); sprintf(tpnt->driverfs_dev_n[mode].bus_id, "%s:%s", SDp->sdev_driverfs_dev.bus_id, name); @@ -5566,10 +5565,10 @@ static int osst_attach(Scsi_Device * SDp &dev_attr_type); device_create_file(&tpnt->driverfs_dev_n[mode], &dev_attr_kdev); - devfs_register(NULL, devfs_name, 0, - OSST_MAJOR, dev_num + (mode << 5) + 128, - S_IFCHR | S_IRUGO | S_IWUGO, - &osst_fops, NULL); + + devfs_mk_cdev(MKDEV(OSST_MAJOR, dev_num + (mode << 5) + 128), + S_IFCHR | S_IRUGO | S_IWUGO, + "%s/ot%sn", SDp->devfs_name, osst_formats[mode]); } drive->number = devfs_register_tape(SDp->devfs_name); diff -puN drivers/scsi/sg.c~switch-to-devfs_mk_bdev drivers/scsi/sg.c --- 25/drivers/scsi/sg.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/scsi/sg.c 2003-05-06 22:57:33.000000000 -0700 @@ -1350,7 +1350,6 @@ sg_attach(Scsi_Device * scsidp) struct gendisk *disk; Sg_device *sdp = NULL; unsigned long iflags; - char devfs_name[64]; int k, error; disk = alloc_disk(1); @@ -1449,11 +1448,9 @@ find_empty_slot: device_create_file(&sdp->sg_driverfs_dev, &dev_attr_type); device_create_file(&sdp->sg_driverfs_dev, &dev_attr_kdev); - sprintf(devfs_name, "%s/generic", scsidp->devfs_name); - devfs_register(NULL, devfs_name, 0, - SCSI_GENERIC_MAJOR, k, + devfs_mk_cdev(MKDEV(SCSI_GENERIC_MAJOR, k), S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP, - &sg_fops, sdp); + "%s/generic", scsidp->devfs_name); switch (scsidp->type) { case TYPE_DISK: diff -puN drivers/scsi/st.c~switch-to-devfs_mk_bdev drivers/scsi/st.c --- 25/drivers/scsi/st.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/scsi/st.c 2003-05-06 22:57:33.000000000 -0700 @@ -3865,11 +3865,10 @@ static int st_attach(Scsi_Device * SDp) write_unlock(&st_dev_arr_lock); for (mode = 0; mode < ST_NBR_MODES; ++mode) { - char name[8], devfs_name[64]; + char name[8]; /* Rewind entry */ sprintf(name, "mt%s", st_formats[mode]); - sprintf(devfs_name, "%s/mt%s", SDp->devfs_name, st_formats[mode]); sprintf(tpnt->driverfs_dev_r[mode].bus_id, "%s:%s", SDp->sdev_driverfs_dev.bus_id, name); @@ -3883,13 +3882,12 @@ static int st_attach(Scsi_Device * SDp) device_create_file(&tpnt->driverfs_dev_r[mode], &dev_attr_type); device_create_file(&tpnt->driverfs_dev_r[mode], &dev_attr_kdev); - devfs_register(NULL, devfs_name, 0, - SCSI_TAPE_MAJOR, dev_num + (mode << 5), + devfs_mk_cdev(MKDEV(SCSI_TAPE_MAJOR, dev_num + (mode << 5)), S_IFCHR | S_IRUGO | S_IWUGO, - &st_fops, NULL); + "%s/mt%s", SDp->devfs_name, st_formats[mode]); + /* No-rewind entry */ sprintf (name, "mt%sn", st_formats[mode]); - sprintf(devfs_name, "%s/mt%sn", SDp->devfs_name, st_formats[mode]); sprintf(tpnt->driverfs_dev_n[mode].bus_id, "%s:%s", SDp->sdev_driverfs_dev.bus_id, name); @@ -3904,10 +3902,9 @@ static int st_attach(Scsi_Device * SDp) &dev_attr_type); device_create_file(&tpnt->driverfs_dev_n[mode], &dev_attr_kdev); - devfs_register(NULL, devfs_name, 0, - SCSI_TAPE_MAJOR, dev_num + (mode << 5) + 128, + devfs_mk_cdev(MKDEV(SCSI_TAPE_MAJOR, dev_num + (mode << 5) + 128), S_IFCHR | S_IRUGO | S_IWUGO, - &st_fops, NULL); + "%s/mt%sn", SDp->devfs_name, st_formats[mode]); } disk->number = devfs_register_tape(SDp->devfs_name); diff -puN drivers/sgi/char/shmiq.c~switch-to-devfs_mk_bdev drivers/sgi/char/shmiq.c --- 25/drivers/sgi/char/shmiq.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/sgi/char/shmiq.c 2003-05-06 22:57:33.000000000 -0700 @@ -470,9 +470,8 @@ shmiq_init (void) printk ("SHMIQ setup\n"); register_chrdev(SHMIQ_MAJOR, "shmiq", &shmiq_fops); for (i = 0; i < 3; i++) { - devfs_register (NULL, names[i], DEVFS_FL_DEFAULT, - SHMIQ_MAJOR, i, S_IFCHR | S_IRUSR | S_IWUSR, - &shmiq_fops, NULL); + devfs_mk_cdev(MKDEV(SHMIQ_MAJOR, i), + S_IFCHR | S_IRUSR | S_IWUSR, names[i]); } } diff -puN drivers/usb/class/usblp.c~switch-to-devfs_mk_bdev drivers/usb/class/usblp.c --- 25/drivers/usb/class/usblp.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/usb/class/usblp.c 2003-05-06 22:57:33.000000000 -0700 @@ -816,7 +816,6 @@ static int usblp_probe(struct usb_interf struct usblp *usblp = 0; int protocol; int retval; - char name[10]; /* Malloc and start initializing usblp structure so we can use it * directly. */ @@ -905,11 +904,9 @@ static int usblp_probe(struct usb_interf #endif /* If we have devfs, create with perms=660. */ - sprintf(name, "usb/lp%d", usblp->minor); - devfs_register(NULL, name, 0, USB_MAJOR, - usblp->minor, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | - S_IWGRP, &usblp_fops, NULL); + devfs_mk_cdev(MKDEV(USB_MAJOR, usblp->minor), + S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, + "usb/lp%d", usblp->minor); info("usblp%d: USB %sdirectional printer dev %d " "if %d alt %d proto %d vid 0x%4.4X pid 0x%4.4X", diff -puN drivers/usb/image/scanner.c~switch-to-devfs_mk_bdev drivers/usb/image/scanner.c --- 25/drivers/usb/image/scanner.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/usb/image/scanner.c 2003-05-06 22:57:33.000000000 -0700 @@ -883,7 +883,6 @@ probe_scanner(struct usb_interface *intf char valid_device = 0; char have_bulk_in, have_bulk_out, have_intr; - char name[14]; dbg("probe_scanner: USB dev address:%p", dev); @@ -1104,16 +1103,9 @@ probe_scanner(struct usb_interface *intf scn->scn_minor = scn_minor; scn->isopen = 0; - sprintf(name, "usb/scanner%d", scn->scn_minor - SCN_BASE_MNR); - - devfs_register(NULL, name, - DEVFS_FL_DEFAULT, USB_MAJOR, - scn->scn_minor, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | - S_IWGRP | S_IROTH | S_IWOTH, &usb_scanner_fops, NULL); - - info ("USB scanner device (0x%04x/0x%04x) now attached to %s", - dev->descriptor.idVendor, dev->descriptor.idProduct, name); + devfs_mk_cdev(MKDEV(USB_MAJOR, scn->scn_minor), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH, + "usb/scanner%d", scn->scn_minor - SCN_BASE_MNR); up(&scn_mutex); diff -puN drivers/usb/input/hiddev.c~switch-to-devfs_mk_bdev drivers/usb/input/hiddev.c --- 25/drivers/usb/input/hiddev.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/usb/input/hiddev.c 2003-05-06 22:57:33.000000000 -0700 @@ -683,7 +683,6 @@ int hiddev_connect(struct hid_device *hi struct hiddev *hiddev; int minor, i; int retval; - char devfs_name[24]; for (i = 0; i < hid->maxcollection; i++) if (hid->collection[i].type == @@ -714,13 +713,12 @@ int hiddev_connect(struct hid_device *hi hiddev->hid = hid; hiddev->exist = 1; - sprintf(devfs_name, "usb/hid/hiddev%d", minor); - devfs_register(NULL, devfs_name, 0, - USB_MAJOR, minor + HIDDEV_MINOR_BASE, - S_IFCHR | S_IRUGO | S_IWUSR, &hiddev_fops, NULL); + devfs_mk_cdev(MKDEV(USB_MAJOR, minor + HIDDEV_MINOR_BASE), + S_IFCHR | S_IRUGO | S_IWUSR, + "usb/hid/hiddev%d", minor); + hid->minor = minor; hid->hiddev = hiddev; - return 0; } diff -puN drivers/usb/misc/auerswald.c~switch-to-devfs_mk_bdev drivers/usb/misc/auerswald.c --- 25/drivers/usb/misc/auerswald.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/usb/misc/auerswald.c 2003-05-06 22:57:33.000000000 -0700 @@ -1971,10 +1971,8 @@ static int auerswald_probe (struct usb_i up (&dev_table_mutex); /* initialize the devfs node for this device and register it */ - devfs_register(NULL, cp->name, 0, USB_MAJOR, - AUER_MINOR_BASE + dtindex, - S_IFCHR | S_IRUGO | S_IWUGO, - &auerswald_fops, NULL); + devfs_mk_cdev(MKDEV(USB_MAJOR, AUER_MINOR_BASE + dtindex). + S_IFCHR|S_IRUGO|S_IWUGO, cp->name); /* Get the usb version of the device */ cp->version = cp->usbdev->descriptor.bcdDevice; diff -puN drivers/usb/misc/brlvger.c~switch-to-devfs_mk_bdev drivers/usb/misc/brlvger.c --- 25/drivers/usb/misc/brlvger.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/usb/misc/brlvger.c 2003-05-06 22:57:33.000000000 -0700 @@ -291,7 +291,6 @@ brlvger_probe (struct usb_interface *int /* protects against reentrance: once we've found a free slot we reserve it.*/ static DECLARE_MUTEX(reserve_sem); - char devfs_name[20]; actifsettings = dev->actconfig->interface->altsetting; @@ -372,12 +371,9 @@ brlvger_probe (struct usb_interface *int }; dbg("Display length: %d", priv->plength); - sprintf(devfs_name, "usb/brlvger%d", priv->subminor); - devfs_register(NULL, devfs_name, - DEVFS_FL_DEFAULT, USB_MAJOR, - BRLVGER_MINOR+priv->subminor, - S_IFCHR |S_IRUSR|S_IWUSR |S_IRGRP|S_IWGRP, - &brlvger_fops, NULL); + devfs_mk_cdev(MKDEV(USB_MAJOR, BRLVGER_MINOR+priv->subminor), + S_IFCHR|S_IRUSR|S_IWUSR |S_IRGRP|S_IWGRP, + "usb/brlvger%d", priv->subminor); display_table[i] = priv; diff -puN drivers/usb/misc/rio500.c~switch-to-devfs_mk_bdev drivers/usb/misc/rio500.c --- 25/drivers/usb/misc/rio500.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/usb/misc/rio500.c 2003-05-06 22:57:33.000000000 -0700 @@ -475,11 +475,9 @@ static int probe_rio(struct usb_interfac } dbg("probe_rio: ibuf address:%p", rio->ibuf); - devfs_register(NULL, "usb/rio500", - DEVFS_FL_DEFAULT, USB_MAJOR, - RIO_MINOR, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | - S_IWGRP, &usb_rio_fops, NULL); + devfs_mk_cdev(MKDEV(USB_MAJOR, RIO_MINOR), + S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, + "usb/rio500"); init_MUTEX(&(rio->lock)); diff -puN drivers/usb/misc/tiglusb.c~switch-to-devfs_mk_bdev drivers/usb/misc/tiglusb.c --- 25/drivers/usb/misc/tiglusb.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/usb/misc/tiglusb.c 2003-05-06 22:57:33.000000000 -0700 @@ -327,7 +327,6 @@ tiglusb_probe (struct usb_interface *int int minor = -1; int i; ptiglusb_t s; - char name[32]; dbg ("probing vendor id 0x%x, device id 0x%x", dev->descriptor.idVendor, dev->descriptor.idProduct); @@ -371,12 +370,9 @@ tiglusb_probe (struct usb_interface *int up (&s->mutex); dbg ("bound to interface"); - sprintf (name, "ticables/usb/%d", s->minor); - dbg ("registering to devfs : major = %d, minor = %d, node = %s", - TIUSB_MAJOR, (TIUSB_MINOR + s->minor), name); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, TIUSB_MAJOR, - TIUSB_MINOR + s->minor, S_IFCHR | S_IRUGO | S_IWUGO, - &tiglusb_fops, NULL); + devfs_mk_cdev(MAJOR(TIUSB_MAJOR, TIUSB_MINOR + s->minor), + S_IFCHR | S_IRUGO | S_IWUGO, + "ticables/usb/%d", s->minor); /* Display firmware version */ info ("firmware revision %i.%02x", @@ -390,8 +386,6 @@ tiglusb_probe (struct usb_interface *int static void tiglusb_disconnect (struct usb_interface *intf) { - char name[32]; - ptiglusb_t s = usb_get_intfdata (intf); usb_set_intfdata (intf, NULL); @@ -408,7 +402,7 @@ tiglusb_disconnect (struct usb_interface s->dev = NULL; s->opened = 0; - devfs_remove (name, "ticables/usb/%d", s->minor); + devfs_remove("ticables/usb/%d", s->minor); info ("device %d removed", s->minor); diff -puN drivers/usb/usb-skeleton.c~switch-to-devfs_mk_bdev drivers/usb/usb-skeleton.c --- 25/drivers/usb/usb-skeleton.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/usb/usb-skeleton.c 2003-05-06 22:57:33.000000000 -0700 @@ -512,7 +512,6 @@ static int skel_probe(struct usb_interfa size_t buffer_size; int i; int retval; - char name[14]; /* See if the device offered us matches what we can accept */ @@ -607,14 +606,9 @@ static int skel_probe(struct usb_interfa } /* initialize the devfs node for this device and register it */ - sprintf(name, "usb/skel%d", dev->minor); - - devfs = devfs_register(NULL, name, - DEVFS_FL_DEFAULT, USB_MAJOR, - dev->minor, - S_IFCHR | S_IRUSR | S_IWUSR | - S_IRGRP | S_IWGRP | S_IROTH, - &skel_fops, NULL); + devfs_mk_cdev(MKDEV(USB_MAJOR, dev->minor), + S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH, + "usb/skel%d", dev->minor); /* let the user know what node this device is now attached to */ info ("USB Skeleton device now attached to USBSkel-%d", dev->minor); diff -puN drivers/video/fbmem.c~switch-to-devfs_mk_bdev drivers/video/fbmem.c --- 25/drivers/video/fbmem.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/drivers/video/fbmem.c 2003-05-06 22:57:33.000000000 -0700 @@ -1214,7 +1214,6 @@ static struct file_operations fb_fops = int register_framebuffer(struct fb_info *fb_info) { - char name_buf[12]; int i; if (num_registered_fb == FB_MAX) @@ -1242,10 +1241,9 @@ register_framebuffer(struct fb_info *fb_ spin_lock_init(&fb_info->pixmap.lock); registered_fb[i] = fb_info; - sprintf(name_buf, "fb/%d", i); - devfs_register(NULL, name_buf, DEVFS_FL_DEFAULT, - FB_MAJOR, i, S_IFCHR | S_IRUGO | S_IWUGO, - &fb_fops, NULL); + + devfs_mk_cdev(MKDEV(FB_MAJOR, i), + S_IFCHR | S_IRUGO | S_IWUGO, "fb/%d", i); return 0; } diff -puN fs/coda/psdev.c~switch-to-devfs_mk_bdev fs/coda/psdev.c --- 25/fs/coda/psdev.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/fs/coda/psdev.c 2003-05-06 22:57:33.000000000 -0700 @@ -373,16 +373,10 @@ static int init_coda_psdev(void) } devfs_mk_dir ("coda"); for (i = 0; i < MAX_CODADEVS; i++) { - char name[16]; - sprintf(name, "coda/%d", i); - devfs_register(NULL, name, DEVFS_FL_NONE, - CODA_PSDEV_MAJOR, i, - S_IFCHR | S_IRUSR | S_IWUSR, - &coda_psdev_fops, NULL); + devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), + S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); } - coda_sysctl_init(); - return 0; } diff -puN net/netlink/netlink_dev.c~switch-to-devfs_mk_bdev net/netlink/netlink_dev.c --- 25/net/netlink/netlink_dev.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/net/netlink/netlink_dev.c 2003-05-06 22:57:33.000000000 -0700 @@ -220,14 +220,6 @@ static struct { }, }; -static void __init make_devfs_entries (const char *name, int minor) -{ - devfs_register (NULL, name, DEVFS_FL_DEFAULT, - NETLINK_MAJOR, minor, - S_IFCHR | S_IRUSR | S_IWUSR, - &netlink_fops, NULL); -} - int __init init_netlink(void) { int i; @@ -236,18 +228,20 @@ int __init init_netlink(void) printk(KERN_ERR "netlink: unable to get major %d\n", NETLINK_MAJOR); return -EIO; } + devfs_mk_dir("netlink"); + /* Someone tell me the official names for the uppercase ones */ for (i = 0; i < sizeof(entries)/sizeof(entries[0]); i++) { - char name[20]; - sprintf(name, "netlink/%s", entries[i].name); - make_devfs_entries(name, entries[i].minor); + devfs_mk_cdev(MKDEV(NETLINK_MAJOR, entries[i].minor), + S_IFCHR|S_IRUSR|S_IWUSR, "netlink/%s", entries[i].name); } + for (i = 0; i < 16; i++) { - char name[20]; - sprintf(name, "netlink/tap%d", i); - make_devfs_entries(name, i + 16); + devfs_mk_cdev(MKDEV(NETLINK_MAJOR, i + 16), + S_IFCHR|S_IRUSR|S_IWUSR, "netlink/tap%d", i); } + return 0; } diff -puN sound/core/info.c~switch-to-devfs_mk_bdev sound/core/info.c --- 25/sound/core/info.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/sound/core/info.c 2003-05-06 22:57:33.000000000 -0700 @@ -1079,15 +1079,9 @@ snd_info_entry_t *snd_info_create_device p->data = (void *) entry; entry->p = p; up(&info_mutex); -#ifdef CONFIG_DEVFS_FS - if (strncmp(name, "controlC", 8)) { /* created in sound.c */ - char dname[32]; - sprintf(dname, "snd/%s", name); - devfs_register(NULL, dname, DEVFS_FL_DEFAULT, - _major, minor, mode, - &snd_fops, NULL); - } -#endif + + if (strncmp(name, "controlC", 8) == 0) /* created in sound.c */ + devfs_mk_cdev(MKDEV(_major, minor), mode, "snd/%s", name); return entry; } diff -puN sound/core/sound.c~switch-to-devfs_mk_bdev sound/core/sound.c --- 25/sound/core/sound.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/sound/core/sound.c 2003-05-06 22:57:33.000000000 -0700 @@ -323,13 +323,8 @@ int __exit snd_minor_info_done(void) static int __init alsa_sound_init(void) { -#ifdef CONFIG_DEVFS_FS short controlnum; - char controlname[24]; -#endif -#ifdef CONFIG_SND_OSSEMUL - int err; -#endif + int err = 0; int card; snd_ecards_limit = cards_limit; @@ -356,21 +351,19 @@ static int __init alsa_sound_init(void) #ifdef CONFIG_SND_OSSEMUL snd_info_minor_register(); #endif -#ifdef CONFIG_DEVFS_FS + for (controlnum = 0; controlnum < cards_limit; controlnum++) { - sprintf(controlname, "snd/controlC%d", controlnum); - devfs_register(NULL, controlname, DEVFS_FL_DEFAULT, - major, controlnum<<5, device_mode | S_IFCHR, - &snd_fops, NULL); + devfs_mk_cdev(MKDEV(major, controlnum<<5), + device_mode | S_IFCHR, "snd/controlC%d", controlnum); } -#endif + #ifndef MODULE printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n"); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) && defined(CONFIG_APM) pm_init(); #endif - return 0; + return err; } static void __exit alsa_sound_exit(void) diff -puN sound/oss/soundcard.c~switch-to-devfs_mk_bdev sound/oss/soundcard.c --- 25/sound/oss/soundcard.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/sound/oss/soundcard.c 2003-05-06 22:57:33.000000000 -0700 @@ -549,7 +549,6 @@ MODULE_PARM(dmabug, "i"); static int __init oss_init(void) { int err; - char name_buf[32]; int i, j; /* drag in sound_syms.o */ @@ -573,19 +572,18 @@ static int __init oss_init(void) sound_dmap_flag = (dmabuf > 0 ? 1 : 0); for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { - sprintf(name_buf, "sound/%s", dev_list[i].name); - devfs_register (NULL, name_buf, DEVFS_FL_NONE, - SOUND_MAJOR, dev_list[i].minor, - S_IFCHR | dev_list[i].mode, - &oss_sound_fops, NULL); + devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor), + S_IFCHR | dev_list[i].mode, + "sound/%s", dev_list[i].name); + if (!dev_list[i].num) continue; + for (j = 1; j < *dev_list[i].num; j++) { - sprintf(name_buf, "sound/%s%d", dev_list[i].name, j); - devfs_register (NULL, name_buf, DEVFS_FL_NONE, - SOUND_MAJOR, dev_list[i].minor + (j * 0x10), - S_IFCHR | dev_list[i].mode, - &oss_sound_fops, NULL); + devfs_mk_cdev(MKDEV(SOUND_MAJOR, + dev_list[i].minor + (j*0x10)), + S_IFCHR | dev_list[i].mode, + "sound/%s%d", dev_list[i].name, j); } } diff -puN sound/sound_core.c~switch-to-devfs_mk_bdev sound/sound_core.c --- 25/sound/sound_core.c~switch-to-devfs_mk_bdev 2003-05-06 22:57:29.000000000 -0700 +++ 25-akpm/sound/sound_core.c 2003-05-06 22:57:33.000000000 -0700 @@ -168,8 +168,8 @@ static int sound_insert_unit(struct soun else sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); - devfs_register(NULL, s->name, 0, SOUND_MAJOR, s->unit_minor, - S_IFCHR | mode, fops, NULL); + devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor), + S_IFCHR | mode, s->name); return r; fail: _