git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git]
/
drivers
/
char
/
tipar.c
diff --git
a/drivers/char/tipar.c
b/drivers/char/tipar.c
index
d30dc09
..
079db5a
100644
(file)
--- a/
drivers/char/tipar.c
+++ b/
drivers/char/tipar.c
@@
-42,6
+42,7
@@
*/
#undef DEBUG /* change to #define to get debugging
* output - for pr_debug() */
*/
#undef DEBUG /* change to #define to get debugging
* output - for pr_debug() */
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/errno.h>
@@
-55,6
+56,7
@@
#include <linux/ioport.h>
#include <asm/io.h>
#include <linux/bitops.h>
#include <linux/ioport.h>
#include <asm/io.h>
#include <linux/bitops.h>
+#include <linux/devfs_fs_kernel.h> /* DevFs support */
#include <linux/parport.h> /* Our code depend on parport */
#include <linux/device.h>
#include <linux/parport.h> /* Our code depend on parport */
#include <linux/device.h>
@@
-381,7
+383,7
@@
tipar_ioctl(struct inode *inode, struct file *file,
/* ----- kernel module registering ------------------------------------ */
/* ----- kernel module registering ------------------------------------ */
-static
const
struct file_operations tipar_fops = {
+static struct file_operations tipar_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = tipar_read,
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = tipar_read,
@@
-441,6
+443,12
@@
tipar_register(int nr, struct parport *port)
class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR,
TIPAR_MINOR + nr), NULL, "par%d", nr);
class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR,
TIPAR_MINOR + nr), NULL, "par%d", nr);
+ /* Use devfs, tree: /dev/ticables/par/[0..2] */
+ err = devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
+ S_IFCHR | S_IRUGO | S_IWUGO,
+ "ticables/par/%d", nr);
+ if (err)
+ goto out_class;
/* Display informations */
pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq ==
/* Display informations */
pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq ==
@@
-452,7
+460,11
@@
tipar_register(int nr, struct parport *port)
pr_info("tipar%d: link cable not found\n", nr);
err = 0;
pr_info("tipar%d: link cable not found\n", nr);
err = 0;
+ goto out;
+out_class:
+ class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr));
+ class_destroy(tipar_class);
out:
return err;
}
out:
return err;
}
@@
-495,6
+507,9
@@
tipar_init_module(void)
goto out;
}
goto out;
}
+ /* Use devfs with tree: /dev/ticables/par/[0..2] */
+ devfs_mk_dir("ticables/par");
+
tipar_class = class_create(THIS_MODULE, "ticables");
if (IS_ERR(tipar_class)) {
err = PTR_ERR(tipar_class);
tipar_class = class_create(THIS_MODULE, "ticables");
if (IS_ERR(tipar_class)) {
err = PTR_ERR(tipar_class);
@@
-513,6
+528,7
@@
out_class:
class_destroy(tipar_class);
out_chrdev:
class_destroy(tipar_class);
out_chrdev:
+ devfs_remove("ticables/par");
unregister_chrdev(TIPAR_MAJOR, "tipar");
out:
return err;
unregister_chrdev(TIPAR_MAJOR, "tipar");
out:
return err;
@@
-533,8
+549,10
@@
tipar_cleanup_module(void)
continue;
parport_unregister_device(table[i].dev);
class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i));
continue;
parport_unregister_device(table[i].dev);
class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i));
+ devfs_remove("ticables/par/%d", i);
}
class_destroy(tipar_class);
}
class_destroy(tipar_class);
+ devfs_remove("ticables/par");
pr_info("tipar: module unloaded\n");
}
pr_info("tipar: module unloaded\n");
}