]> git.hungrycats.org Git - linux/commitdiff
[PATCH] remaining bits of DEVFS_FL_AUTO_DEVNUM
authorChristoph Hellwig <hch@sgi.com>
Tue, 11 Mar 2003 03:54:50 +0000 (19:54 -0800)
committerChristoph Hellwig <hch@sgi.com>
Tue, 11 Mar 2003 03:54:50 +0000 (19:54 -0800)
Sorry, the devs_only() patch accidentally included the devfs-portion
of the DEVFS_FL_AUTO_DEVNUM patch.  This patch contains the remaining
parts.

Documentation/filesystems/devfs/README
drivers/media/radio/miropcm20-rds.c

index af0801af8e713f8ec06f30c90aaaaadcca87efa0..98688f4afc79041e7f78f0866aab49e1dee4c84e 100644 (file)
@@ -1466,13 +1466,6 @@ The simplest option (especially when porting drivers to devfs) is to
 keep using the old major and minor numbers. Devfs will take whatever
 values are given for major&minor and pass them onto userspace.
 
-Alternatively, you can have devfs choose unique device numbers for
-you. When you register a character or block device using
-devfs_register you can provide the optional
-DEVFS_FL_AUTO_DEVNUM flag, which will then automatically allocate a
-unique device number (the allocation is separated for the character
-and block devices).
-
 This device number is a 16 bit number, so this leaves plenty of space
 for large numbers of discs and partitions. This scheme can also be
 used for character devices, in particular the tty devices, which are
index 17a32bc17d9636151a82f2a7b892d6c306efe8dd..fa2eebe2ecd0e8f17dfa682f210c22c53e53eb0b 100644 (file)
@@ -12,8 +12,9 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/miscdevice.h>
 #include <linux/devfs_fs_kernel.h>
+#include <asm/uaccess.h>
 #include "miropcm20-rds-core.h"
 
 static char * text_buffer;
@@ -103,28 +104,39 @@ static ssize_t rds_f_read(struct file *file, char *buffer, size_t length, loff_t
        }
 }
 
-static struct file_operations rds_f_ops = {
+static struct file_operations rds_fops = {
        .owner          = THIS_MODULE,
        .read           = rds_f_read,
        .open           = rds_f_open,
        .release        = rds_f_release
 };
 
+static struct miscdevice rds_miscdev = {
+       .minor          = MISC_DYNAMIC_MINOR,
+       .name           = "radiotext"
+       .fops           = &rds_fops,
+};
 
 static int __init miropcm20_rds_init(void)
 {
-       if (!devfs_register(NULL, "v4l/rds/radiotext", 
-                                  DEVFS_FL_DEFAULT | DEVFS_FL_AUTO_DEVNUM,
-                                  0, 0, S_IRUGO | S_IFCHR, &rds_f_ops, NULL))
-               return -EINVAL;
+       int error;
 
-       printk("miropcm20-rds: userinterface driver loaded.\n");
-       return 0;
+       error = misc_register(&rds_miscdev);
+       if (error)
+               return error;
+
+       error = devfs_mk_symlink(NULL, "v4l/rds/radiotext", 0,
+                                "../misc/radiotext", NULL, NULL);
+       if (error)
+               misc_deregister(&rds_miscdev)
+
+       return error;
 }
 
 static void __exit miropcm20_rds_cleanup(void)
 {
        devfs_remove("v4l/rds/radiotext");
+       misc_deregister(&rds_miscdev)
 }
 
 module_init(miropcm20_rds_init);