#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
+#include <linux/devfs_fs_kernel.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/mtio.h>
goto out_chrdev;
}
+ devfs_mk_dir("pt");
for (unit = 0; unit < PT_UNITS; unit++)
if (pt[unit].present) {
class_device_create(pt_class, NULL, MKDEV(major, unit),
NULL, "pt%d", unit);
+ err = devfs_mk_cdev(MKDEV(major, unit),
+ S_IFCHR | S_IRUSR | S_IWUSR,
+ "pt/%d", unit);
+ if (err) {
+ class_device_destroy(pt_class, MKDEV(major, unit));
+ goto out_class;
+ }
class_device_create(pt_class, NULL, MKDEV(major, unit + 128),
NULL, "pt%dn", unit);
+ err = devfs_mk_cdev(MKDEV(major, unit + 128),
+ S_IFCHR | S_IRUSR | S_IWUSR,
+ "pt/%dn", unit);
+ if (err) {
+ class_device_destroy(pt_class, MKDEV(major, unit + 128));
+ goto out_class;
+ }
}
goto out;
+out_class:
+ class_destroy(pt_class);
out_chrdev:
unregister_chrdev(major, "pt");
out:
for (unit = 0; unit < PT_UNITS; unit++)
if (pt[unit].present) {
class_device_destroy(pt_class, MKDEV(major, unit));
+ devfs_remove("pt/%d", unit);
class_device_destroy(pt_class, MKDEV(major, unit + 128));
+ devfs_remove("pt/%dn", unit);
}
class_destroy(pt_class);
+ devfs_remove("pt");
unregister_chrdev(major, name);
for (unit = 0; unit < PT_UNITS; unit++)
if (pt[unit].present)